return -ENODEV;
}
+ /* set up the driverfs linkage to our parent device */
+ ali15x3_adapter.dev.parent = &dev->dev;
+
sprintf(ali15x3_adapter.name, "SMBus ALI15X3 adapter at %04x",
ali15x3_smba);
- i2c_add_adapter(&ali15x3_adapter);
- return 0;
+ return i2c_add_adapter(&ali15x3_adapter);
}
static void __devexit ali15x3_remove(struct pci_dev *dev)
printk(KERN_DEBUG DRV_NAME ": AMD756_smba = 0x%X\n", amd756_ioport);
#endif
+ /* set up the driverfs linkage to our parent device */
+ amd756_adapter.dev.parent = &pdev->dev;
+
sprintf(amd756_adapter.name,
"SMBus AMD75x adapter at %04x", amd756_ioport);
smbus->adapter.algo = &smbus_algorithm;
smbus->adapter.algo_data = smbus;
+ /* set up the driverfs linkage to our parent device */
+ smbus->adapter.dev.parent = &dev->dev;
+
error = i2c_add_adapter(&smbus->adapter);
if (error)
goto out_release_region;
}
static struct pci_driver amd8111_driver = {
- .name = "amd8111 smbus 2.0",
+ .name = "amd8111 smbus",
.id_table = amd8111_ids,
.probe = amd8111_probe,
.remove = __devexit_p(amd8111_remove),
return -ENODEV;
}
+ /* set up the driverfs linkage to our parent device */
+ i801_adapter.dev.parent = &dev->dev;
+
sprintf(i801_adapter.name, "SMBus I801 adapter at %04x",
i801_smba);
- i2c_add_adapter(&i801_adapter);
+ return i2c_add_adapter(&i801_adapter);
}
static void __devexit i801_remove(struct pci_dev *dev)
if (retval)
return retval;
+ /* set up the driverfs linkage to our parent device */
+ piix4_adapter.dev.parent = &dev->dev;
+
sprintf(piix4_adapter.name, "SMBus PIIX4 adapter at %04x",
piix4_smba);
init_MUTEX(&adap->bus);
init_MUTEX(&adap->list);
+ /* Add the adapter to the driver core.
+ * If the parent pointer is not set up,
+ * we add this adapter to the legacy bus.
+ */
+ if (adap->dev.parent == NULL)
+ adap->dev.parent = &legacy_bus;
+ sprintf(adap->dev.bus_id, "i2c-%d", i);
+ strcpy(adap->dev.name, "i2c controller");
+ device_register(&adap->dev);
+
/* inform drivers of new adapters */
for (j=0;j<I2C_DRIVER_MAX;j++)
if (drivers[j]!=NULL &&
i2cproc_remove(i);
+ /* clean up the sysfs representation */
+ device_unregister(&adap->dev);
+
adapters[i] = NULL;
DEB(printk(KERN_DEBUG "i2c-core.o: adapter unregistered: %s\n",adap->name));
int timeout;
int retries;
+ struct device dev; /* the adapter device */
#ifdef CONFIG_PROC_FS
/* No need to set this when you initialize the adapter */
int inode;
#endif /* def CONFIG_PROC_FS */
};
+#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
/*flags for the driver struct: */
#define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */