Re: [PATCH] gpio: New driver for the Intel 82801 (ICH) GPIO pins

From: Alan Cox
Date: Tue Apr 19 2011 - 17:16:14 EST


On Wed, 20 Apr 2011 00:30:31 +0400
Anton Vorontsov <cbouatmailru@xxxxxxxxx> wrote:

> On Tue, Apr 19, 2011 at 06:08:29PM +0100, Alan Cox wrote:
> > > How about exporting some bus/device-type neutral probe function, like
> > > we do in drivers/ata/pata_platform.c ?
> >
> > Not sure you want to be using resources as the basic currency, nor do you
> > want your generic code doing the request_region stuff. That was a nasty
> > mistake we made in the IDE code.
> >
> > Maybe the platform code should do that bit, but the generic stuff not - in
> > the PCI case the caller will have done pci_request_* itself and chances
> > are several of the resources are the same pci device resource and
> > different offsets so doing request_resource on them will blow up.
>
> Oh, right. How about this:
>
> int __devinit bgpio_probe(struct device *dev,
> unsigned long sz,
> void __iomem *dat,
> void __iomem *set,
> void __iomem *clr,
> void __iomem *dirout,
> void __iomem *dirin,
> bool big_endian);
>
> I.e. PCI driver can now map the whole area with a single ioremap(),
> and then call bgpio_probe(), which will provide accessors and
> common MMIO GPIO registration stuff.

Looks sane and providing its all using iomap/ioread/iowrite it covers all
cases nicely.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/