[PATCH 2.6] Hydra i2c
Christoph Hellwig
hch at lst.de
Sun Jan 18 23:49:57 EST 2004
On Sun, Jan 18, 2004 at 01:28:22PM +0100, Geert Uytterhoeven wrote:
> +static int __devinit hydra_probe(struct pci_dev *dev,
> + const struct pci_device_id *id)
> +{
> + unsigned int base_addr;
> +
> + base_addr = dev->resource[0].start;
I think you should use pci_resource_start here.
> + hydra_bit_data.data = ioremap(base_addr, 0x100);
And pci_resource len instead of hardcoding it? Also you need to
check the ioremap return value.
You should also add a safety exit for the case the probe callback is
called more than once. Or dynamic allocate a per-device struct instead
of using hydra_bit_data.
> +static void __exit i2c_hydra_exit(void)
> +{
> + pci_unregister_driver(&hydra_driver);
> + iounmap(hydra_bit_data.data);
The ioremap should move into the hydra_remove.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev
mailing list