diff options
Diffstat (limited to 'drivers/mfd/twl6040-core.c')
-rw-r--r-- | drivers/mfd/twl6040-core.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c index 471f4895fb90..f71bb147d11c 100644 --- a/drivers/mfd/twl6040-core.c +++ b/drivers/mfd/twl6040-core.c | |||
@@ -459,6 +459,12 @@ static int __devinit twl6040_probe(struct platform_device *pdev) | |||
459 | return -EINVAL; | 459 | return -EINVAL; |
460 | } | 460 | } |
461 | 461 | ||
462 | /* In order to operate correctly we need valid interrupt config */ | ||
463 | if (!pdata->naudint_irq || !pdata->irq_base) { | ||
464 | dev_err(&pdev->dev, "Invalid IRQ configuration\n"); | ||
465 | return -EINVAL; | ||
466 | } | ||
467 | |||
462 | twl6040 = kzalloc(sizeof(struct twl6040), GFP_KERNEL); | 468 | twl6040 = kzalloc(sizeof(struct twl6040), GFP_KERNEL); |
463 | if (!twl6040) | 469 | if (!twl6040) |
464 | return -ENOMEM; | 470 | return -ENOMEM; |
@@ -491,20 +497,18 @@ static int __devinit twl6040_probe(struct platform_device *pdev) | |||
491 | if (twl6040->rev == TWL6040_REV_ES1_0) | 497 | if (twl6040->rev == TWL6040_REV_ES1_0) |
492 | twl6040->audpwron = -EINVAL; | 498 | twl6040->audpwron = -EINVAL; |
493 | 499 | ||
494 | if (twl6040->irq) { | 500 | /* codec interrupt */ |
495 | /* codec interrupt */ | 501 | ret = twl6040_irq_init(twl6040); |
496 | ret = twl6040_irq_init(twl6040); | 502 | if (ret) |
497 | if (ret) | 503 | goto gpio2_err; |
498 | goto gpio2_err; | 504 | |
499 | 505 | ret = twl6040_request_irq(twl6040, TWL6040_IRQ_READY, | |
500 | ret = twl6040_request_irq(twl6040, TWL6040_IRQ_READY, | 506 | twl6040_naudint_handler, 0, |
501 | twl6040_naudint_handler, 0, | 507 | "twl6040_irq_ready", twl6040); |
502 | "twl6040_irq_ready", twl6040); | 508 | if (ret) { |
503 | if (ret) { | 509 | dev_err(twl6040->dev, "READY IRQ request failed: %d\n", |
504 | dev_err(twl6040->dev, "READY IRQ request failed: %d\n", | 510 | ret); |
505 | ret); | 511 | goto irq_err; |
506 | goto irq_err; | ||
507 | } | ||
508 | } | 512 | } |
509 | 513 | ||
510 | /* dual-access registers controlled by I2C only */ | 514 | /* dual-access registers controlled by I2C only */ |
@@ -553,11 +557,9 @@ static int __devinit twl6040_probe(struct platform_device *pdev) | |||
553 | return 0; | 557 | return 0; |
554 | 558 | ||
555 | mfd_err: | 559 | mfd_err: |
556 | if (twl6040->irq) | 560 | twl6040_free_irq(twl6040, TWL6040_IRQ_READY, twl6040); |
557 | twl6040_free_irq(twl6040, TWL6040_IRQ_READY, twl6040); | ||
558 | irq_err: | 561 | irq_err: |
559 | if (twl6040->irq) | 562 | twl6040_irq_exit(twl6040); |
560 | twl6040_irq_exit(twl6040); | ||
561 | gpio2_err: | 563 | gpio2_err: |
562 | if (gpio_is_valid(twl6040->audpwron)) | 564 | if (gpio_is_valid(twl6040->audpwron)) |
563 | gpio_free(twl6040->audpwron); | 565 | gpio_free(twl6040->audpwron); |
@@ -579,9 +581,7 @@ static int __devexit twl6040_remove(struct platform_device *pdev) | |||
579 | gpio_free(twl6040->audpwron); | 581 | gpio_free(twl6040->audpwron); |
580 | 582 | ||
581 | twl6040_free_irq(twl6040, TWL6040_IRQ_READY, twl6040); | 583 | twl6040_free_irq(twl6040, TWL6040_IRQ_READY, twl6040); |
582 | 584 | twl6040_irq_exit(twl6040); | |
583 | if (twl6040->irq) | ||
584 | twl6040_irq_exit(twl6040); | ||
585 | 585 | ||
586 | mfd_remove_devices(&pdev->dev); | 586 | mfd_remove_devices(&pdev->dev); |
587 | platform_set_drvdata(pdev, NULL); | 587 | platform_set_drvdata(pdev, NULL); |