Re: driver coding style

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2006-03-17 at 22:38 +0000, Bahadir Balban wrote:
> On 3/17/06, Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
> > On Fri, 2006-03-17 at 11:21 +0000, Bahadir Balban wrote:
> > > Hi there,
> > >
> > > To access device registers, which one is best practice in terms of
> > > coding style, and is any of them totally unacceptable for a driver to
> > > be merged to the kernel?
> > >
> > > 1) Is this ok?
> > this sounds bad. Why? because this can only ever work with 1 piece of
> 
> > these are 2 different uses
> > in the first case (2) device_global_struct is a *fake* pointer which
> > "points" to the ioremap cookie. The "& ... -> .... " construct is a
> > fancy way to write "+" to the compiler basically.
> > in the second case (3) device_global_struct is a real structure, in
> > which you stored the cookie itself.
> 
> So as a result do you imply that (2) and (3) are acceptable (or even
> good) ways of accessing device registers?

yes

personally I have a slight preference for (2) actually but that's just
taste.



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux