linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dwalker@codeaurora.org (Daniel Walker)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] msm: iommu: Generalize platform data for multiple targets
Date: Fri, 11 Feb 2011 13:14:49 -0800	[thread overview]
Message-ID: <1297458889.4852.24.camel@m0nster> (raw)
In-Reply-To: <8yaipwql1wf.fsf@huya.qualcomm.com>

On Fri, 2011-02-11 at 13:03 -0800, David Brown wrote:
> 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,
> >>> -		.end   = MSM_IOMMU_JPEGD_PHYS + MSM_IOMMU_JPEGD_SIZE - 1,
> >>> +		.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
> slightly.

It only obscures the constant, which no one really looks at anyway. in
general it's better design to hide constant like this, because people
don't work naturally with numbers like this.

A good example might be if all these constants are enumerated in a
header file, but aren't all used. In that case it would be fairly easy
to add a new resource without even know what the constant is just by
following the pattern.

I think in general this series just makes this iommu code very much
8660/8960 only code, but what about the potential next iteration of SoC
that uses very similar code to this with all new constants. So this
doesn't seem forward thinking to me.

Daniel


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

  reply	other threads:[~2011-02-11 21:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-11 20:28 [PATCH 1/3] msm: iommu: Create a Kconfig item for the IOMMU driver Stepan Moskovchenko
2011-02-11 20:28 ` [PATCH 2/3] msm: iommu: Generalize platform data for multiple targets Stepan Moskovchenko
2011-02-11 20:42   ` Daniel Walker
2011-02-11 20:51     ` Steve Muckle
2011-02-11 20:58       ` Daniel Walker
2011-02-11 21:00         ` Steve Muckle
2011-02-11 21:03           ` Daniel Walker
2011-02-11 21:03       ` David Brown
2011-02-11 21:14         ` Daniel Walker [this message]
2011-02-11 21:53           ` David Brown
2011-02-11 22:00             ` Daniel Walker
2011-02-11 22:12   ` Daniel Walker
2011-02-11 22:37     ` David Brown
2011-02-11 22:47       ` Daniel Walker
2011-02-11 23:16         ` David Brown
2011-02-11 23:35           ` Daniel Walker
2011-02-11 20:28 ` [PATCH 3/3] msm: iommu: Enable IOMMU support for MSM8960 Stepan Moskovchenko
2011-02-11 20:38 ` [PATCH 1/3] msm: iommu: Create a Kconfig item for the IOMMU driver Daniel Walker
2011-02-15 19:35   ` David Brown
2011-02-15 19:49     ` Daniel Walker
2011-02-25  0:12       ` David Brown
2011-02-16  0:36     ` Daniel Walker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297458889.4852.24.camel@m0nster \
    --to=dwalker@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).