On Wed, Mar 13, 2013 at 12:19:10PM -0700, H Hartley Sweeten wrote: > The variable dev->iobase holds the primary iobase address used > by the comedi drivers. For PCI drivers, this value is found in > one of the PCI bars of the device. > > Currently all comedi PCI drivers set dev->iobase after calling > comedi_pci_enable(). For PCI devices that use memory mapped i/o > the PCI bar is ioremap'ed and the void __iomem * is stored in > the drivers private data. For these drivers the dev->iobase is > set to a non-zero value so that comedi_pci_disable() knows to > release the resources and disable the PCI device during the > (*detach). > > Move the setting of dev->iobase to comedi_pci_enable() to remove > the need for the drivers to handle it and to ensure that dev->iobase > is always a non-zero value. > I kind of liked Ian's idea of adding another member to the struct. Or we could make it a define like -1 define like: #define COMEDI_AUTO_IOBASE ((unsigned long)-1) I maybe would explicitly look for it in comedi_pci_disable() if (pcidev && (dev->iobase || dev->iobase == COMEDI_AUTO_IOBASE)) { The compiler strips out that part of the condition but it's useful in cscope to understand how COMEDI_AUTO_IOBASE works. regards, dan carpenter _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel