diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-30 18:54:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-30 18:54:59 -0400 |
commit | 839d8810747bbf39e0a5a7f223b67bffa7945f8d (patch) | |
tree | c16583342b871107f6805c21da4b1a96cfaa7aac /drivers | |
parent | 0cfdc724390fb9370f27bb9a133eadf69114dd21 (diff) | |
parent | 06a67848c6681a73e621e47c056490d51a07289f (diff) |
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
i2c: Functions for byte-swapped smbus_write/read_word_data
i2c-algo-pca: Return standard fault codes
i2c-algo-bit: Return standard fault codes
i2c-algo-bit: Be verbose on bus testing failure
i2c-algo-bit: Let user test buses without failing
i2c/scx200_acb: Fix section mismatch warning in scx200_pci_drv
i2c: I2C_ELEKTOR should depend on HAS_IOPORT
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 24 | ||||
-rw-r--r-- | drivers/i2c/algos/i2c-algo-pca.c | 6 | ||||
-rw-r--r-- | drivers/i2c/busses/Kconfig | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/scx200_acb.c | 6 |
4 files changed, 21 insertions, 17 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index d6d58684712b..85584a547c25 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -47,8 +47,8 @@ | |||
47 | /* ----- global variables --------------------------------------------- */ | 47 | /* ----- global variables --------------------------------------------- */ |
48 | 48 | ||
49 | static int bit_test; /* see if the line-setting functions work */ | 49 | static int bit_test; /* see if the line-setting functions work */ |
50 | module_param(bit_test, bool, 0); | 50 | module_param(bit_test, int, S_IRUGO); |
51 | MODULE_PARM_DESC(bit_test, "Test the lines of the bus to see if it is stuck"); | 51 | MODULE_PARM_DESC(bit_test, "lines testing - 0 off; 1 report; 2 fail if stuck"); |
52 | 52 | ||
53 | #ifdef DEBUG | 53 | #ifdef DEBUG |
54 | static int i2c_debug = 1; | 54 | static int i2c_debug = 1; |
@@ -250,7 +250,9 @@ static int test_bus(struct i2c_adapter *i2c_adap) | |||
250 | sda = getsda(adap); | 250 | sda = getsda(adap); |
251 | scl = (adap->getscl == NULL) ? 1 : getscl(adap); | 251 | scl = (adap->getscl == NULL) ? 1 : getscl(adap); |
252 | if (!scl || !sda) { | 252 | if (!scl || !sda) { |
253 | printk(KERN_WARNING "%s: bus seems to be busy\n", name); | 253 | printk(KERN_WARNING |
254 | "%s: bus seems to be busy (scl=%d, sda=%d)\n", | ||
255 | name, scl, sda); | ||
254 | goto bailout; | 256 | goto bailout; |
255 | } | 257 | } |
256 | 258 | ||
@@ -441,7 +443,7 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
441 | acknak(i2c_adap, 0); | 443 | acknak(i2c_adap, 0); |
442 | dev_err(&i2c_adap->dev, "readbytes: invalid " | 444 | dev_err(&i2c_adap->dev, "readbytes: invalid " |
443 | "block length (%d)\n", inval); | 445 | "block length (%d)\n", inval); |
444 | return -EREMOTEIO; | 446 | return -EPROTO; |
445 | } | 447 | } |
446 | /* The original count value accounts for the extra | 448 | /* The original count value accounts for the extra |
447 | bytes, that is, either 1 for a regular transaction, | 449 | bytes, that is, either 1 for a regular transaction, |
@@ -470,7 +472,7 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
470 | * reads, writes as well as 10bit-addresses. | 472 | * reads, writes as well as 10bit-addresses. |
471 | * returns: | 473 | * returns: |
472 | * 0 everything went okay, the chip ack'ed, or IGNORE_NAK flag was set | 474 | * 0 everything went okay, the chip ack'ed, or IGNORE_NAK flag was set |
473 | * -x an error occurred (like: -EREMOTEIO if the device did not answer, or | 475 | * -x an error occurred (like: -ENXIO if the device did not answer, or |
474 | * -ETIMEDOUT, for example if the lines are stuck...) | 476 | * -ETIMEDOUT, for example if the lines are stuck...) |
475 | */ | 477 | */ |
476 | static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | 478 | static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) |
@@ -493,14 +495,14 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
493 | if ((ret != 1) && !nak_ok) { | 495 | if ((ret != 1) && !nak_ok) { |
494 | dev_err(&i2c_adap->dev, | 496 | dev_err(&i2c_adap->dev, |
495 | "died at extended address code\n"); | 497 | "died at extended address code\n"); |
496 | return -EREMOTEIO; | 498 | return -ENXIO; |
497 | } | 499 | } |
498 | /* the remaining 8 bit address */ | 500 | /* the remaining 8 bit address */ |
499 | ret = i2c_outb(i2c_adap, msg->addr & 0x7f); | 501 | ret = i2c_outb(i2c_adap, msg->addr & 0x7f); |
500 | if ((ret != 1) && !nak_ok) { | 502 | if ((ret != 1) && !nak_ok) { |
501 | /* the chip did not ack / xmission error occurred */ | 503 | /* the chip did not ack / xmission error occurred */ |
502 | dev_err(&i2c_adap->dev, "died at 2nd address code\n"); | 504 | dev_err(&i2c_adap->dev, "died at 2nd address code\n"); |
503 | return -EREMOTEIO; | 505 | return -ENXIO; |
504 | } | 506 | } |
505 | if (flags & I2C_M_RD) { | 507 | if (flags & I2C_M_RD) { |
506 | bit_dbg(3, &i2c_adap->dev, "emitting repeated " | 508 | bit_dbg(3, &i2c_adap->dev, "emitting repeated " |
@@ -512,7 +514,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
512 | if ((ret != 1) && !nak_ok) { | 514 | if ((ret != 1) && !nak_ok) { |
513 | dev_err(&i2c_adap->dev, | 515 | dev_err(&i2c_adap->dev, |
514 | "died at repeated address code\n"); | 516 | "died at repeated address code\n"); |
515 | return -EREMOTEIO; | 517 | return -EIO; |
516 | } | 518 | } |
517 | } | 519 | } |
518 | } else { /* normal 7bit address */ | 520 | } else { /* normal 7bit address */ |
@@ -570,7 +572,7 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, | |||
570 | ret, ret == 1 ? "" : "s"); | 572 | ret, ret == 1 ? "" : "s"); |
571 | if (ret < pmsg->len) { | 573 | if (ret < pmsg->len) { |
572 | if (ret >= 0) | 574 | if (ret >= 0) |
573 | ret = -EREMOTEIO; | 575 | ret = -EIO; |
574 | goto bailout; | 576 | goto bailout; |
575 | } | 577 | } |
576 | } else { | 578 | } else { |
@@ -581,7 +583,7 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, | |||
581 | ret, ret == 1 ? "" : "s"); | 583 | ret, ret == 1 ? "" : "s"); |
582 | if (ret < pmsg->len) { | 584 | if (ret < pmsg->len) { |
583 | if (ret >= 0) | 585 | if (ret >= 0) |
584 | ret = -EREMOTEIO; | 586 | ret = -EIO; |
585 | goto bailout; | 587 | goto bailout; |
586 | } | 588 | } |
587 | } | 589 | } |
@@ -624,7 +626,7 @@ static int __i2c_bit_add_bus(struct i2c_adapter *adap, | |||
624 | 626 | ||
625 | if (bit_test) { | 627 | if (bit_test) { |
626 | ret = test_bus(adap); | 628 | ret = test_bus(adap); |
627 | if (ret < 0) | 629 | if (bit_test >= 2 && ret < 0) |
628 | return -ENODEV; | 630 | return -ENODEV; |
629 | } | 631 | } |
630 | 632 | ||
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c index 4ca9cf9cde73..beb9ffe2564b 100644 --- a/drivers/i2c/algos/i2c-algo-pca.c +++ b/drivers/i2c/algos/i2c-algo-pca.c | |||
@@ -196,7 +196,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
196 | } else { | 196 | } else { |
197 | dev_dbg(&i2c_adap->dev, "bus is not idle. status is " | 197 | dev_dbg(&i2c_adap->dev, "bus is not idle. status is " |
198 | "%#04x\n", state); | 198 | "%#04x\n", state); |
199 | return -EAGAIN; | 199 | return -EBUSY; |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
@@ -224,7 +224,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
224 | } | 224 | } |
225 | 225 | ||
226 | curmsg = 0; | 226 | curmsg = 0; |
227 | ret = -EREMOTEIO; | 227 | ret = -EIO; |
228 | while (curmsg < num) { | 228 | while (curmsg < num) { |
229 | state = pca_status(adap); | 229 | state = pca_status(adap); |
230 | 230 | ||
@@ -259,6 +259,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
259 | case 0x20: /* SLA+W has been transmitted; NOT ACK has been received */ | 259 | case 0x20: /* SLA+W has been transmitted; NOT ACK has been received */ |
260 | DEB2("NOT ACK received after SLA+W\n"); | 260 | DEB2("NOT ACK received after SLA+W\n"); |
261 | pca_stop(adap); | 261 | pca_stop(adap); |
262 | ret = -ENXIO; | ||
262 | goto out; | 263 | goto out; |
263 | 264 | ||
264 | case 0x40: /* SLA+R has been transmitted; ACK has been received */ | 265 | case 0x40: /* SLA+R has been transmitted; ACK has been received */ |
@@ -283,6 +284,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
283 | case 0x48: /* SLA+R has been transmitted; NOT ACK has been received */ | 284 | case 0x48: /* SLA+R has been transmitted; NOT ACK has been received */ |
284 | DEB2("NOT ACK received after SLA+R\n"); | 285 | DEB2("NOT ACK received after SLA+R\n"); |
285 | pca_stop(adap); | 286 | pca_stop(adap); |
287 | ret = -ENXIO; | ||
286 | goto out; | 288 | goto out; |
287 | 289 | ||
288 | case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK has been received */ | 290 | case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK has been received */ |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 646068e5100b..d1fc5cf9aa4d 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -789,7 +789,7 @@ config I2C_ACORN | |||
789 | 789 | ||
790 | config I2C_ELEKTOR | 790 | config I2C_ELEKTOR |
791 | tristate "Elektor ISA card" | 791 | tristate "Elektor ISA card" |
792 | depends on ISA && BROKEN_ON_SMP | 792 | depends on ISA && HAS_IOPORT && BROKEN_ON_SMP |
793 | select I2C_ALGOPCF | 793 | select I2C_ALGOPCF |
794 | help | 794 | help |
795 | This supports the PCF8584 ISA bus I2C adapter. Say Y if you own | 795 | This supports the PCF8584 ISA bus I2C adapter. Say Y if you own |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index 986e5f62debe..91e349c884c5 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -550,7 +550,7 @@ static int __devexit scx200_remove(struct platform_device *pdev) | |||
550 | return 0; | 550 | return 0; |
551 | } | 551 | } |
552 | 552 | ||
553 | static struct platform_driver scx200_pci_drv = { | 553 | static struct platform_driver scx200_pci_driver = { |
554 | .driver = { | 554 | .driver = { |
555 | .name = "cs5535-smb", | 555 | .name = "cs5535-smb", |
556 | .owner = THIS_MODULE, | 556 | .owner = THIS_MODULE, |
@@ -593,14 +593,14 @@ static int __init scx200_acb_init(void) | |||
593 | return 0; | 593 | return 0; |
594 | 594 | ||
595 | /* No ISA devices; register the platform driver for PCI-based devices */ | 595 | /* No ISA devices; register the platform driver for PCI-based devices */ |
596 | return platform_driver_register(&scx200_pci_drv); | 596 | return platform_driver_register(&scx200_pci_driver); |
597 | } | 597 | } |
598 | 598 | ||
599 | static void __exit scx200_acb_cleanup(void) | 599 | static void __exit scx200_acb_cleanup(void) |
600 | { | 600 | { |
601 | struct scx200_acb_iface *iface; | 601 | struct scx200_acb_iface *iface; |
602 | 602 | ||
603 | platform_driver_unregister(&scx200_pci_drv); | 603 | platform_driver_unregister(&scx200_pci_driver); |
604 | 604 | ||
605 | mutex_lock(&scx200_acb_list_mutex); | 605 | mutex_lock(&scx200_acb_list_mutex); |
606 | while ((iface = scx200_acb_list) != NULL) { | 606 | while ((iface = scx200_acb_list) != NULL) { |