[PATCH 2/7] davinci: eliminate use of IO_ADDRESS() on sysmod

Arnd Bergmann arnd at arndb.de
Tue Mar 15 05:00:10 EDT 2011


On Tuesday 15 March 2011 07:00:44 Nori, Sekhar wrote:

> > * If you need to access sysmod in multiple places, a nicer
> >   way would be to make the virtual address pointer static,
> >   and export the accessor functions for it, rather than
> >   having a global pointer.
> 
> Seems like opinion is divided on this. A while back
> I submitted a patch with such an accessor function and
> was asked to do the opposite of what you are asking here.
> 
> https://patchwork.kernel.org/patch/366501/
> 
> It can be changed to the way you are asking, but would
> like to know what is more universally acceptable (if
> at all there is such a thing).

One difference is that the base address pointer here
can be treated as read-only by using an accessor function,
which was not possible for the case you cited. Doing
an inline function would also let you make the access
more type-safe, e.g forcing the right kind of readl/writel
variant and possibly locking if necessary.

I would also argue against Sergei's point for the other
patch -- the current solution is not better than the originally
suggested one IMHO. I believe a better way would have
been to pass the maximum frequency as an argument to
da850_register_cpufreq() in that case.

However, neither of these discussion is really important,
and we don't have a strict rule for doing it one way
or the other. Just use common sense and decide case-by-case,
as I said in the previous comment, you got the important
parts right.

	Arnd



More information about the linux-arm-kernel mailing list