Merge branches 'release' and 'ppc-workaround' into release
[pandora-kernel.git] / drivers / i2c / busses / i2c-amd756.c
index 2d21afd..573abe4 100644 (file)
@@ -42,7 +42,6 @@
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/stddef.h>
-#include <linux/sched.h>
 #include <linux/ioport.h>
 #include <linux/i2c.h>
 #include <linux/init.h>
@@ -301,6 +300,7 @@ static const struct i2c_algorithm smbus_algorithm = {
 
 struct i2c_adapter amd756_smbus = {
        .owner          = THIS_MODULE,
+       .id             = I2C_HW_SMBUS_AMD756,
        .class          = I2C_CLASS_HWMON,
        .algo           = &smbus_algorithm,
 };
@@ -334,6 +334,10 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
        int error;
        u8 temp;
        
+       /* driver_data might come from user-space, so check it */
+       if (id->driver_data > ARRAY_SIZE(chipname))
+               return -EINVAL;
+
        if (amd756_ioport) {
                dev_err(&pdev->dev, "Only one device supported "
                       "(you have a strange motherboard, btw)\n");
@@ -374,7 +378,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
        dev_dbg(&pdev->dev, "SMBREV = 0x%X\n", temp);
        dev_dbg(&pdev->dev, "AMD756_smba = 0x%X\n", amd756_ioport);
 
-       /* set up the driverfs linkage to our parent device */
+       /* set up the sysfs linkage to our parent device */
        amd756_smbus.dev.parent = &pdev->dev;
 
        sprintf(amd756_smbus.name, "SMBus %s adapter at %04x",
@@ -405,6 +409,7 @@ static struct pci_driver amd756_driver = {
        .id_table       = amd756_ids,
        .probe          = amd756_probe,
        .remove         = __devexit_p(amd756_remove),
+       .dynids.use_driver_data = 1,
 };
 
 static int __init amd756_init(void)