aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2008-07-14 16:38:33 -0400
committerJean Delvare <khali@mahadeva.delvare>2008-07-14 16:38:33 -0400
commit54fb4a05af0a4b814e6716cfdf3fa97fc6be7a32 (patch)
treeb3a258dce4f1bc8ccb58541efae444ba89f9fc55
parent2373c1801afd06d3a206376902b39a98458c9cfb (diff)
i2c: Check for ACPI resource conflicts
Check for ACPI resource conflicts in i2c bus drivers. I've included all recent SMBus master drivers for PC hardware. I've voluntarily left out: * Drivers that don't run on PCs: they can't conflict with ACPI. * Bit-banged bus device drivers: it's very unlikely that ACPI would deal with such buses. Signed-off-by: Jean Delvare <jdelvare@suse.de>
-rw-r--r--drivers/i2c/busses/i2c-ali1535.c6
-rw-r--r--drivers/i2c/busses/i2c-ali1563.c5
-rw-r--r--drivers/i2c/busses/i2c-ali15x3.c5
-rw-r--r--drivers/i2c/busses/i2c-amd756.c6
-rw-r--r--drivers/i2c/busses/i2c-amd8111.c5
-rw-r--r--drivers/i2c/busses/i2c-i801.c5
-rw-r--r--drivers/i2c/busses/i2c-isch.c3
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c6
-rw-r--r--drivers/i2c/busses/i2c-piix4.c4
-rw-r--r--drivers/i2c/busses/i2c-sis5595.c6
-rw-r--r--drivers/i2c/busses/i2c-sis630.c6
-rw-r--r--drivers/i2c/busses/i2c-sis96x.c5
-rw-r--r--drivers/i2c/busses/i2c-viapro.c5
13 files changed, 67 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
index 8d1d90ab3a90..442d559b1aa9 100644
--- a/drivers/i2c/busses/i2c-ali1535.c
+++ b/drivers/i2c/busses/i2c-ali1535.c
@@ -61,6 +61,7 @@
61#include <linux/ioport.h> 61#include <linux/ioport.h>
62#include <linux/i2c.h> 62#include <linux/i2c.h>
63#include <linux/init.h> 63#include <linux/init.h>
64#include <linux/acpi.h>
64#include <asm/io.h> 65#include <asm/io.h>
65 66
66 67
@@ -159,6 +160,11 @@ static int ali1535_setup(struct pci_dev *dev)
159 goto exit; 160 goto exit;
160 } 161 }
161 162
163 retval = acpi_check_region(ali1535_smba, ALI1535_SMB_IOSIZE,
164 ali1535_driver.name);
165 if (retval)
166 goto exit;
167
162 if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE, 168 if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE,
163 ali1535_driver.name)) { 169 ali1535_driver.name)) {
164 dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n", 170 dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n",
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c
index 4b55ae19db8d..fc3e5b026423 100644
--- a/drivers/i2c/busses/i2c-ali1563.c
+++ b/drivers/i2c/busses/i2c-ali1563.c
@@ -21,6 +21,7 @@
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/acpi.h>
24 25
25#define ALI1563_MAX_TIMEOUT 500 26#define ALI1563_MAX_TIMEOUT 500
26#define ALI1563_SMBBA 0x80 27#define ALI1563_SMBBA 0x80
@@ -356,6 +357,10 @@ static int __devinit ali1563_setup(struct pci_dev * dev)
356 } 357 }
357 } 358 }
358 359
360 if (acpi_check_region(ali1563_smba, ALI1563_SMB_IOSIZE,
361 ali1563_pci_driver.name))
362 goto Err;
363
359 if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE, 364 if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE,
360 ali1563_pci_driver.name)) { 365 ali1563_pci_driver.name)) {
361 dev_err(&dev->dev, "Could not allocate I/O space at 0x%04x\n", 366 dev_err(&dev->dev, "Could not allocate I/O space at 0x%04x\n",
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
index e922c3950fcd..a030abd3b32b 100644
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c
@@ -68,6 +68,7 @@
68#include <linux/delay.h> 68#include <linux/delay.h>
69#include <linux/i2c.h> 69#include <linux/i2c.h>
70#include <linux/init.h> 70#include <linux/init.h>
71#include <linux/acpi.h>
71#include <asm/io.h> 72#include <asm/io.h>
72 73
73/* ALI15X3 SMBus address offsets */ 74/* ALI15X3 SMBus address offsets */
@@ -166,6 +167,10 @@ static int ali15x3_setup(struct pci_dev *ALI15X3_dev)
166 if(force_addr) 167 if(force_addr)
167 ali15x3_smba = force_addr & ~(ALI15X3_SMB_IOSIZE - 1); 168 ali15x3_smba = force_addr & ~(ALI15X3_SMB_IOSIZE - 1);
168 169
170 if (acpi_check_region(ali15x3_smba, ALI15X3_SMB_IOSIZE,
171 ali15x3_driver.name))
172 return -EBUSY;
173
169 if (!request_region(ali15x3_smba, ALI15X3_SMB_IOSIZE, 174 if (!request_region(ali15x3_smba, ALI15X3_SMB_IOSIZE,
170 ali15x3_driver.name)) { 175 ali15x3_driver.name)) {
171 dev_err(&ALI15X3_dev->dev, 176 dev_err(&ALI15X3_dev->dev,
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index bd4f6380fabe..26acc657e5c9 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -45,6 +45,7 @@
45#include <linux/ioport.h> 45#include <linux/ioport.h>
46#include <linux/i2c.h> 46#include <linux/i2c.h>
47#include <linux/init.h> 47#include <linux/init.h>
48#include <linux/acpi.h>
48#include <asm/io.h> 49#include <asm/io.h>
49 50
50/* AMD756 SMBus address offsets */ 51/* AMD756 SMBus address offsets */
@@ -368,6 +369,11 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
368 amd756_ioport += SMB_ADDR_OFFSET; 369 amd756_ioport += SMB_ADDR_OFFSET;
369 } 370 }
370 371
372 error = acpi_check_region(amd756_ioport, SMB_IOSIZE,
373 amd756_driver.name);
374 if (error)
375 return error;
376
371 if (!request_region(amd756_ioport, SMB_IOSIZE, amd756_driver.name)) { 377 if (!request_region(amd756_ioport, SMB_IOSIZE, amd756_driver.name)) {
372 dev_err(&pdev->dev, "SMB region 0x%x already in use!\n", 378 dev_err(&pdev->dev, "SMB region 0x%x already in use!\n",
373 amd756_ioport); 379 amd756_ioport);
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index 0e18fe846010..3972208876b3 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/acpi.h>
19#include <asm/io.h> 20#include <asm/io.h>
20 21
21MODULE_LICENSE("GPL"); 22MODULE_LICENSE("GPL");
@@ -374,6 +375,10 @@ static int __devinit amd8111_probe(struct pci_dev *dev,
374 smbus->base = pci_resource_start(dev, 0); 375 smbus->base = pci_resource_start(dev, 0);
375 smbus->size = pci_resource_len(dev, 0); 376 smbus->size = pci_resource_len(dev, 0);
376 377
378 error = acpi_check_resource_conflict(&dev->resource[0]);
379 if (error)
380 goto out_kfree;
381
377 if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) { 382 if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) {
378 error = -EBUSY; 383 error = -EBUSY;
379 goto out_kfree; 384 goto out_kfree;
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 46aa41f73fdd..8d0bc4bfe154 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -64,6 +64,7 @@
64#include <linux/ioport.h> 64#include <linux/ioport.h>
65#include <linux/init.h> 65#include <linux/init.h>
66#include <linux/i2c.h> 66#include <linux/i2c.h>
67#include <linux/acpi.h>
67#include <asm/io.h> 68#include <asm/io.h>
68 69
69/* I801 SMBus address offsets */ 70/* I801 SMBus address offsets */
@@ -624,6 +625,10 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
624 goto exit; 625 goto exit;
625 } 626 }
626 627
628 err = acpi_check_resource_conflict(&dev->resource[SMBBAR]);
629 if (err)
630 goto exit;
631
627 err = pci_request_region(dev, SMBBAR, i801_driver.name); 632 err = pci_request_region(dev, SMBBAR, i801_driver.name);
628 if (err) { 633 if (err) {
629 dev_err(&dev->dev, "Failed to request SMBus region " 634 dev_err(&dev->dev, "Failed to request SMBus region "
diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
index 8d648911a7f5..b9c01aa90036 100644
--- a/drivers/i2c/busses/i2c-isch.c
+++ b/drivers/i2c/busses/i2c-isch.c
@@ -35,6 +35,7 @@
35#include <linux/i2c.h> 35#include <linux/i2c.h>
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/io.h> 37#include <linux/io.h>
38#include <linux/acpi.h>
38 39
39/* SCH SMBus address offsets */ 40/* SCH SMBus address offsets */
40#define SMBHSTCNT (0 + sch_smba) 41#define SMBHSTCNT (0 + sch_smba)
@@ -279,6 +280,8 @@ static int __devinit sch_probe(struct pci_dev *dev,
279 dev_err(&dev->dev, "SMBus base address uninitialized!\n"); 280 dev_err(&dev->dev, "SMBus base address uninitialized!\n");
280 return -ENODEV; 281 return -ENODEV;
281 } 282 }
283 if (acpi_check_region(sch_smba, SMBIOSIZE, sch_driver.name))
284 return -EBUSY;
282 if (!request_region(sch_smba, SMBIOSIZE, sch_driver.name)) { 285 if (!request_region(sch_smba, SMBIOSIZE, sch_driver.name)) {
283 dev_err(&dev->dev, "SMBus region 0x%x already in use!\n", 286 dev_err(&dev->dev, "SMBus region 0x%x already in use!\n",
284 sch_smba); 287 sch_smba);
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 2654f20d3a62..3b19bc41a60b 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -51,6 +51,7 @@
51#include <linux/i2c.h> 51#include <linux/i2c.h>
52#include <linux/delay.h> 52#include <linux/delay.h>
53#include <linux/dmi.h> 53#include <linux/dmi.h>
54#include <linux/acpi.h>
54#include <asm/io.h> 55#include <asm/io.h>
55 56
56MODULE_LICENSE("GPL"); 57MODULE_LICENSE("GPL");
@@ -343,6 +344,11 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
343 smbus->size = 64; 344 smbus->size = 64;
344 } 345 }
345 346
347 error = acpi_check_region(smbus->base, smbus->size,
348 nforce2_driver.name);
349 if (error)
350 return -1;
351
346 if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) { 352 if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) {
347 dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n", 353 dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n",
348 smbus->base, smbus->base+smbus->size-1, name); 354 smbus->base, smbus->base+smbus->size-1, name);
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 85d69f3e624f..924e84a53488 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -39,6 +39,7 @@
39#include <linux/i2c.h> 39#include <linux/i2c.h>
40#include <linux/init.h> 40#include <linux/init.h>
41#include <linux/dmi.h> 41#include <linux/dmi.h>
42#include <linux/acpi.h>
42#include <asm/io.h> 43#include <asm/io.h>
43 44
44 45
@@ -168,6 +169,9 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev,
168 } 169 }
169 } 170 }
170 171
172 if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name))
173 return -EBUSY;
174
171 if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) { 175 if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
172 dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n", 176 dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n",
173 piix4_smba); 177 piix4_smba);
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
index f76944b384f5..3c8e0e1bd24f 100644
--- a/drivers/i2c/busses/i2c-sis5595.c
+++ b/drivers/i2c/busses/i2c-sis5595.c
@@ -62,6 +62,7 @@
62#include <linux/ioport.h> 62#include <linux/ioport.h>
63#include <linux/init.h> 63#include <linux/init.h>
64#include <linux/i2c.h> 64#include <linux/i2c.h>
65#include <linux/acpi.h>
65#include <asm/io.h> 66#include <asm/io.h>
66 67
67static int blacklist[] = { 68static int blacklist[] = {
@@ -174,6 +175,11 @@ static int sis5595_setup(struct pci_dev *SIS5595_dev)
174 175
175 /* NB: We grab just the two SMBus registers here, but this may still 176 /* NB: We grab just the two SMBus registers here, but this may still
176 * interfere with ACPI :-( */ 177 * interfere with ACPI :-( */
178 retval = acpi_check_region(sis5595_base + SMB_INDEX, 2,
179 sis5595_driver.name);
180 if (retval)
181 return retval;
182
177 if (!request_region(sis5595_base + SMB_INDEX, 2, 183 if (!request_region(sis5595_base + SMB_INDEX, 2,
178 sis5595_driver.name)) { 184 sis5595_driver.name)) {
179 dev_err(&SIS5595_dev->dev, "SMBus registers 0x%04x-0x%04x already in use!\n", 185 dev_err(&SIS5595_dev->dev, "SMBus registers 0x%04x-0x%04x already in use!\n",
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
index eb2b2181fed7..72c29a650b22 100644
--- a/drivers/i2c/busses/i2c-sis630.c
+++ b/drivers/i2c/busses/i2c-sis630.c
@@ -55,6 +55,7 @@
55#include <linux/ioport.h> 55#include <linux/ioport.h>
56#include <linux/init.h> 56#include <linux/init.h>
57#include <linux/i2c.h> 57#include <linux/i2c.h>
58#include <linux/acpi.h>
58#include <asm/io.h> 59#include <asm/io.h>
59 60
60/* SIS630 SMBus registers */ 61/* SIS630 SMBus registers */
@@ -437,6 +438,11 @@ static int sis630_setup(struct pci_dev *sis630_dev)
437 438
438 dev_dbg(&sis630_dev->dev, "ACPI base at 0x%04x\n", acpi_base); 439 dev_dbg(&sis630_dev->dev, "ACPI base at 0x%04x\n", acpi_base);
439 440
441 retval = acpi_check_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION,
442 sis630_driver.name);
443 if (retval)
444 goto exit;
445
440 /* Everything is happy, let's grab the memory and set things up. */ 446 /* Everything is happy, let's grab the memory and set things up. */
441 if (!request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION, 447 if (!request_region(acpi_base + SMB_STS, SIS630_SMB_IOREGION,
442 sis630_driver.name)) { 448 sis630_driver.name)) {
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
index 413e9e477723..848b37c97f7f 100644
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -40,6 +40,7 @@
40#include <linux/ioport.h> 40#include <linux/ioport.h>
41#include <linux/i2c.h> 41#include <linux/i2c.h>
42#include <linux/init.h> 42#include <linux/init.h>
43#include <linux/acpi.h>
43#include <asm/io.h> 44#include <asm/io.h>
44 45
45/* base address register in PCI config space */ 46/* base address register in PCI config space */
@@ -281,6 +282,10 @@ static int __devinit sis96x_probe(struct pci_dev *dev,
281 dev_info(&dev->dev, "SiS96x SMBus base address: 0x%04x\n", 282 dev_info(&dev->dev, "SiS96x SMBus base address: 0x%04x\n",
282 sis96x_smbus_base); 283 sis96x_smbus_base);
283 284
285 retval = acpi_check_resource_conflict(&dev->resource[SIS96x_BAR]);
286 if (retval)
287 return retval;
288
284 /* Everything is happy, let's grab the memory and set things up. */ 289 /* Everything is happy, let's grab the memory and set things up. */
285 if (!request_region(sis96x_smbus_base, SMB_IOSIZE, 290 if (!request_region(sis96x_smbus_base, SMB_IOSIZE,
286 sis96x_driver.name)) { 291 sis96x_driver.name)) {
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
index 7957ce515891..faef99560f23 100644
--- a/drivers/i2c/busses/i2c-viapro.c
+++ b/drivers/i2c/busses/i2c-viapro.c
@@ -50,6 +50,7 @@
50#include <linux/ioport.h> 50#include <linux/ioport.h>
51#include <linux/i2c.h> 51#include <linux/i2c.h>
52#include <linux/init.h> 52#include <linux/init.h>
53#include <linux/acpi.h>
53#include <asm/io.h> 54#include <asm/io.h>
54 55
55static struct pci_dev *vt596_pdev; 56static struct pci_dev *vt596_pdev;
@@ -356,6 +357,10 @@ static int __devinit vt596_probe(struct pci_dev *pdev,
356 } 357 }
357 358
358found: 359found:
360 error = acpi_check_region(vt596_smba, 8, vt596_driver.name);
361 if (error)
362 return error;
363
359 if (!request_region(vt596_smba, 8, vt596_driver.name)) { 364 if (!request_region(vt596_smba, 8, vt596_driver.name)) {
360 dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n", 365 dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n",
361 vt596_smba); 366 vt596_smba);