aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/Kconfig1
-rw-r--r--drivers/i2c/busses/i2c-i801.c2
-rw-r--r--drivers/i2c/busses/i2c-ixp4xx.c2
-rw-r--r--drivers/i2c/i2c-dev.c26
4 files changed, 17 insertions, 14 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 510816c16da3..04bee524e31a 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -125,6 +125,7 @@ config I2C_I801
125 ICH7 125 ICH7
126 ESB2 126 ESB2
127 ICH8 127 ICH8
128 ICH9
128 129
129 This driver can also be built as a module. If so, the module 130 This driver can also be built as a module. If so, the module
130 will be called i2c-i801. 131 will be called i2c-i801.
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index bbb2fbee836f..c7be2fdbd86b 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -33,6 +33,7 @@
33 ICH7 27DA 33 ICH7 27DA
34 ESB2 269B 34 ESB2 269B
35 ICH8 283E 35 ICH8 283E
36 ICH9 2930
36 This driver supports several versions of Intel's I/O Controller Hubs (ICH). 37 This driver supports several versions of Intel's I/O Controller Hubs (ICH).
37 For SMBus support, they are similar to the PIIX4 and are part 38 For SMBus support, they are similar to the PIIX4 and are part
38 of Intel's '810' and other chipsets. 39 of Intel's '810' and other chipsets.
@@ -457,6 +458,7 @@ static struct pci_device_id i801_ids[] = {
457 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_17) }, 458 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_17) },
458 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_17) }, 459 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_17) },
459 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_5) }, 460 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_5) },
461 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_6) },
460 { 0, } 462 { 0, }
461}; 463};
462 464
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c
index 05fffb9415a2..68fe863f9d54 100644
--- a/drivers/i2c/busses/i2c-ixp4xx.c
+++ b/drivers/i2c/busses/i2c-ixp4xx.c
@@ -138,7 +138,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev)
138 gpio_line_set(gpio->sda_pin, 0); 138 gpio_line_set(gpio->sda_pin, 0);
139 139
140 err = i2c_bit_add_bus(&drv_data->adapter); 140 err = i2c_bit_add_bus(&drv_data->adapter);
141 if (err != 0) 141 if (err) {
142 printk(KERN_ERR "ERROR: Could not install %s\n", plat_dev->dev.bus_id); 142 printk(KERN_ERR "ERROR: Could not install %s\n", plat_dev->dev.bus_id);
143 143
144 kfree(drv_data); 144 kfree(drv_data);
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 3f869033ed70..94a4e9a3013c 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -42,7 +42,7 @@ static struct i2c_driver i2cdev_driver;
42struct i2c_dev { 42struct i2c_dev {
43 struct list_head list; 43 struct list_head list;
44 struct i2c_adapter *adap; 44 struct i2c_adapter *adap;
45 struct class_device *class_dev; 45 struct device *dev;
46}; 46};
47 47
48#define I2C_MINORS 256 48#define I2C_MINORS 256
@@ -92,15 +92,16 @@ static void return_i2c_dev(struct i2c_dev *i2c_dev)
92 spin_unlock(&i2c_dev_list_lock); 92 spin_unlock(&i2c_dev_list_lock);
93} 93}
94 94
95static ssize_t show_adapter_name(struct class_device *class_dev, char *buf) 95static ssize_t show_adapter_name(struct device *dev,
96 struct device_attribute *attr, char *buf)
96{ 97{
97 struct i2c_dev *i2c_dev = i2c_dev_get_by_minor(MINOR(class_dev->devt)); 98 struct i2c_dev *i2c_dev = i2c_dev_get_by_minor(MINOR(dev->devt));
98 99
99 if (!i2c_dev) 100 if (!i2c_dev)
100 return -ENODEV; 101 return -ENODEV;
101 return sprintf(buf, "%s\n", i2c_dev->adap->name); 102 return sprintf(buf, "%s\n", i2c_dev->adap->name);
102} 103}
103static CLASS_DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); 104static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL);
104 105
105static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count, 106static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count,
106 loff_t *offset) 107 loff_t *offset)
@@ -413,15 +414,14 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
413 return PTR_ERR(i2c_dev); 414 return PTR_ERR(i2c_dev);
414 415
415 /* register this i2c device with the driver core */ 416 /* register this i2c device with the driver core */
416 i2c_dev->class_dev = class_device_create(i2c_dev_class, NULL, 417 i2c_dev->dev = device_create(i2c_dev_class, &adap->dev,
417 MKDEV(I2C_MAJOR, adap->nr), 418 MKDEV(I2C_MAJOR, adap->nr),
418 &adap->dev, "i2c-%d", 419 "i2c-%d", adap->nr);
419 adap->nr); 420 if (!i2c_dev->dev) {
420 if (!i2c_dev->class_dev) {
421 res = -ENODEV; 421 res = -ENODEV;
422 goto error; 422 goto error;
423 } 423 }
424 res = class_device_create_file(i2c_dev->class_dev, &class_device_attr_name); 424 res = device_create_file(i2c_dev->dev, &dev_attr_name);
425 if (res) 425 if (res)
426 goto error_destroy; 426 goto error_destroy;
427 427
@@ -429,7 +429,7 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
429 adap->name, adap->nr); 429 adap->name, adap->nr);
430 return 0; 430 return 0;
431error_destroy: 431error_destroy:
432 class_device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); 432 device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
433error: 433error:
434 return_i2c_dev(i2c_dev); 434 return_i2c_dev(i2c_dev);
435 kfree(i2c_dev); 435 kfree(i2c_dev);
@@ -444,9 +444,9 @@ static int i2cdev_detach_adapter(struct i2c_adapter *adap)
444 if (!i2c_dev) /* attach_adapter must have failed */ 444 if (!i2c_dev) /* attach_adapter must have failed */
445 return 0; 445 return 0;
446 446
447 class_device_remove_file(i2c_dev->class_dev, &class_device_attr_name); 447 device_remove_file(i2c_dev->dev, &dev_attr_name);
448 return_i2c_dev(i2c_dev); 448 return_i2c_dev(i2c_dev);
449 class_device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); 449 device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
450 kfree(i2c_dev); 450 kfree(i2c_dev);
451 451
452 pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name); 452 pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name);