aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-davinci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses/i2c-davinci.c')
-rw-r--r--drivers/i2c/busses/i2c-davinci.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 01f0cd87a4a5..0aa1054711af 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -368,8 +368,7 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
368 flag |= DAVINCI_I2C_MDR_STP; 368 flag |= DAVINCI_I2C_MDR_STP;
369 davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); 369 davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
370 370
371 r = wait_for_completion_interruptible_timeout(&dev->cmd_complete, 371 r = wait_for_completion_timeout(&dev->cmd_complete, dev->adapter.timeout);
372 dev->adapter.timeout);
373 if (r == 0) { 372 if (r == 0) {
374 dev_err(dev->dev, "controller timed out\n"); 373 dev_err(dev->dev, "controller timed out\n");
375 davinci_i2c_recover_bus(dev); 374 davinci_i2c_recover_bus(dev);
@@ -380,7 +379,6 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
380 if (dev->buf_len) { 379 if (dev->buf_len) {
381 /* This should be 0 if all bytes were transferred 380 /* This should be 0 if all bytes were transferred
382 * or dev->cmd_err denotes an error. 381 * or dev->cmd_err denotes an error.
383 * A signal may have aborted the transfer.
384 */ 382 */
385 if (r >= 0) { 383 if (r >= 0) {
386 dev_err(dev->dev, "abnormal termination buf_len=%i\n", 384 dev_err(dev->dev, "abnormal termination buf_len=%i\n",
@@ -634,13 +632,17 @@ static int davinci_i2c_probe(struct platform_device *pdev)
634{ 632{
635 struct davinci_i2c_dev *dev; 633 struct davinci_i2c_dev *dev;
636 struct i2c_adapter *adap; 634 struct i2c_adapter *adap;
637 struct resource *mem, *irq; 635 struct resource *mem;
638 int r; 636 int r, irq;
639 637
640 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 638 irq = platform_get_irq(pdev, 0);
641 if (!irq) { 639 if (irq <= 0) {
642 dev_err(&pdev->dev, "no irq resource?\n"); 640 if (!irq)
643 return -ENODEV; 641 irq = -ENXIO;
642 if (irq != -EPROBE_DEFER)
643 dev_err(&pdev->dev,
644 "can't get irq resource ret=%d\n", irq);
645 return irq;
644 } 646 }
645 647
646 dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev), 648 dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev),
@@ -655,7 +657,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
655 init_completion(&dev->xfr_complete); 657 init_completion(&dev->xfr_complete);
656#endif 658#endif
657 dev->dev = &pdev->dev; 659 dev->dev = &pdev->dev;
658 dev->irq = irq->start; 660 dev->irq = irq;
659 dev->pdata = dev_get_platdata(&pdev->dev); 661 dev->pdata = dev_get_platdata(&pdev->dev);
660 platform_set_drvdata(pdev, dev); 662 platform_set_drvdata(pdev, dev);
661 663