[lkml]   [2011]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 2/3] msm: iommu: Generalize platform data for multiple targets
On Fri, Feb 11 2011, Steve Muckle wrote:

> On 02/11/11 12:42, Daniel Walker wrote:
>>> static struct resource msm_iommu_jpegd_resources[] = {
>>> {
>>> - .start = MSM_IOMMU_JPEGD_PHYS,
>>> + .start = 0x07300000,
>>> + .end = 0x07300000 + SZ_1M - 1,
>> Looks worse .. Just put the macros into a static header file for both.
> Why bother defining macros for these if they only appear here? I don't
> think that adds any value or readability - these addresses are clearly
> the physical area for the msm_iommu_jpegd. It just makes it more
> annoying to have to look up the values in a separate file if you are
> wondering what they are.

I want to chime in with a second on this. Defining names for constants
serves several purposes:

- It gives meaning to the constants.

- It allows the definition to be centralized if the value is used in
one place.

If the constants are initializers in a table, it satisfies both of these
reasons. Adding #defines for these constants does nothing other than
cause an extra indirection that the reader of the code has to make.

If they were used in more than one place, we could justify the
definition, but in this case, the definition just obscures the code


Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

 \ /
  Last update: 2011-02-11 22:05    [W:0.039 / U:2.560 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site