rendered paste body--- drivers/i2c/busses/i2c-ali1535.c.orig 2011-06-15 18:02:56.000000000 +0200
+++ drivers/i2c/busses/i2c-ali1535.c 2011-11-23 16:28:49.000000000 +0100
@@ -132,7 +132,8 @@
#define ALI1535_SMBIO_EN 0x04 /* SMB I/O Space enable */
static struct pci_driver ali1535_driver;
-static unsigned short ali1535_smba;
+static unsigned long ali1535_smba;
+static unsigned short offset;
/* Detect whether a ALI1535 can be found, and initialize it, where necessary.
Note the differences between kernels with the old PCI BIOS interface and
@@ -149,23 +150,36 @@
- We can use the addresses
*/
+ retval = pci_enable_device(dev);
+ if (retval) {
+ dev_err(&dev->dev, "ALI1535_smb can't enable device\n");
+ goto exit;
+ }
+
/* Determine the address of the SMBus area */
- pci_read_config_word(dev, SMBBA, &ali1535_smba);
- ali1535_smba &= (0xffff & ~(ALI1535_SMB_IOSIZE - 1));
- if (ali1535_smba == 0) {
+ pci_read_config_word(dev, SMBBA, &offset);
+ dev_info(&dev->dev, "ALI1535_smb is at offset 0x%04x\n", offset);
+ offset &= (0xffff & ~(ALI1535_SMB_IOSIZE - 1));
+ if (offset == 0) {
dev_warn(&dev->dev,
"ALI1535_smb region uninitialized - upgrade BIOS?\n");
goto exit;
}
+ ali1535_smba = pci_resource_start(dev, 0) + offset;
retval = acpi_check_region(ali1535_smba, ALI1535_SMB_IOSIZE,
ali1535_driver.name);
if (retval)
goto exit;
+ if ((pci_resource_flags(dev, 0) & IORESOURCE_IO) == 0) {
+ dev_err(&dev->dev, "ALI1535_smb bar 0 is not IORESOURCE_IO\n");
+ goto exit;
+ }
+
if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE,
ali1535_driver.name)) {
- dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n",
+ dev_err(&dev->dev, "ALI1535_smb region 0x%lx already in use!\n",
ali1535_smba);
goto exit;
}
@@ -195,8 +209,8 @@
dev_dbg(&dev->dev, "ALI1535 using Interrupt 9 for SMBus.\n");
*/
pci_read_config_byte(dev, SMBREV, &temp);
- dev_dbg(&dev->dev, "SMBREV = 0x%X\n", temp);
- dev_dbg(&dev->dev, "ALI1535_smba = 0x%X\n", ali1535_smba);
+ dev_info(&dev->dev, "SMBREV = 0x%X\n", temp);
+ dev_info(&dev->dev, "ALI1535_smba = 0x%lx\n", ali1535_smba);
retval = 0;
exit:
@@ -499,7 +513,7 @@
ali1535_adapter.dev.parent = &dev->dev;
snprintf(ali1535_adapter.name, sizeof(ali1535_adapter.name),
- "SMBus ALI1535 adapter at %04x", ali1535_smba);
+ "SMBus ALI1535 adapter at %04x", offset);
return i2c_add_adapter(&ali1535_adapter);
}