aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-amd756.c2
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c28
-rw-r--r--drivers/i2c/chips/max6875.c3
-rw-r--r--drivers/i2c/i2c-core.c22
4 files changed, 30 insertions, 25 deletions
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index 2fa43183d375..43508d61eb7c 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -290,7 +290,7 @@ static u32 amd756_func(struct i2c_adapter *adapter)
290{ 290{
291 return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | 291 return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
292 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | 292 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
293 I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_PROC_CALL; 293 I2C_FUNC_SMBUS_BLOCK_DATA;
294} 294}
295 295
296static const struct i2c_algorithm smbus_algorithm = { 296static const struct i2c_algorithm smbus_algorithm = {
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 3dac920e53ea..43c9f8df9509 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -50,6 +50,7 @@
50#include <linux/init.h> 50#include <linux/init.h>
51#include <linux/i2c.h> 51#include <linux/i2c.h>
52#include <linux/delay.h> 52#include <linux/delay.h>
53#include <linux/dmi.h>
53#include <asm/io.h> 54#include <asm/io.h>
54 55
55MODULE_LICENSE("GPL"); 56MODULE_LICENSE("GPL");
@@ -109,6 +110,18 @@ struct nforce2_smbus {
109/* Misc definitions */ 110/* Misc definitions */
110#define MAX_TIMEOUT 100 111#define MAX_TIMEOUT 100
111 112
113/* We disable the second SMBus channel on these boards */
114static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = {
115 {
116 .ident = "DFI Lanparty NF4 Expert",
117 .matches = {
118 DMI_MATCH(DMI_BOARD_VENDOR, "DFI Corp,LTD"),
119 DMI_MATCH(DMI_BOARD_NAME, "LP UT NF4 Expert"),
120 },
121 },
122 { }
123};
124
112static struct pci_driver nforce2_driver; 125static struct pci_driver nforce2_driver;
113 126
114static void nforce2_abort(struct i2c_adapter *adap) 127static void nforce2_abort(struct i2c_adapter *adap)
@@ -367,10 +380,17 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_
367 smbuses[0].base = 0; /* to have a check value */ 380 smbuses[0].base = 0; /* to have a check value */
368 } 381 }
369 /* SMBus adapter 2 */ 382 /* SMBus adapter 2 */
370 res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], "SMB2"); 383 if (dmi_check_system(nforce2_dmi_blacklist2)) {
371 if (res2 < 0) { 384 dev_err(&dev->dev, "Disabling SMB2 for safety reasons.\n");
372 dev_err(&dev->dev, "Error probing SMB2.\n"); 385 res2 = -EPERM;
373 smbuses[1].base = 0; /* to have a check value */ 386 smbuses[1].base = 0;
387 } else {
388 res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1],
389 "SMB2");
390 if (res2 < 0) {
391 dev_err(&dev->dev, "Error probing SMB2.\n");
392 smbuses[1].base = 0; /* to have a check value */
393 }
374 } 394 }
375 if ((res1 < 0) && (res2 < 0)) { 395 if ((res1 < 0) && (res2 < 0)) {
376 /* we did not find even one of the SMBuses, so we give up */ 396 /* we did not find even one of the SMBuses, so we give up */
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c
index fb7ea5637eca..cf507b3f60f3 100644
--- a/drivers/i2c/chips/max6875.c
+++ b/drivers/i2c/chips/max6875.c
@@ -207,9 +207,6 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind)
207 fake_client->flags = 0; 207 fake_client->flags = 0;
208 strlcpy(fake_client->name, "max6875 subclient", I2C_NAME_SIZE); 208 strlcpy(fake_client->name, "max6875 subclient", I2C_NAME_SIZE);
209 209
210 /* Prevent 24RF08 corruption (in case of user error) */
211 i2c_smbus_write_quick(real_client, 0);
212
213 if ((err = i2c_attach_client(real_client)) != 0) 210 if ((err = i2c_attach_client(real_client)) != 0)
214 goto exit_kfree2; 211 goto exit_kfree2;
215 212
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index c99ebeadb558..d0175f4f8fc6 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -74,10 +74,7 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv)
74 if (driver->id_table) 74 if (driver->id_table)
75 return i2c_match_id(driver->id_table, client) != NULL; 75 return i2c_match_id(driver->id_table, client) != NULL;
76 76
77 /* new style drivers use the same kind of driver matching policy 77 return 0;
78 * as platform devices or SPI: compare device and driver IDs.
79 */
80 return strcmp(client->driver_name, drv->name) == 0;
81} 78}
82 79
83#ifdef CONFIG_HOTPLUG 80#ifdef CONFIG_HOTPLUG
@@ -91,14 +88,9 @@ static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env)
91 if (dev->driver) 88 if (dev->driver)
92 return 0; 89 return 0;
93 90
94 if (client->driver_name[0]) { 91 if (add_uevent_var(env, "MODALIAS=%s%s",
95 if (add_uevent_var(env, "MODALIAS=%s", client->driver_name)) 92 I2C_MODULE_PREFIX, client->name))
96 return -ENOMEM; 93 return -ENOMEM;
97 } else {
98 if (add_uevent_var(env, "MODALIAS=%s%s",
99 I2C_MODULE_PREFIX, client->name))
100 return -ENOMEM;
101 }
102 dev_dbg(dev, "uevent\n"); 94 dev_dbg(dev, "uevent\n");
103 return 0; 95 return 0;
104} 96}
@@ -206,9 +198,7 @@ static ssize_t show_client_name(struct device *dev, struct device_attribute *att
206static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) 198static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
207{ 199{
208 struct i2c_client *client = to_i2c_client(dev); 200 struct i2c_client *client = to_i2c_client(dev);
209 return client->driver_name[0] 201 return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
210 ? sprintf(buf, "%s\n", client->driver_name)
211 : sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
212} 202}
213 203
214static struct device_attribute i2c_dev_attrs[] = { 204static struct device_attribute i2c_dev_attrs[] = {
@@ -282,8 +272,6 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
282 client->addr = info->addr; 272 client->addr = info->addr;
283 client->irq = info->irq; 273 client->irq = info->irq;
284 274
285 strlcpy(client->driver_name, info->driver_name,
286 sizeof(client->driver_name));
287 strlcpy(client->name, info->type, sizeof(client->name)); 275 strlcpy(client->name, info->type, sizeof(client->name));
288 276
289 /* a new style driver may be bound to this device when we 277 /* a new style driver may be bound to this device when we