Commit e1700574 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

i2c: get i2c-ali15x3 driver to actually bind to a PCI device.

parent d25e3ba0
...@@ -135,32 +135,11 @@ static int ali15x3_transaction(void); ...@@ -135,32 +135,11 @@ static int ali15x3_transaction(void);
static unsigned short ali15x3_smba = 0; static unsigned short ali15x3_smba = 0;
/* Detect whether a ALI15X3 can be found, and initialize it, where necessary. int ali15x3_setup(struct pci_dev *ALI15X3_dev)
Note the differences between kernels with the old PCI BIOS interface and
newer kernels with the real PCI interface. In compat.h some things are
defined to make the transition easier. */
int ali15x3_setup(void)
{ {
u16 a; u16 a;
unsigned char temp; unsigned char temp;
struct pci_dev *ALI15X3_dev;
/* First check whether we can access PCI at all */
if (pci_present() == 0) {
printk("i2c-ali15x3.o: Error: No PCI-bus found!\n");
return -ENODEV;
}
/* Look for the ALI15X3, M7101 device */
ALI15X3_dev = NULL;
ALI15X3_dev = pci_find_device(PCI_VENDOR_ID_AL,
PCI_DEVICE_ID_AL_M7101, ALI15X3_dev);
if (ALI15X3_dev == NULL) {
printk("i2c-ali15x3.o: Error: Can't detect ali15x3!\n");
return -ENODEV;
}
/* Check the following things: /* Check the following things:
- SMB I/O address is initialized - SMB I/O address is initialized
- Device is enabled - Device is enabled
...@@ -534,12 +513,18 @@ static struct i2c_adapter ali15x3_adapter = { ...@@ -534,12 +513,18 @@ static struct i2c_adapter ali15x3_adapter = {
static struct pci_device_id ali15x3_ids[] __devinitdata = { static struct pci_device_id ali15x3_ids[] __devinitdata = {
{
.vendor = PCI_VENDOR_ID_AL,
.device = PCI_DEVICE_ID_AL_M7101,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},
{ 0, } { 0, }
}; };
static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id)
{ {
if (ali15x3_setup()) { if (ali15x3_setup(dev)) {
printk printk
("i2c-ali15x3.o: ALI15X3 not detected, module not inserted.\n"); ("i2c-ali15x3.o: ALI15X3 not detected, module not inserted.\n");
...@@ -549,6 +534,7 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_ ...@@ -549,6 +534,7 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_
sprintf(ali15x3_adapter.name, "SMBus ALI15X3 adapter at %04x", sprintf(ali15x3_adapter.name, "SMBus ALI15X3 adapter at %04x",
ali15x3_smba); ali15x3_smba);
i2c_add_adapter(&ali15x3_adapter); i2c_add_adapter(&ali15x3_adapter);
return 0;
} }
static void __devexit ali15x3_remove(struct pci_dev *dev) static void __devexit ali15x3_remove(struct pci_dev *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment