Re: [PATCH] 2.6.10 Altix : ioc4 serial driver support

Christoph Hellwig
2005-01-03T14:10:07Z

On Wed, Dec 22, 2004 at 01:53:28PM -0600, Patrick Gefre wrote:
> Christoph Hellwig wrote:
>
> >So both claim the same PCI ID? In this case you need to creat a small
> >shim driver that exports a pseudo-bus to the serial and ide driver using
> >the driver model. You must never return an error from ->probe if you
> >actually use that particular device.
> >
>
> Has this been done before ? Any example I can use ??

Well, just about any secondary bus (e.g. usb, iee1394, i2c) works that way,
but I guess all those examples are a little too complicated for your example.
the PPC OCP stuff might be a better example as it's an on-chip pseudo-bus,
otoh it's a top-level bus and not parented by PCI.

> >The second argumnet to writeX (and readX) is actually void __iomem *,
> >but to see the difference you need to run sparse (from sparse.bkbits.net)
> >over the driver. Please store all I/O addresses in void __iomem * pointers
> >in your structures and avoid the cast here and in all the other places.
> >
>
> So then I'd have to declare the end elements as:
> void __iomem foo;
>
> They are 32 bit values, so it's OK to assume that void __iomem is 32bits ?

Hmm? void __iomem must only ever be used as a pointer and passed to
readX/writeX. Pointer arithmetics are allowed and it's treated equally
to char * for that (GCC extension)

> >no need to cast the return value from kmalloc (dito for the other places)
> >
>
> Why is that ? Seems if kmalloc returns a void * and the left side is not, a
> casting is appropriate ?

void * is magic in C and can be assigned to any pointer and vice versa.