From: Giel van Schijndel Date: Thu, 27 May 2010 17:58:43 +0000 (+0200) Subject: hwmon: (f71882fg) Acquire I/O regions while we're working with them X-Git-Tag: v2.6.35-rc1~33^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=729d273aa7c86eb1406ade4eadf249cff188bf9a;p=profile%2Fivi%2Fkernel-x86-ivi.git hwmon: (f71882fg) Acquire I/O regions while we're working with them Acquire the I/O region for the Super I/O chip while we're working on it. Signed-off-by: Giel van Schijndel Cc: Hans de Goede Signed-off-by: Jean Delvare --- diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index ca34e5c4870..537841ef44b 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c @@ -2178,6 +2178,13 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, int err = -ENODEV; u16 devid; + /* Don't step on other drivers' 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 -EBUSY; + } + superio_enter(sioaddr); devid = superio_inw(sioaddr, SIO_REG_MANID); @@ -2232,6 +2239,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, (int)superio_inb(sioaddr, SIO_REG_DEVREV)); exit: superio_exit(sioaddr); + release_region(sioaddr, 2); return err; }