[PATCH 2.6] Hydra i2c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux