diff options
41 files changed, 216 insertions, 166 deletions
diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801 index e1bb5b261693..e307914a3eda 100644 --- a/Documentation/i2c/busses/i2c-i801 +++ b/Documentation/i2c/busses/i2c-i801 | |||
@@ -27,7 +27,13 @@ Authors: | |||
27 | Module Parameters | 27 | Module Parameters |
28 | ----------------- | 28 | ----------------- |
29 | 29 | ||
30 | None. | 30 | * disable_features (bit vector) |
31 | Disable selected features normally supported by the device. This makes it | ||
32 | possible to work around possible driver or hardware bugs if the feature in | ||
33 | question doesn't work as intended for whatever reason. Bit values: | ||
34 | 1 disable SMBus PEC | ||
35 | 2 disable the block buffer | ||
36 | 8 disable the I2C block read functionality | ||
31 | 37 | ||
32 | 38 | ||
33 | Description | 39 | Description |
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c index dcdaf8e675bf..2b9a8f54bb2c 100644 --- a/drivers/i2c/algos/i2c-algo-pca.c +++ b/drivers/i2c/algos/i2c-algo-pca.c | |||
@@ -109,13 +109,13 @@ static void pca_stop(struct i2c_algo_pca_data *adap) | |||
109 | * returns after the address has been sent | 109 | * returns after the address has been sent |
110 | */ | 110 | */ |
111 | static int pca_address(struct i2c_algo_pca_data *adap, | 111 | static int pca_address(struct i2c_algo_pca_data *adap, |
112 | struct i2c_msg *msg) | 112 | struct i2c_msg *msg) |
113 | { | 113 | { |
114 | int sta = pca_get_con(adap); | 114 | int sta = pca_get_con(adap); |
115 | int addr; | 115 | int addr; |
116 | 116 | ||
117 | addr = ( (0x7f & msg->addr) << 1 ); | 117 | addr = ((0x7f & msg->addr) << 1); |
118 | if (msg->flags & I2C_M_RD ) | 118 | if (msg->flags & I2C_M_RD) |
119 | addr |= 1; | 119 | addr |= 1; |
120 | DEB2("=== SLAVE ADDRESS %#04x+%c=%#04x\n", | 120 | DEB2("=== SLAVE ADDRESS %#04x+%c=%#04x\n", |
121 | msg->addr, msg->flags & I2C_M_RD ? 'R' : 'W', addr); | 121 | msg->addr, msg->flags & I2C_M_RD ? 'R' : 'W', addr); |
@@ -134,7 +134,7 @@ static int pca_address(struct i2c_algo_pca_data *adap, | |||
134 | * Returns after the byte has been transmitted | 134 | * Returns after the byte has been transmitted |
135 | */ | 135 | */ |
136 | static int pca_tx_byte(struct i2c_algo_pca_data *adap, | 136 | static int pca_tx_byte(struct i2c_algo_pca_data *adap, |
137 | __u8 b) | 137 | __u8 b) |
138 | { | 138 | { |
139 | int sta = pca_get_con(adap); | 139 | int sta = pca_get_con(adap); |
140 | DEB2("=== WRITE %#04x\n", b); | 140 | DEB2("=== WRITE %#04x\n", b); |
@@ -164,13 +164,13 @@ static void pca_rx_byte(struct i2c_algo_pca_data *adap, | |||
164 | * Returns after next byte has arrived. | 164 | * Returns after next byte has arrived. |
165 | */ | 165 | */ |
166 | static int pca_rx_ack(struct i2c_algo_pca_data *adap, | 166 | static int pca_rx_ack(struct i2c_algo_pca_data *adap, |
167 | int ack) | 167 | int ack) |
168 | { | 168 | { |
169 | int sta = pca_get_con(adap); | 169 | int sta = pca_get_con(adap); |
170 | 170 | ||
171 | sta &= ~(I2C_PCA_CON_STO|I2C_PCA_CON_STA|I2C_PCA_CON_SI|I2C_PCA_CON_AA); | 171 | sta &= ~(I2C_PCA_CON_STO|I2C_PCA_CON_STA|I2C_PCA_CON_SI|I2C_PCA_CON_AA); |
172 | 172 | ||
173 | if ( ack ) | 173 | if (ack) |
174 | sta |= I2C_PCA_CON_AA; | 174 | sta |= I2C_PCA_CON_AA; |
175 | 175 | ||
176 | pca_set_con(adap, sta); | 176 | pca_set_con(adap, sta); |
@@ -178,12 +178,12 @@ static int pca_rx_ack(struct i2c_algo_pca_data *adap, | |||
178 | } | 178 | } |
179 | 179 | ||
180 | static int pca_xfer(struct i2c_adapter *i2c_adap, | 180 | static int pca_xfer(struct i2c_adapter *i2c_adap, |
181 | struct i2c_msg *msgs, | 181 | struct i2c_msg *msgs, |
182 | int num) | 182 | int num) |
183 | { | 183 | { |
184 | struct i2c_algo_pca_data *adap = i2c_adap->algo_data; | 184 | struct i2c_algo_pca_data *adap = i2c_adap->algo_data; |
185 | struct i2c_msg *msg = NULL; | 185 | struct i2c_msg *msg = NULL; |
186 | int curmsg; | 186 | int curmsg; |
187 | int numbytes = 0; | 187 | int numbytes = 0; |
188 | int state; | 188 | int state; |
189 | int ret; | 189 | int ret; |
@@ -202,21 +202,21 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
202 | 202 | ||
203 | DEB1("{{{ XFER %d messages\n", num); | 203 | DEB1("{{{ XFER %d messages\n", num); |
204 | 204 | ||
205 | if (i2c_debug>=2) { | 205 | if (i2c_debug >= 2) { |
206 | for (curmsg = 0; curmsg < num; curmsg++) { | 206 | for (curmsg = 0; curmsg < num; curmsg++) { |
207 | int addr, i; | 207 | int addr, i; |
208 | msg = &msgs[curmsg]; | 208 | msg = &msgs[curmsg]; |
209 | 209 | ||
210 | addr = (0x7f & msg->addr) ; | 210 | addr = (0x7f & msg->addr) ; |
211 | 211 | ||
212 | if (msg->flags & I2C_M_RD ) | 212 | if (msg->flags & I2C_M_RD) |
213 | printk(KERN_INFO " [%02d] RD %d bytes from %#02x [%#02x, ...]\n", | 213 | printk(KERN_INFO " [%02d] RD %d bytes from %#02x [%#02x, ...]\n", |
214 | curmsg, msg->len, addr, (addr<<1) | 1); | 214 | curmsg, msg->len, addr, (addr << 1) | 1); |
215 | else { | 215 | else { |
216 | printk(KERN_INFO " [%02d] WR %d bytes to %#02x [%#02x%s", | 216 | printk(KERN_INFO " [%02d] WR %d bytes to %#02x [%#02x%s", |
217 | curmsg, msg->len, addr, addr<<1, | 217 | curmsg, msg->len, addr, addr << 1, |
218 | msg->len == 0 ? "" : ", "); | 218 | msg->len == 0 ? "" : ", "); |
219 | for(i=0; i < msg->len; i++) | 219 | for (i = 0; i < msg->len; i++) |
220 | printk("%#04x%s", msg->buf[i], i == msg->len - 1 ? "" : ", "); | 220 | printk("%#04x%s", msg->buf[i], i == msg->len - 1 ? "" : ", "); |
221 | printk("]\n"); | 221 | printk("]\n"); |
222 | } | 222 | } |
@@ -305,7 +305,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
305 | goto out; | 305 | goto out; |
306 | 306 | ||
307 | case 0x58: /* Data byte has been received; NOT ACK has been returned */ | 307 | case 0x58: /* Data byte has been received; NOT ACK has been returned */ |
308 | if ( numbytes == msg->len - 1 ) { | 308 | if (numbytes == msg->len - 1) { |
309 | pca_rx_byte(adap, &msg->buf[numbytes], 0); | 309 | pca_rx_byte(adap, &msg->buf[numbytes], 0); |
310 | curmsg++; numbytes = 0; | 310 | curmsg++; numbytes = 0; |
311 | if (curmsg == num) | 311 | if (curmsg == num) |
@@ -352,7 +352,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
352 | 352 | ||
353 | static u32 pca_func(struct i2c_adapter *adap) | 353 | static u32 pca_func(struct i2c_adapter *adap) |
354 | { | 354 | { |
355 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | 355 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; |
356 | } | 356 | } |
357 | 357 | ||
358 | static const struct i2c_algorithm pca_algo = { | 358 | static const struct i2c_algorithm pca_algo = { |
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index bd8f1e4d9e6c..906a3ca50db6 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c | |||
@@ -60,7 +60,7 @@ | |||
60 | #include <linux/i2c.h> | 60 | #include <linux/i2c.h> |
61 | #include <linux/init.h> | 61 | #include <linux/init.h> |
62 | #include <linux/acpi.h> | 62 | #include <linux/acpi.h> |
63 | #include <asm/io.h> | 63 | #include <linux/io.h> |
64 | 64 | ||
65 | 65 | ||
66 | /* ALI1535 SMBus address offsets */ | 66 | /* ALI1535 SMBus address offsets */ |
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index 659f63f5e4af..b14f6d68221d 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c | |||
@@ -67,7 +67,7 @@ | |||
67 | #include <linux/i2c.h> | 67 | #include <linux/i2c.h> |
68 | #include <linux/init.h> | 68 | #include <linux/init.h> |
69 | #include <linux/acpi.h> | 69 | #include <linux/acpi.h> |
70 | #include <asm/io.h> | 70 | #include <linux/io.h> |
71 | 71 | ||
72 | /* ALI15X3 SMBus address offsets */ | 72 | /* ALI15X3 SMBus address offsets */ |
73 | #define SMBHSTSTS (0 + ali15x3_smba) | 73 | #define SMBHSTSTS (0 + ali15x3_smba) |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index c5a9fa488e7f..03bcd07c4697 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #include <linux/i2c.h> | 43 | #include <linux/i2c.h> |
44 | #include <linux/init.h> | 44 | #include <linux/init.h> |
45 | #include <linux/acpi.h> | 45 | #include <linux/acpi.h> |
46 | #include <asm/io.h> | 46 | #include <linux/io.h> |
47 | 47 | ||
48 | /* AMD756 SMBus address offsets */ | 48 | /* AMD756 SMBus address offsets */ |
49 | #define SMB_ADDR_OFFSET 0xE0 | 49 | #define SMB_ADDR_OFFSET 0xE0 |
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c index 2fbef27b6cd6..af1e5e254b7b 100644 --- a/drivers/i2c/busses/i2c-amd8111.c +++ b/drivers/i2c/busses/i2c-amd8111.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/acpi.h> | 19 | #include <linux/acpi.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <asm/io.h> | 21 | #include <linux/io.h> |
22 | 22 | ||
23 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
24 | MODULE_AUTHOR ("Vojtech Pavlik <vojtech@suse.cz>"); | 24 | MODULE_AUTHOR ("Vojtech Pavlik <vojtech@suse.cz>"); |
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 06e1ecb4919f..305c07504f7e 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c | |||
@@ -23,8 +23,7 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | 26 | #include <linux/io.h> | |
27 | #include <asm/io.h> | ||
28 | 27 | ||
29 | #include <mach/at91_twi.h> | 28 | #include <mach/at91_twi.h> |
30 | #include <mach/board.h> | 29 | #include <mach/board.h> |
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c index 612255614a66..e5b1a3bf5b80 100644 --- a/drivers/i2c/busses/i2c-elektor.c +++ b/drivers/i2c/busses/i2c-elektor.c | |||
@@ -37,8 +37,8 @@ | |||
37 | #include <linux/isa.h> | 37 | #include <linux/isa.h> |
38 | #include <linux/i2c.h> | 38 | #include <linux/i2c.h> |
39 | #include <linux/i2c-algo-pcf.h> | 39 | #include <linux/i2c-algo-pcf.h> |
40 | #include <linux/io.h> | ||
40 | 41 | ||
41 | #include <asm/io.h> | ||
42 | #include <asm/irq.h> | 42 | #include <asm/irq.h> |
43 | 43 | ||
44 | #include "../algos/i2c-algo-pcf.h" | 44 | #include "../algos/i2c-algo-pcf.h" |
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index c21077d248af..d9aa9a649e35 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c | |||
@@ -211,7 +211,7 @@ static int __init i2c_gpio_init(void) | |||
211 | 211 | ||
212 | return ret; | 212 | return ret; |
213 | } | 213 | } |
214 | module_init(i2c_gpio_init); | 214 | subsys_initcall(i2c_gpio_init); |
215 | 215 | ||
216 | static void __exit i2c_gpio_exit(void) | 216 | static void __exit i2c_gpio_exit(void) |
217 | { | 217 | { |
diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c index c767295ad1fb..9ff1695d8458 100644 --- a/drivers/i2c/busses/i2c-hydra.c +++ b/drivers/i2c/busses/i2c-hydra.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
29 | #include <linux/i2c-algo-bit.h> | 29 | #include <linux/i2c-algo-bit.h> |
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <asm/io.h> | 31 | #include <linux/io.h> |
32 | #include <asm/hydra.h> | 32 | #include <asm/hydra.h> |
33 | 33 | ||
34 | 34 | ||
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 299b918455a3..f4b21f2bb8ed 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -138,6 +138,17 @@ static struct pci_dev *I801_dev; | |||
138 | #define FEATURE_I2C_BLOCK_READ (1 << 3) | 138 | #define FEATURE_I2C_BLOCK_READ (1 << 3) |
139 | static unsigned int i801_features; | 139 | static unsigned int i801_features; |
140 | 140 | ||
141 | static const char *i801_feature_names[] = { | ||
142 | "SMBus PEC", | ||
143 | "Block buffer", | ||
144 | "Block process call", | ||
145 | "I2C block read", | ||
146 | }; | ||
147 | |||
148 | static unsigned int disable_features; | ||
149 | module_param(disable_features, uint, S_IRUGO | S_IWUSR); | ||
150 | MODULE_PARM_DESC(disable_features, "Disable selected driver features"); | ||
151 | |||
141 | /* Make sure the SMBus host is ready to start transmitting. | 152 | /* Make sure the SMBus host is ready to start transmitting. |
142 | Return 0 if it is, -EBUSY if it is not. */ | 153 | Return 0 if it is, -EBUSY if it is not. */ |
143 | static int i801_check_pre(void) | 154 | static int i801_check_pre(void) |
@@ -341,9 +352,8 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data, | |||
341 | do { | 352 | do { |
342 | msleep(1); | 353 | msleep(1); |
343 | status = inb_p(SMBHSTSTS); | 354 | status = inb_p(SMBHSTSTS); |
344 | } | 355 | } while ((!(status & SMBHSTSTS_BYTE_DONE)) |
345 | while ((!(status & SMBHSTSTS_BYTE_DONE)) | 356 | && (timeout++ < MAX_TIMEOUT)); |
346 | && (timeout++ < MAX_TIMEOUT)); | ||
347 | 357 | ||
348 | result = i801_check_post(status, timeout > MAX_TIMEOUT); | 358 | result = i801_check_post(status, timeout > MAX_TIMEOUT); |
349 | if (result < 0) | 359 | if (result < 0) |
@@ -440,9 +450,9 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write, | |||
440 | } | 450 | } |
441 | 451 | ||
442 | /* Return negative errno on error. */ | 452 | /* Return negative errno on error. */ |
443 | static s32 i801_access(struct i2c_adapter * adap, u16 addr, | 453 | static s32 i801_access(struct i2c_adapter *adap, u16 addr, |
444 | unsigned short flags, char read_write, u8 command, | 454 | unsigned short flags, char read_write, u8 command, |
445 | int size, union i2c_smbus_data * data) | 455 | int size, union i2c_smbus_data *data) |
446 | { | 456 | { |
447 | int hwpec; | 457 | int hwpec; |
448 | int block = 0; | 458 | int block = 0; |
@@ -511,7 +521,7 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
511 | else | 521 | else |
512 | outb_p(inb_p(SMBAUXCTL) & (~SMBAUXCTL_CRC), SMBAUXCTL); | 522 | outb_p(inb_p(SMBAUXCTL) & (~SMBAUXCTL_CRC), SMBAUXCTL); |
513 | 523 | ||
514 | if(block) | 524 | if (block) |
515 | ret = i801_block_transaction(data, read_write, size, hwpec); | 525 | ret = i801_block_transaction(data, read_write, size, hwpec); |
516 | else | 526 | else |
517 | ret = i801_transaction(xact | ENABLE_INT9); | 527 | ret = i801_transaction(xact | ENABLE_INT9); |
@@ -523,9 +533,9 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, | |||
523 | outb_p(inb_p(SMBAUXCTL) & ~(SMBAUXCTL_CRC | SMBAUXCTL_E32B), | 533 | outb_p(inb_p(SMBAUXCTL) & ~(SMBAUXCTL_CRC | SMBAUXCTL_E32B), |
524 | SMBAUXCTL); | 534 | SMBAUXCTL); |
525 | 535 | ||
526 | if(block) | 536 | if (block) |
527 | return ret; | 537 | return ret; |
528 | if(ret) | 538 | if (ret) |
529 | return ret; | 539 | return ret; |
530 | if ((read_write == I2C_SMBUS_WRITE) || (xact == I801_QUICK)) | 540 | if ((read_write == I2C_SMBUS_WRITE) || (xact == I801_QUICK)) |
531 | return 0; | 541 | return 0; |
@@ -585,7 +595,7 @@ static const struct pci_device_id i801_ids[] = { | |||
585 | { 0, } | 595 | { 0, } |
586 | }; | 596 | }; |
587 | 597 | ||
588 | MODULE_DEVICE_TABLE (pci, i801_ids); | 598 | MODULE_DEVICE_TABLE(pci, i801_ids); |
589 | 599 | ||
590 | #if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE | 600 | #if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE |
591 | static unsigned char apanel_addr; | 601 | static unsigned char apanel_addr; |
@@ -689,10 +699,11 @@ static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm, | |||
689 | } | 699 | } |
690 | #endif | 700 | #endif |
691 | 701 | ||
692 | static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id) | 702 | static int __devinit i801_probe(struct pci_dev *dev, |
703 | const struct pci_device_id *id) | ||
693 | { | 704 | { |
694 | unsigned char temp; | 705 | unsigned char temp; |
695 | int err; | 706 | int err, i; |
696 | #if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE | 707 | #if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE |
697 | const char *vendor; | 708 | const char *vendor; |
698 | #endif | 709 | #endif |
@@ -700,26 +711,28 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id | |||
700 | I801_dev = dev; | 711 | I801_dev = dev; |
701 | i801_features = 0; | 712 | i801_features = 0; |
702 | switch (dev->device) { | 713 | switch (dev->device) { |
703 | case PCI_DEVICE_ID_INTEL_82801EB_3: | 714 | default: |
704 | case PCI_DEVICE_ID_INTEL_ESB_4: | ||
705 | case PCI_DEVICE_ID_INTEL_ICH6_16: | ||
706 | case PCI_DEVICE_ID_INTEL_ICH7_17: | ||
707 | case PCI_DEVICE_ID_INTEL_ESB2_17: | ||
708 | case PCI_DEVICE_ID_INTEL_ICH8_5: | ||
709 | case PCI_DEVICE_ID_INTEL_ICH9_6: | ||
710 | case PCI_DEVICE_ID_INTEL_TOLAPAI_1: | ||
711 | case PCI_DEVICE_ID_INTEL_ICH10_4: | ||
712 | case PCI_DEVICE_ID_INTEL_ICH10_5: | ||
713 | case PCI_DEVICE_ID_INTEL_PCH_SMBUS: | ||
714 | case PCI_DEVICE_ID_INTEL_CPT_SMBUS: | ||
715 | i801_features |= FEATURE_I2C_BLOCK_READ; | 715 | i801_features |= FEATURE_I2C_BLOCK_READ; |
716 | /* fall through */ | 716 | /* fall through */ |
717 | case PCI_DEVICE_ID_INTEL_82801DB_3: | 717 | case PCI_DEVICE_ID_INTEL_82801DB_3: |
718 | i801_features |= FEATURE_SMBUS_PEC; | 718 | i801_features |= FEATURE_SMBUS_PEC; |
719 | i801_features |= FEATURE_BLOCK_BUFFER; | 719 | i801_features |= FEATURE_BLOCK_BUFFER; |
720 | /* fall through */ | ||
721 | case PCI_DEVICE_ID_INTEL_82801CA_3: | ||
722 | case PCI_DEVICE_ID_INTEL_82801BA_2: | ||
723 | case PCI_DEVICE_ID_INTEL_82801AB_3: | ||
724 | case PCI_DEVICE_ID_INTEL_82801AA_3: | ||
720 | break; | 725 | break; |
721 | } | 726 | } |
722 | 727 | ||
728 | /* Disable features on user request */ | ||
729 | for (i = 0; i < ARRAY_SIZE(i801_feature_names); i++) { | ||
730 | if (i801_features & disable_features & (1 << i)) | ||
731 | dev_notice(&dev->dev, "%s disabled by user\n", | ||
732 | i801_feature_names[i]); | ||
733 | } | ||
734 | i801_features &= ~disable_features; | ||
735 | |||
723 | err = pci_enable_device(dev); | 736 | err = pci_enable_device(dev); |
724 | if (err) { | 737 | if (err) { |
725 | dev_err(&dev->dev, "Failed to enable SMBus PCI device (%d)\n", | 738 | dev_err(&dev->dev, "Failed to enable SMBus PCI device (%d)\n", |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 2bef534cbff1..f8ccc0fe95a8 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
40 | #include <linux/interrupt.h> | 40 | #include <linux/interrupt.h> |
41 | #include <asm/irq.h> | 41 | #include <asm/irq.h> |
42 | #include <asm/io.h> | 42 | #include <linux/io.h> |
43 | #include <linux/i2c.h> | 43 | #include <linux/i2c.h> |
44 | #include <linux/i2c-id.h> | 44 | #include <linux/i2c-id.h> |
45 | #include <linux/of_platform.h> | 45 | #include <linux/of_platform.h> |
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c index 5901707fc66a..112c61f7b8cd 100644 --- a/drivers/i2c/busses/i2c-iop3xx.c +++ b/drivers/i2c/busses/i2c-iop3xx.c | |||
@@ -38,8 +38,7 @@ | |||
38 | #include <linux/errno.h> | 38 | #include <linux/errno.h> |
39 | #include <linux/platform_device.h> | 39 | #include <linux/platform_device.h> |
40 | #include <linux/i2c.h> | 40 | #include <linux/i2c.h> |
41 | 41 | #include <linux/io.h> | |
42 | #include <asm/io.h> | ||
43 | 42 | ||
44 | #include "i2c-iop3xx.h" | 43 | #include "i2c-iop3xx.h" |
45 | 44 | ||
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 3623a4499084..16242063144f 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -17,8 +17,7 @@ | |||
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/mv643xx_i2c.h> | 18 | #include <linux/mv643xx_i2c.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | 20 | #include <linux/io.h> | |
21 | #include <asm/io.h> | ||
22 | 21 | ||
23 | /* Register defines */ | 22 | /* Register defines */ |
24 | #define MV64XXX_I2C_REG_SLAVE_ADDR 0x00 | 23 | #define MV64XXX_I2C_REG_SLAVE_ADDR 0x00 |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index 4a48dd4ef787..a605a5029cfe 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -57,7 +57,7 @@ | |||
57 | #include <linux/dmi.h> | 57 | #include <linux/dmi.h> |
58 | #include <linux/acpi.h> | 58 | #include <linux/acpi.h> |
59 | #include <linux/slab.h> | 59 | #include <linux/slab.h> |
60 | #include <asm/io.h> | 60 | #include <linux/io.h> |
61 | 61 | ||
62 | MODULE_LICENSE("GPL"); | 62 | MODULE_LICENSE("GPL"); |
63 | MODULE_AUTHOR ("Hans-Frieder Vogt <hfvogt@gmx.net>"); | 63 | MODULE_AUTHOR ("Hans-Frieder Vogt <hfvogt@gmx.net>"); |
@@ -404,10 +404,9 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_ | |||
404 | 404 | ||
405 | /* SMBus adapter 1 */ | 405 | /* SMBus adapter 1 */ |
406 | res1 = nforce2_probe_smb(dev, 4, NFORCE_PCI_SMB1, &smbuses[0], "SMB1"); | 406 | res1 = nforce2_probe_smb(dev, 4, NFORCE_PCI_SMB1, &smbuses[0], "SMB1"); |
407 | if (res1 < 0) { | 407 | if (res1 < 0) |
408 | dev_err(&dev->dev, "Error probing SMB1.\n"); | ||
409 | smbuses[0].base = 0; /* to have a check value */ | 408 | smbuses[0].base = 0; /* to have a check value */ |
410 | } | 409 | |
411 | /* SMBus adapter 2 */ | 410 | /* SMBus adapter 2 */ |
412 | if (dmi_check_system(nforce2_dmi_blacklist2)) { | 411 | if (dmi_check_system(nforce2_dmi_blacklist2)) { |
413 | dev_err(&dev->dev, "Disabling SMB2 for safety reasons.\n"); | 412 | dev_err(&dev->dev, "Disabling SMB2 for safety reasons.\n"); |
@@ -416,11 +415,10 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_ | |||
416 | } else { | 415 | } else { |
417 | res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], | 416 | res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], |
418 | "SMB2"); | 417 | "SMB2"); |
419 | if (res2 < 0) { | 418 | if (res2 < 0) |
420 | dev_err(&dev->dev, "Error probing SMB2.\n"); | ||
421 | smbuses[1].base = 0; /* to have a check value */ | 419 | smbuses[1].base = 0; /* to have a check value */ |
422 | } | ||
423 | } | 420 | } |
421 | |||
424 | if ((res1 < 0) && (res2 < 0)) { | 422 | if ((res1 < 0) && (res2 < 0)) { |
425 | /* we did not find even one of the SMBuses, so we give up */ | 423 | /* we did not find even one of the SMBuses, so we give up */ |
426 | kfree(smbuses); | 424 | kfree(smbuses); |
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index b4ed4ca802ed..0070371b29f3 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/wait.h> | 19 | #include <linux/wait.h> |
20 | #include <linux/i2c-ocores.h> | 20 | #include <linux/i2c-ocores.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <asm/io.h> | 22 | #include <linux/io.h> |
23 | 23 | ||
24 | struct ocores_i2c { | 24 | struct ocores_i2c { |
25 | void __iomem *base; | 25 | void __iomem *base; |
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c index 5f41ec0f72d2..fc5fbd1012c9 100644 --- a/drivers/i2c/busses/i2c-parport-light.c +++ b/drivers/i2c/busses/i2c-parport-light.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
34 | #include <linux/i2c-algo-bit.h> | 34 | #include <linux/i2c-algo-bit.h> |
35 | #include <linux/i2c-smbus.h> | 35 | #include <linux/i2c-smbus.h> |
36 | #include <asm/io.h> | 36 | #include <linux/io.h> |
37 | #include "i2c-parport.h" | 37 | #include "i2c-parport.h" |
38 | 38 | ||
39 | #define DEFAULT_BASE 0x378 | 39 | #define DEFAULT_BASE 0x378 |
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index 846583ed4763..0eb1515541e7 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c | |||
@@ -137,7 +137,7 @@ static int parport_getsda(void *data) | |||
137 | copied. The attaching code will set getscl to NULL for adapters that | 137 | copied. The attaching code will set getscl to NULL for adapters that |
138 | cannot read SCL back, and will also make the data field point to | 138 | cannot read SCL back, and will also make the data field point to |
139 | the parallel port structure. */ | 139 | the parallel port structure. */ |
140 | static struct i2c_algo_bit_data parport_algo_data = { | 140 | static const struct i2c_algo_bit_data parport_algo_data = { |
141 | .setsda = parport_setsda, | 141 | .setsda = parport_setsda, |
142 | .setscl = parport_setscl, | 142 | .setscl = parport_setscl, |
143 | .getsda = parport_getsda, | 143 | .getsda = parport_getsda, |
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c index d3d4a4b43a1d..4174101660c9 100644 --- a/drivers/i2c/busses/i2c-pasemi.c +++ b/drivers/i2c/busses/i2c-pasemi.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <asm/io.h> | 28 | #include <linux/io.h> |
29 | 29 | ||
30 | static struct pci_driver pasemi_smb_driver; | 30 | static struct pci_driver pasemi_smb_driver; |
31 | 31 | ||
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c index f7346a9bd95f..bbd77603a417 100644 --- a/drivers/i2c/busses/i2c-pca-isa.c +++ b/drivers/i2c/busses/i2c-pca-isa.c | |||
@@ -30,8 +30,8 @@ | |||
30 | #include <linux/isa.h> | 30 | #include <linux/isa.h> |
31 | #include <linux/i2c.h> | 31 | #include <linux/i2c.h> |
32 | #include <linux/i2c-algo-pca.h> | 32 | #include <linux/i2c-algo-pca.h> |
33 | #include <linux/io.h> | ||
33 | 34 | ||
34 | #include <asm/io.h> | ||
35 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
36 | 36 | ||
37 | #define DRIVER "i2c-pca-isa" | 37 | #define DRIVER "i2c-pca-isa" |
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c index 5b2213df5ed0..ef5c78487eb7 100644 --- a/drivers/i2c/busses/i2c-pca-platform.c +++ b/drivers/i2c/busses/i2c-pca-platform.c | |||
@@ -23,9 +23,9 @@ | |||
23 | #include <linux/i2c-algo-pca.h> | 23 | #include <linux/i2c-algo-pca.h> |
24 | #include <linux/i2c-pca-platform.h> | 24 | #include <linux/i2c-pca-platform.h> |
25 | #include <linux/gpio.h> | 25 | #include <linux/gpio.h> |
26 | #include <linux/io.h> | ||
26 | 27 | ||
27 | #include <asm/irq.h> | 28 | #include <asm/irq.h> |
28 | #include <asm/io.h> | ||
29 | 29 | ||
30 | struct i2c_pca_pf_data { | 30 | struct i2c_pca_pf_data { |
31 | void __iomem *reg_base; | 31 | void __iomem *reg_base; |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index ee9da6fcf69a..6d14ac2e3c41 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
40 | #include <linux/dmi.h> | 40 | #include <linux/dmi.h> |
41 | #include <linux/acpi.h> | 41 | #include <linux/acpi.h> |
42 | #include <asm/io.h> | 42 | #include <linux/io.h> |
43 | 43 | ||
44 | 44 | ||
45 | /* PIIX4 SMBus address offsets */ | 45 | /* PIIX4 SMBus address offsets */ |
diff --git a/drivers/i2c/busses/i2c-pmcmsp.c b/drivers/i2c/busses/i2c-pmcmsp.c index 7b57d5f267e1..dfa7ae9c1b8e 100644 --- a/drivers/i2c/busses/i2c-pmcmsp.c +++ b/drivers/i2c/busses/i2c-pmcmsp.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/completion.h> | 33 | #include <linux/completion.h> |
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <asm/io.h> | 36 | #include <linux/io.h> |
37 | 37 | ||
38 | #define DRV_NAME "pmcmsptwi" | 38 | #define DRV_NAME "pmcmsptwi" |
39 | 39 | ||
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index fbde6f614059..020ff23d762f 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -34,9 +34,9 @@ | |||
34 | #include <linux/err.h> | 34 | #include <linux/err.h> |
35 | #include <linux/clk.h> | 35 | #include <linux/clk.h> |
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <linux/io.h> | ||
37 | 38 | ||
38 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
39 | #include <asm/io.h> | ||
40 | #include <plat/i2c.h> | 40 | #include <plat/i2c.h> |
41 | 41 | ||
42 | /* | 42 | /* |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index ec3256cce91e..72902e0bbfa7 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -35,9 +35,9 @@ | |||
35 | #include <linux/clk.h> | 35 | #include <linux/clk.h> |
36 | #include <linux/cpufreq.h> | 36 | #include <linux/cpufreq.h> |
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | #include <linux/io.h> | ||
38 | 39 | ||
39 | #include <asm/irq.h> | 40 | #include <asm/irq.h> |
40 | #include <asm/io.h> | ||
41 | 41 | ||
42 | #include <plat/regs-iic.h> | 42 | #include <plat/regs-iic.h> |
43 | #include <plat/iic.h> | 43 | #include <plat/iic.h> |
diff --git a/drivers/i2c/busses/i2c-s6000.c b/drivers/i2c/busses/i2c-s6000.c index c91359f4965c..cadc0216e02f 100644 --- a/drivers/i2c/busses/i2c-s6000.c +++ b/drivers/i2c/busses/i2c-s6000.c | |||
@@ -36,8 +36,8 @@ | |||
36 | #include <linux/completion.h> | 36 | #include <linux/completion.h> |
37 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
38 | #include <linux/platform_device.h> | 38 | #include <linux/platform_device.h> |
39 | #include <linux/io.h> | ||
39 | 40 | ||
40 | #include <asm/io.h> | ||
41 | #include "i2c-s6000.h" | 41 | #include "i2c-s6000.h" |
42 | 42 | ||
43 | #define DRV_NAME "i2c-s6000" | 43 | #define DRV_NAME "i2c-s6000" |
diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c index b9680f50f541..4f93da31d3ad 100644 --- a/drivers/i2c/busses/i2c-sh7760.c +++ b/drivers/i2c/busses/i2c-sh7760.c | |||
@@ -16,10 +16,10 @@ | |||
16 | #include <linux/ioport.h> | 16 | #include <linux/ioport.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/io.h> | ||
19 | 20 | ||
20 | #include <asm/clock.h> | 21 | #include <asm/clock.h> |
21 | #include <asm/i2c-sh7760.h> | 22 | #include <asm/i2c-sh7760.h> |
22 | #include <asm/io.h> | ||
23 | 23 | ||
24 | /* register offsets */ | 24 | /* register offsets */ |
25 | #define I2CSCR 0x0 /* slave ctrl */ | 25 | #define I2CSCR 0x0 /* slave ctrl */ |
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c index 98b1ec489159..3d76a188e42f 100644 --- a/drivers/i2c/busses/i2c-sibyte.c +++ b/drivers/i2c/busses/i2c-sibyte.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
25 | #include <asm/io.h> | 25 | #include <linux/io.h> |
26 | #include <asm/sibyte/sb1250_regs.h> | 26 | #include <asm/sibyte/sb1250_regs.h> |
27 | #include <asm/sibyte/sb1250_smbus.h> | 27 | #include <asm/sibyte/sb1250_smbus.h> |
28 | 28 | ||
diff --git a/drivers/i2c/busses/i2c-simtec.c b/drivers/i2c/busses/i2c-simtec.c index 78b06107342c..2fc08fbf67a2 100644 --- a/drivers/i2c/busses/i2c-simtec.c +++ b/drivers/i2c/busses/i2c-simtec.c | |||
@@ -24,12 +24,11 @@ | |||
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/io.h> | ||
27 | 28 | ||
28 | #include <linux/i2c.h> | 29 | #include <linux/i2c.h> |
29 | #include <linux/i2c-algo-bit.h> | 30 | #include <linux/i2c-algo-bit.h> |
30 | 31 | ||
31 | #include <asm/io.h> | ||
32 | |||
33 | struct simtec_i2c_data { | 32 | struct simtec_i2c_data { |
34 | struct resource *ioarea; | 33 | struct resource *ioarea; |
35 | void __iomem *reg; | 34 | void __iomem *reg; |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index 55a71370c79b..437586611d4a 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #include <linux/init.h> | 61 | #include <linux/init.h> |
62 | #include <linux/i2c.h> | 62 | #include <linux/i2c.h> |
63 | #include <linux/acpi.h> | 63 | #include <linux/acpi.h> |
64 | #include <asm/io.h> | 64 | #include <linux/io.h> |
65 | 65 | ||
66 | static int blacklist[] = { | 66 | static int blacklist[] = { |
67 | PCI_DEVICE_ID_SI_540, | 67 | PCI_DEVICE_ID_SI_540, |
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index 2309c7f1bde2..e6f539e26f65 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c | |||
@@ -53,7 +53,7 @@ | |||
53 | #include <linux/init.h> | 53 | #include <linux/init.h> |
54 | #include <linux/i2c.h> | 54 | #include <linux/i2c.h> |
55 | #include <linux/acpi.h> | 55 | #include <linux/acpi.h> |
56 | #include <asm/io.h> | 56 | #include <linux/io.h> |
57 | 57 | ||
58 | /* SIS630 SMBus registers */ | 58 | /* SIS630 SMBus registers */ |
59 | #define SMB_STS 0x80 /* status */ | 59 | #define SMB_STS 0x80 /* status */ |
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index d43d8f8943dd..86837f0c4cb9 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <linux/i2c.h> | 38 | #include <linux/i2c.h> |
39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
40 | #include <linux/acpi.h> | 40 | #include <linux/acpi.h> |
41 | #include <asm/io.h> | 41 | #include <linux/io.h> |
42 | 42 | ||
43 | /* base address register in PCI config space */ | 43 | /* base address register in PCI config space */ |
44 | #define SIS96x_BAR 0x04 | 44 | #define SIS96x_BAR 0x04 |
diff --git a/drivers/i2c/busses/i2c-stub.c b/drivers/i2c/busses/i2c-stub.c index 0c770eabe85e..b1b3447942c9 100644 --- a/drivers/i2c/busses/i2c-stub.c +++ b/drivers/i2c/busses/i2c-stub.c | |||
@@ -29,13 +29,16 @@ | |||
29 | #include <linux/i2c.h> | 29 | #include <linux/i2c.h> |
30 | 30 | ||
31 | #define MAX_CHIPS 10 | 31 | #define MAX_CHIPS 10 |
32 | #define STUB_FUNC (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | \ | ||
33 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | \ | ||
34 | I2C_FUNC_SMBUS_I2C_BLOCK) | ||
32 | 35 | ||
33 | static unsigned short chip_addr[MAX_CHIPS]; | 36 | static unsigned short chip_addr[MAX_CHIPS]; |
34 | module_param_array(chip_addr, ushort, NULL, S_IRUGO); | 37 | module_param_array(chip_addr, ushort, NULL, S_IRUGO); |
35 | MODULE_PARM_DESC(chip_addr, | 38 | MODULE_PARM_DESC(chip_addr, |
36 | "Chip addresses (up to 10, between 0x03 and 0x77)"); | 39 | "Chip addresses (up to 10, between 0x03 and 0x77)"); |
37 | 40 | ||
38 | static unsigned long functionality = ~0UL; | 41 | static unsigned long functionality = STUB_FUNC; |
39 | module_param(functionality, ulong, S_IRUGO | S_IWUSR); | 42 | module_param(functionality, ulong, S_IRUGO | S_IWUSR); |
40 | MODULE_PARM_DESC(functionality, "Override functionality bitfield"); | 43 | MODULE_PARM_DESC(functionality, "Override functionality bitfield"); |
41 | 44 | ||
@@ -156,9 +159,7 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
156 | 159 | ||
157 | static u32 stub_func(struct i2c_adapter *adapter) | 160 | static u32 stub_func(struct i2c_adapter *adapter) |
158 | { | 161 | { |
159 | return (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 162 | return STUB_FUNC & functionality; |
160 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | ||
161 | I2C_FUNC_SMBUS_I2C_BLOCK) & functionality; | ||
162 | } | 163 | } |
163 | 164 | ||
164 | static const struct i2c_algorithm smbus_algorithm = { | 165 | static const struct i2c_algorithm smbus_algorithm = { |
diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c index 5c473833d948..60556012312f 100644 --- a/drivers/i2c/busses/i2c-versatile.c +++ b/drivers/i2c/busses/i2c-versatile.c | |||
@@ -15,8 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | 18 | #include <linux/io.h> | |
19 | #include <asm/io.h> | ||
20 | 19 | ||
21 | #define I2C_CONTROL 0x00 | 20 | #define I2C_CONTROL 0x00 |
22 | #define I2C_CONTROLS 0x00 | 21 | #define I2C_CONTROLS 0x00 |
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c index de78283bddbe..7799fe5bda88 100644 --- a/drivers/i2c/busses/i2c-via.c +++ b/drivers/i2c/busses/i2c-via.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/i2c-algo-bit.h> | 27 | #include <linux/i2c-algo-bit.h> |
28 | #include <asm/io.h> | 28 | #include <linux/io.h> |
29 | 29 | ||
30 | /* Power management registers */ | 30 | /* Power management registers */ |
31 | #define PM_CFG_REVID 0x08 /* silicon revision code */ | 31 | #define PM_CFG_REVID 0x08 /* silicon revision code */ |
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index d57292e5dae0..4c6fff5f330d 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
@@ -51,7 +51,7 @@ | |||
51 | #include <linux/i2c.h> | 51 | #include <linux/i2c.h> |
52 | #include <linux/init.h> | 52 | #include <linux/init.h> |
53 | #include <linux/acpi.h> | 53 | #include <linux/acpi.h> |
54 | #include <asm/io.h> | 54 | #include <linux/io.h> |
55 | 55 | ||
56 | static struct pci_dev *vt596_pdev; | 56 | static struct pci_dev *vt596_pdev; |
57 | 57 | ||
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index 684395b6f3e2..4cb4bb009950 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <asm/io.h> | 35 | #include <linux/io.h> |
36 | 36 | ||
37 | #include <linux/scx200.h> | 37 | #include <linux/scx200.h> |
38 | 38 | ||
@@ -552,7 +552,7 @@ static int __init scx200_create_isa(const char *text, unsigned long base, | |||
552 | * the name and the BAR where the I/O address resource is located. ISA | 552 | * the name and the BAR where the I/O address resource is located. ISA |
553 | * devices are flagged with a bar value of -1 */ | 553 | * devices are flagged with a bar value of -1 */ |
554 | 554 | ||
555 | static struct pci_device_id scx200_pci[] = { | 555 | static const struct pci_device_id scx200_pci[] __initconst = { |
556 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE), | 556 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE), |
557 | .driver_data = 0 }, | 557 | .driver_data = 0 }, |
558 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE), | 558 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE), |
diff --git a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c index 42df0eca43d5..7ee0d502ceab 100644 --- a/drivers/i2c/busses/scx200_i2c.c +++ b/drivers/i2c/busses/scx200_i2c.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
29 | #include <linux/i2c-algo-bit.h> | 29 | #include <linux/i2c-algo-bit.h> |
30 | #include <asm/io.h> | 30 | #include <linux/io.h> |
31 | 31 | ||
32 | #include <linux/scx200_gpio.h> | 32 | #include <linux/scx200_gpio.h> |
33 | 33 | ||
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 7c469a62c3c1..db3c9f3a7647 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1221,10 +1221,10 @@ EXPORT_SYMBOL(i2c_transfer); | |||
1221 | * | 1221 | * |
1222 | * Returns negative errno, or else the number of bytes written. | 1222 | * Returns negative errno, or else the number of bytes written. |
1223 | */ | 1223 | */ |
1224 | int i2c_master_send(struct i2c_client *client,const char *buf ,int count) | 1224 | int i2c_master_send(struct i2c_client *client, const char *buf, int count) |
1225 | { | 1225 | { |
1226 | int ret; | 1226 | int ret; |
1227 | struct i2c_adapter *adap=client->adapter; | 1227 | struct i2c_adapter *adap = client->adapter; |
1228 | struct i2c_msg msg; | 1228 | struct i2c_msg msg; |
1229 | 1229 | ||
1230 | msg.addr = client->addr; | 1230 | msg.addr = client->addr; |
@@ -1248,9 +1248,9 @@ EXPORT_SYMBOL(i2c_master_send); | |||
1248 | * | 1248 | * |
1249 | * Returns negative errno, or else the number of bytes read. | 1249 | * Returns negative errno, or else the number of bytes read. |
1250 | */ | 1250 | */ |
1251 | int i2c_master_recv(struct i2c_client *client, char *buf ,int count) | 1251 | int i2c_master_recv(struct i2c_client *client, char *buf, int count) |
1252 | { | 1252 | { |
1253 | struct i2c_adapter *adap=client->adapter; | 1253 | struct i2c_adapter *adap = client->adapter; |
1254 | struct i2c_msg msg; | 1254 | struct i2c_msg msg; |
1255 | int ret; | 1255 | int ret; |
1256 | 1256 | ||
@@ -1452,7 +1452,7 @@ i2c_new_probed_device(struct i2c_adapter *adap, | |||
1452 | } | 1452 | } |
1453 | EXPORT_SYMBOL_GPL(i2c_new_probed_device); | 1453 | EXPORT_SYMBOL_GPL(i2c_new_probed_device); |
1454 | 1454 | ||
1455 | struct i2c_adapter* i2c_get_adapter(int id) | 1455 | struct i2c_adapter *i2c_get_adapter(int id) |
1456 | { | 1456 | { |
1457 | struct i2c_adapter *adapter; | 1457 | struct i2c_adapter *adapter; |
1458 | 1458 | ||
@@ -1479,7 +1479,7 @@ static u8 crc8(u16 data) | |||
1479 | { | 1479 | { |
1480 | int i; | 1480 | int i; |
1481 | 1481 | ||
1482 | for(i = 0; i < 8; i++) { | 1482 | for (i = 0; i < 8; i++) { |
1483 | if (data & 0x8000) | 1483 | if (data & 0x8000) |
1484 | data = data ^ POLY; | 1484 | data = data ^ POLY; |
1485 | data = data << 1; | 1485 | data = data << 1; |
@@ -1492,7 +1492,7 @@ static u8 i2c_smbus_pec(u8 crc, u8 *p, size_t count) | |||
1492 | { | 1492 | { |
1493 | int i; | 1493 | int i; |
1494 | 1494 | ||
1495 | for(i = 0; i < count; i++) | 1495 | for (i = 0; i < count; i++) |
1496 | crc = crc8((crc ^ p[i]) << 8); | 1496 | crc = crc8((crc ^ p[i]) << 8); |
1497 | return crc; | 1497 | return crc; |
1498 | } | 1498 | } |
@@ -1562,7 +1562,7 @@ EXPORT_SYMBOL(i2c_smbus_read_byte); | |||
1562 | */ | 1562 | */ |
1563 | s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) | 1563 | s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) |
1564 | { | 1564 | { |
1565 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 1565 | return i2c_smbus_xfer(client->adapter, client->addr, client->flags, |
1566 | I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL); | 1566 | I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL); |
1567 | } | 1567 | } |
1568 | EXPORT_SYMBOL(i2c_smbus_write_byte); | 1568 | EXPORT_SYMBOL(i2c_smbus_write_byte); |
@@ -1600,9 +1600,9 @@ s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) | |||
1600 | { | 1600 | { |
1601 | union i2c_smbus_data data; | 1601 | union i2c_smbus_data data; |
1602 | data.byte = value; | 1602 | data.byte = value; |
1603 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 1603 | return i2c_smbus_xfer(client->adapter, client->addr, client->flags, |
1604 | I2C_SMBUS_WRITE,command, | 1604 | I2C_SMBUS_WRITE, command, |
1605 | I2C_SMBUS_BYTE_DATA,&data); | 1605 | I2C_SMBUS_BYTE_DATA, &data); |
1606 | } | 1606 | } |
1607 | EXPORT_SYMBOL(i2c_smbus_write_byte_data); | 1607 | EXPORT_SYMBOL(i2c_smbus_write_byte_data); |
1608 | 1608 | ||
@@ -1639,9 +1639,9 @@ s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) | |||
1639 | { | 1639 | { |
1640 | union i2c_smbus_data data; | 1640 | union i2c_smbus_data data; |
1641 | data.word = value; | 1641 | data.word = value; |
1642 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 1642 | return i2c_smbus_xfer(client->adapter, client->addr, client->flags, |
1643 | I2C_SMBUS_WRITE,command, | 1643 | I2C_SMBUS_WRITE, command, |
1644 | I2C_SMBUS_WORD_DATA,&data); | 1644 | I2C_SMBUS_WORD_DATA, &data); |
1645 | } | 1645 | } |
1646 | EXPORT_SYMBOL(i2c_smbus_write_word_data); | 1646 | EXPORT_SYMBOL(i2c_smbus_write_word_data); |
1647 | 1647 | ||
@@ -1718,9 +1718,9 @@ s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, | |||
1718 | length = I2C_SMBUS_BLOCK_MAX; | 1718 | length = I2C_SMBUS_BLOCK_MAX; |
1719 | data.block[0] = length; | 1719 | data.block[0] = length; |
1720 | memcpy(&data.block[1], values, length); | 1720 | memcpy(&data.block[1], values, length); |
1721 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 1721 | return i2c_smbus_xfer(client->adapter, client->addr, client->flags, |
1722 | I2C_SMBUS_WRITE,command, | 1722 | I2C_SMBUS_WRITE, command, |
1723 | I2C_SMBUS_BLOCK_DATA,&data); | 1723 | I2C_SMBUS_BLOCK_DATA, &data); |
1724 | } | 1724 | } |
1725 | EXPORT_SYMBOL(i2c_smbus_write_block_data); | 1725 | EXPORT_SYMBOL(i2c_smbus_write_block_data); |
1726 | 1726 | ||
@@ -1762,10 +1762,10 @@ EXPORT_SYMBOL(i2c_smbus_write_i2c_block_data); | |||
1762 | 1762 | ||
1763 | /* Simulate a SMBus command using the i2c protocol | 1763 | /* Simulate a SMBus command using the i2c protocol |
1764 | No checking of parameters is done! */ | 1764 | No checking of parameters is done! */ |
1765 | static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | 1765 | static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr, |
1766 | unsigned short flags, | 1766 | unsigned short flags, |
1767 | char read_write, u8 command, int size, | 1767 | char read_write, u8 command, int size, |
1768 | union i2c_smbus_data * data) | 1768 | union i2c_smbus_data *data) |
1769 | { | 1769 | { |
1770 | /* So we need to generate a series of msgs. In the case of writing, we | 1770 | /* So we need to generate a series of msgs. In the case of writing, we |
1771 | need to use only one message; when reading, we need two. We initialize | 1771 | need to use only one message; when reading, we need two. We initialize |
@@ -1773,7 +1773,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1773 | simpler. */ | 1773 | simpler. */ |
1774 | unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3]; | 1774 | unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3]; |
1775 | unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2]; | 1775 | unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2]; |
1776 | int num = read_write == I2C_SMBUS_READ?2:1; | 1776 | int num = read_write == I2C_SMBUS_READ ? 2 : 1; |
1777 | struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, | 1777 | struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, |
1778 | { addr, flags | I2C_M_RD, 0, msgbuf1 } | 1778 | { addr, flags | I2C_M_RD, 0, msgbuf1 } |
1779 | }; | 1779 | }; |
@@ -1782,7 +1782,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1782 | int status; | 1782 | int status; |
1783 | 1783 | ||
1784 | msgbuf0[0] = command; | 1784 | msgbuf0[0] = command; |
1785 | switch(size) { | 1785 | switch (size) { |
1786 | case I2C_SMBUS_QUICK: | 1786 | case I2C_SMBUS_QUICK: |
1787 | msg[0].len = 0; | 1787 | msg[0].len = 0; |
1788 | /* Special case: The read/write field is used as data */ | 1788 | /* Special case: The read/write field is used as data */ |
@@ -1809,7 +1809,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1809 | if (read_write == I2C_SMBUS_READ) | 1809 | if (read_write == I2C_SMBUS_READ) |
1810 | msg[1].len = 2; | 1810 | msg[1].len = 2; |
1811 | else { | 1811 | else { |
1812 | msg[0].len=3; | 1812 | msg[0].len = 3; |
1813 | msgbuf0[1] = data->word & 0xff; | 1813 | msgbuf0[1] = data->word & 0xff; |
1814 | msgbuf0[2] = data->word >> 8; | 1814 | msgbuf0[2] = data->word >> 8; |
1815 | } | 1815 | } |
@@ -1902,26 +1902,26 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1902 | } | 1902 | } |
1903 | 1903 | ||
1904 | if (read_write == I2C_SMBUS_READ) | 1904 | if (read_write == I2C_SMBUS_READ) |
1905 | switch(size) { | 1905 | switch (size) { |
1906 | case I2C_SMBUS_BYTE: | 1906 | case I2C_SMBUS_BYTE: |
1907 | data->byte = msgbuf0[0]; | 1907 | data->byte = msgbuf0[0]; |
1908 | break; | 1908 | break; |
1909 | case I2C_SMBUS_BYTE_DATA: | 1909 | case I2C_SMBUS_BYTE_DATA: |
1910 | data->byte = msgbuf1[0]; | 1910 | data->byte = msgbuf1[0]; |
1911 | break; | 1911 | break; |
1912 | case I2C_SMBUS_WORD_DATA: | 1912 | case I2C_SMBUS_WORD_DATA: |
1913 | case I2C_SMBUS_PROC_CALL: | 1913 | case I2C_SMBUS_PROC_CALL: |
1914 | data->word = msgbuf1[0] | (msgbuf1[1] << 8); | 1914 | data->word = msgbuf1[0] | (msgbuf1[1] << 8); |
1915 | break; | 1915 | break; |
1916 | case I2C_SMBUS_I2C_BLOCK_DATA: | 1916 | case I2C_SMBUS_I2C_BLOCK_DATA: |
1917 | for (i = 0; i < data->block[0]; i++) | 1917 | for (i = 0; i < data->block[0]; i++) |
1918 | data->block[i+1] = msgbuf1[i]; | 1918 | data->block[i+1] = msgbuf1[i]; |
1919 | break; | 1919 | break; |
1920 | case I2C_SMBUS_BLOCK_DATA: | 1920 | case I2C_SMBUS_BLOCK_DATA: |
1921 | case I2C_SMBUS_BLOCK_PROC_CALL: | 1921 | case I2C_SMBUS_BLOCK_PROC_CALL: |
1922 | for (i = 0; i < msgbuf1[0] + 1; i++) | 1922 | for (i = 0; i < msgbuf1[0] + 1; i++) |
1923 | data->block[i] = msgbuf1[i]; | 1923 | data->block[i] = msgbuf1[i]; |
1924 | break; | 1924 | break; |
1925 | } | 1925 | } |
1926 | return 0; | 1926 | return 0; |
1927 | } | 1927 | } |
@@ -1966,7 +1966,7 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags, | |||
1966 | } | 1966 | } |
1967 | rt_mutex_unlock(&adapter->bus_lock); | 1967 | rt_mutex_unlock(&adapter->bus_lock); |
1968 | } else | 1968 | } else |
1969 | res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write, | 1969 | res = i2c_smbus_xfer_emulated(adapter, addr, flags, read_write, |
1970 | command, protocol, data); | 1970 | command, protocol, data); |
1971 | 1971 | ||
1972 | return res; | 1972 | return res; |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index f4110aa49600..e0694e4d86c7 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/i2c.h> | 35 | #include <linux/i2c.h> |
36 | #include <linux/i2c-dev.h> | 36 | #include <linux/i2c-dev.h> |
37 | #include <linux/jiffies.h> | 37 | #include <linux/jiffies.h> |
38 | #include <asm/uaccess.h> | 38 | #include <linux/uaccess.h> |
39 | 39 | ||
40 | static struct i2c_driver i2cdev_driver; | 40 | static struct i2c_driver i2cdev_driver; |
41 | 41 | ||
@@ -132,45 +132,45 @@ static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); | |||
132 | * needed by those system calls and by this SMBus interface. | 132 | * needed by those system calls and by this SMBus interface. |
133 | */ | 133 | */ |
134 | 134 | ||
135 | static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count, | 135 | static ssize_t i2cdev_read(struct file *file, char __user *buf, size_t count, |
136 | loff_t *offset) | 136 | loff_t *offset) |
137 | { | 137 | { |
138 | char *tmp; | 138 | char *tmp; |
139 | int ret; | 139 | int ret; |
140 | 140 | ||
141 | struct i2c_client *client = (struct i2c_client *)file->private_data; | 141 | struct i2c_client *client = file->private_data; |
142 | 142 | ||
143 | if (count > 8192) | 143 | if (count > 8192) |
144 | count = 8192; | 144 | count = 8192; |
145 | 145 | ||
146 | tmp = kmalloc(count,GFP_KERNEL); | 146 | tmp = kmalloc(count, GFP_KERNEL); |
147 | if (tmp==NULL) | 147 | if (tmp == NULL) |
148 | return -ENOMEM; | 148 | return -ENOMEM; |
149 | 149 | ||
150 | pr_debug("i2c-dev: i2c-%d reading %zu bytes.\n", | 150 | pr_debug("i2c-dev: i2c-%d reading %zu bytes.\n", |
151 | iminor(file->f_path.dentry->d_inode), count); | 151 | iminor(file->f_path.dentry->d_inode), count); |
152 | 152 | ||
153 | ret = i2c_master_recv(client,tmp,count); | 153 | ret = i2c_master_recv(client, tmp, count); |
154 | if (ret >= 0) | 154 | if (ret >= 0) |
155 | ret = copy_to_user(buf,tmp,count)?-EFAULT:ret; | 155 | ret = copy_to_user(buf, tmp, count) ? -EFAULT : ret; |
156 | kfree(tmp); | 156 | kfree(tmp); |
157 | return ret; | 157 | return ret; |
158 | } | 158 | } |
159 | 159 | ||
160 | static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t count, | 160 | static ssize_t i2cdev_write(struct file *file, const char __user *buf, |
161 | loff_t *offset) | 161 | size_t count, loff_t *offset) |
162 | { | 162 | { |
163 | int ret; | 163 | int ret; |
164 | char *tmp; | 164 | char *tmp; |
165 | struct i2c_client *client = (struct i2c_client *)file->private_data; | 165 | struct i2c_client *client = file->private_data; |
166 | 166 | ||
167 | if (count > 8192) | 167 | if (count > 8192) |
168 | count = 8192; | 168 | count = 8192; |
169 | 169 | ||
170 | tmp = kmalloc(count,GFP_KERNEL); | 170 | tmp = kmalloc(count, GFP_KERNEL); |
171 | if (tmp==NULL) | 171 | if (tmp == NULL) |
172 | return -ENOMEM; | 172 | return -ENOMEM; |
173 | if (copy_from_user(tmp,buf,count)) { | 173 | if (copy_from_user(tmp, buf, count)) { |
174 | kfree(tmp); | 174 | kfree(tmp); |
175 | return -EFAULT; | 175 | return -EFAULT; |
176 | } | 176 | } |
@@ -178,7 +178,7 @@ static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t c | |||
178 | pr_debug("i2c-dev: i2c-%d writing %zu bytes.\n", | 178 | pr_debug("i2c-dev: i2c-%d writing %zu bytes.\n", |
179 | iminor(file->f_path.dentry->d_inode), count); | 179 | iminor(file->f_path.dentry->d_inode), count); |
180 | 180 | ||
181 | ret = i2c_master_send(client,tmp,count); | 181 | ret = i2c_master_send(client, tmp, count); |
182 | kfree(tmp); | 182 | kfree(tmp); |
183 | return ret; | 183 | return ret; |
184 | } | 184 | } |
@@ -369,13 +369,13 @@ static noinline int i2cdev_ioctl_smbus(struct i2c_client *client, | |||
369 | 369 | ||
370 | static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 370 | static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
371 | { | 371 | { |
372 | struct i2c_client *client = (struct i2c_client *)file->private_data; | 372 | struct i2c_client *client = file->private_data; |
373 | unsigned long funcs; | 373 | unsigned long funcs; |
374 | 374 | ||
375 | dev_dbg(&client->adapter->dev, "ioctl, cmd=0x%02x, arg=0x%02lx\n", | 375 | dev_dbg(&client->adapter->dev, "ioctl, cmd=0x%02x, arg=0x%02lx\n", |
376 | cmd, arg); | 376 | cmd, arg); |
377 | 377 | ||
378 | switch ( cmd ) { | 378 | switch (cmd) { |
379 | case I2C_SLAVE: | 379 | case I2C_SLAVE: |
380 | case I2C_SLAVE_FORCE: | 380 | case I2C_SLAVE_FORCE: |
381 | /* NOTE: devices set up to work with "new style" drivers | 381 | /* NOTE: devices set up to work with "new style" drivers |
@@ -601,7 +601,7 @@ static void __exit i2c_dev_exit(void) | |||
601 | { | 601 | { |
602 | i2c_del_driver(&i2cdev_driver); | 602 | i2c_del_driver(&i2cdev_driver); |
603 | class_destroy(i2c_dev_class); | 603 | class_destroy(i2c_dev_class); |
604 | unregister_chrdev(I2C_MAJOR,"i2c"); | 604 | unregister_chrdev(I2C_MAJOR, "i2c"); |
605 | } | 605 | } |
606 | 606 | ||
607 | MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and " | 607 | MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and " |
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index a79a62f75481..f7ca3a42b490 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c | |||
@@ -54,7 +54,7 @@ | |||
54 | struct at24_data { | 54 | struct at24_data { |
55 | struct at24_platform_data chip; | 55 | struct at24_platform_data chip; |
56 | struct memory_accessor macc; | 56 | struct memory_accessor macc; |
57 | bool use_smbus; | 57 | int use_smbus; |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * Lock protects against activities from other Linux tasks, | 60 | * Lock protects against activities from other Linux tasks, |
@@ -184,11 +184,19 @@ static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, | |||
184 | if (count > io_limit) | 184 | if (count > io_limit) |
185 | count = io_limit; | 185 | count = io_limit; |
186 | 186 | ||
187 | if (at24->use_smbus) { | 187 | switch (at24->use_smbus) { |
188 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
188 | /* Smaller eeproms can work given some SMBus extension calls */ | 189 | /* Smaller eeproms can work given some SMBus extension calls */ |
189 | if (count > I2C_SMBUS_BLOCK_MAX) | 190 | if (count > I2C_SMBUS_BLOCK_MAX) |
190 | count = I2C_SMBUS_BLOCK_MAX; | 191 | count = I2C_SMBUS_BLOCK_MAX; |
191 | } else { | 192 | break; |
193 | case I2C_SMBUS_WORD_DATA: | ||
194 | count = 2; | ||
195 | break; | ||
196 | case I2C_SMBUS_BYTE_DATA: | ||
197 | count = 1; | ||
198 | break; | ||
199 | default: | ||
192 | /* | 200 | /* |
193 | * When we have a better choice than SMBus calls, use a | 201 | * When we have a better choice than SMBus calls, use a |
194 | * combined I2C message. Write address; then read up to | 202 | * combined I2C message. Write address; then read up to |
@@ -219,10 +227,27 @@ static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, | |||
219 | timeout = jiffies + msecs_to_jiffies(write_timeout); | 227 | timeout = jiffies + msecs_to_jiffies(write_timeout); |
220 | do { | 228 | do { |
221 | read_time = jiffies; | 229 | read_time = jiffies; |
222 | if (at24->use_smbus) { | 230 | switch (at24->use_smbus) { |
231 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
223 | status = i2c_smbus_read_i2c_block_data(client, offset, | 232 | status = i2c_smbus_read_i2c_block_data(client, offset, |
224 | count, buf); | 233 | count, buf); |
225 | } else { | 234 | break; |
235 | case I2C_SMBUS_WORD_DATA: | ||
236 | status = i2c_smbus_read_word_data(client, offset); | ||
237 | if (status >= 0) { | ||
238 | buf[0] = status & 0xff; | ||
239 | buf[1] = status >> 8; | ||
240 | status = count; | ||
241 | } | ||
242 | break; | ||
243 | case I2C_SMBUS_BYTE_DATA: | ||
244 | status = i2c_smbus_read_byte_data(client, offset); | ||
245 | if (status >= 0) { | ||
246 | buf[0] = status; | ||
247 | status = count; | ||
248 | } | ||
249 | break; | ||
250 | default: | ||
226 | status = i2c_transfer(client->adapter, msg, 2); | 251 | status = i2c_transfer(client->adapter, msg, 2); |
227 | if (status == 2) | 252 | if (status == 2) |
228 | status = count; | 253 | status = count; |
@@ -436,7 +461,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
436 | { | 461 | { |
437 | struct at24_platform_data chip; | 462 | struct at24_platform_data chip; |
438 | bool writable; | 463 | bool writable; |
439 | bool use_smbus = false; | 464 | int use_smbus = 0; |
440 | struct at24_data *at24; | 465 | struct at24_data *at24; |
441 | int err; | 466 | int err; |
442 | unsigned i, num_addresses; | 467 | unsigned i, num_addresses; |
@@ -477,12 +502,19 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
477 | err = -EPFNOSUPPORT; | 502 | err = -EPFNOSUPPORT; |
478 | goto err_out; | 503 | goto err_out; |
479 | } | 504 | } |
480 | if (!i2c_check_functionality(client->adapter, | 505 | if (i2c_check_functionality(client->adapter, |
481 | I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { | 506 | I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { |
507 | use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; | ||
508 | } else if (i2c_check_functionality(client->adapter, | ||
509 | I2C_FUNC_SMBUS_READ_WORD_DATA)) { | ||
510 | use_smbus = I2C_SMBUS_WORD_DATA; | ||
511 | } else if (i2c_check_functionality(client->adapter, | ||
512 | I2C_FUNC_SMBUS_READ_BYTE_DATA)) { | ||
513 | use_smbus = I2C_SMBUS_BYTE_DATA; | ||
514 | } else { | ||
482 | err = -EPFNOSUPPORT; | 515 | err = -EPFNOSUPPORT; |
483 | goto err_out; | 516 | goto err_out; |
484 | } | 517 | } |
485 | use_smbus = true; | ||
486 | } | 518 | } |
487 | 519 | ||
488 | if (chip.flags & AT24_FLAG_TAKE8ADDR) | 520 | if (chip.flags & AT24_FLAG_TAKE8ADDR) |
@@ -568,11 +600,16 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
568 | dev_info(&client->dev, "%zu byte %s EEPROM %s\n", | 600 | dev_info(&client->dev, "%zu byte %s EEPROM %s\n", |
569 | at24->bin.size, client->name, | 601 | at24->bin.size, client->name, |
570 | writable ? "(writable)" : "(read-only)"); | 602 | writable ? "(writable)" : "(read-only)"); |
603 | if (use_smbus == I2C_SMBUS_WORD_DATA || | ||
604 | use_smbus == I2C_SMBUS_BYTE_DATA) { | ||
605 | dev_notice(&client->dev, "Falling back to %s reads, " | ||
606 | "performance will suffer\n", use_smbus == | ||
607 | I2C_SMBUS_WORD_DATA ? "word" : "byte"); | ||
608 | } | ||
571 | dev_dbg(&client->dev, | 609 | dev_dbg(&client->dev, |
572 | "page_size %d, num_addresses %d, write_max %d%s\n", | 610 | "page_size %d, num_addresses %d, write_max %d, use_smbus %d\n", |
573 | chip.page_size, num_addresses, | 611 | chip.page_size, num_addresses, |
574 | at24->write_max, | 612 | at24->write_max, use_smbus); |
575 | use_smbus ? ", use_smbus" : ""); | ||
576 | 613 | ||
577 | /* export data to kernel code */ | 614 | /* export data to kernel code */ |
578 | if (chip.setup) | 615 | if (chip.setup) |