Re: [PATCH] hwmon: f71882fg: properly acquire I/O regions whileprobing

From: Jean Delvare
Date: Wed Mar 24 2010 - 05:29:50 EST


On Tue, 23 Mar 2010 15:12:15 +0100, Giel van Schijndel wrote:
> Acquire the I/O region for the Super I/O chip while we're working on it.
>
> Further alter the way multiple Super I/O addresses are probed for chips
> such that errors in the probing process are passed on from the module
> initialisation function.
>
> Some code cleanup: properly using, previously defined, functions rather
> than duplicating their code.
> (...)

On top of Hans' comments, to which I agree:

> static u16 f71882fg_read_temp(struct f71882fg_data *data, int nr)
> @@ -2184,6 +2178,13 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address,
> int err = -ENODEV;
> u16 devid;
>
> + /* Don't step on other driver's I/O space by accident */
> + if (!request_region(sioaddr, 2, DRVNAME)) {
> + printk(KERN_ERR DRVNAME ": I/O address 0x%04x already in use\n",
> + (int)sioaddr);
> + return -EIO;

This is the wrong error code. This isn't an I/O error. You want -EBUSY.

> + }
> +
> superio_enter(sioaddr);
>
> devid = superio_inw(sioaddr, SIO_REG_MANID);

--
Jean Delvare
--
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/