Re: more kernel programming style questions

2002-12-14 Thread Wes Peters
"M. Warner Losh" wrote: > > You are better off defining a series of macros that do proper > bus_space_readN/bus_space_writeN for each of the fields in the > register set. This will ensure that your driver works unaltered on > other architectures. > > Directly accessing memory mapped devices is a

Re: more kernel programming style questions

2002-12-13 Thread M. Warner Losh
You are better off defining a series of macros that do proper bus_space_readN/bus_space_writeN for each of the fields in the register set. This will ensure that your driver works unaltered on other architectures. Directly accessing memory mapped devices is a bad idea. While it works on i386, the

Re: more kernel programming style questions

2002-12-13 Thread Louis A. Mamakos
I'm not holding this up as the best example of style, but take a look at the Bt848 driver in /sys/pci for one approach. Some years ago I contributed some patches that got integrated that turned those offset references into a structure definition. The structure definition was done with some macr

more kernel programming style questions

2002-12-13 Thread Daniel Lang
Hi, now I've come across another style problem. The MOXA hardware of course maintains a structure for each channel. I have details about the size and offsets for each field, belonging to a channel. What would be the most sensible way, to access them? I can come up, with two possiblities: use