aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/pcf50633-core.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index f109551eeda..03dcc920070 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -553,9 +553,14 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
553{ 553{
554 struct pcf50633 *pcf; 554 struct pcf50633 *pcf;
555 struct pcf50633_platform_data *pdata = client->dev.platform_data; 555 struct pcf50633_platform_data *pdata = client->dev.platform_data;
556 int i, ret = 0; 556 int i, ret;
557 int version, variant; 557 int version, variant;
558 558
559 if (!client->irq) {
560 dev_err(&client->dev, "Missing IRQ\n");
561 return -ENOENT;
562 }
563
559 pcf = kzalloc(sizeof(*pcf), GFP_KERNEL); 564 pcf = kzalloc(sizeof(*pcf), GFP_KERNEL);
560 if (!pcf) 565 if (!pcf)
561 return -ENOMEM; 566 return -ENOMEM;
@@ -570,6 +575,12 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
570 pcf->irq = client->irq; 575 pcf->irq = client->irq;
571 pcf->work_queue = create_singlethread_workqueue("pcf50633"); 576 pcf->work_queue = create_singlethread_workqueue("pcf50633");
572 577
578 if (!pcf->work_queue) {
579 dev_err(&client->dev, "Failed to alloc workqueue\n");
580 ret = -ENOMEM;
581 goto err_free;
582 }
583
573 INIT_WORK(&pcf->irq_work, pcf50633_irq_worker); 584 INIT_WORK(&pcf->irq_work, pcf50633_irq_worker);
574 585
575 version = pcf50633_reg_read(pcf, 0); 586 version = pcf50633_reg_read(pcf, 0);
@@ -577,7 +588,7 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
577 if (version < 0 || variant < 0) { 588 if (version < 0 || variant < 0) {
578 dev_err(pcf->dev, "Unable to probe pcf50633\n"); 589 dev_err(pcf->dev, "Unable to probe pcf50633\n");
579 ret = -ENODEV; 590 ret = -ENODEV;
580 goto err; 591 goto err_destroy_workqueue;
581 } 592 }
582 593
583 dev_info(pcf->dev, "Probed device version %d variant %d\n", 594 dev_info(pcf->dev, "Probed device version %d variant %d\n",
@@ -591,6 +602,14 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
591 pcf50633_reg_write(pcf, PCF50633_REG_INT4M, 0x00); 602 pcf50633_reg_write(pcf, PCF50633_REG_INT4M, 0x00);
592 pcf50633_reg_write(pcf, PCF50633_REG_INT5M, 0x00); 603 pcf50633_reg_write(pcf, PCF50633_REG_INT5M, 0x00);
593 604
605 ret = request_irq(client->irq, pcf50633_irq,
606 IRQF_TRIGGER_LOW, "pcf50633", pcf);
607
608 if (ret) {
609 dev_err(pcf->dev, "Failed to request IRQ %d\n", ret);
610 goto err_destroy_workqueue;
611 }
612
594 /* Create sub devices */ 613 /* Create sub devices */
595 pcf50633_client_dev_register(pcf, "pcf50633-input", 614 pcf50633_client_dev_register(pcf, "pcf50633-input",
596 &pcf->input_pdev); 615 &pcf->input_pdev);
@@ -606,7 +625,7 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
606 625
607 pdev = platform_device_alloc("pcf50633-regltr", i); 626 pdev = platform_device_alloc("pcf50633-regltr", i);
608 if (!pdev) { 627 if (!pdev) {
609 dev_err(pcf->dev, "Cannot create regulator\n"); 628 dev_err(pcf->dev, "Cannot create regulator %d\n", i);
610 continue; 629 continue;
611 } 630 }
612 631
@@ -618,19 +637,6 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
618 platform_device_add(pdev); 637 platform_device_add(pdev);
619 } 638 }
620 639
621 if (client->irq) {
622 ret = request_irq(client->irq, pcf50633_irq,
623 IRQF_TRIGGER_LOW, "pcf50633", pcf);
624
625 if (ret) {
626 dev_err(pcf->dev, "Failed to request IRQ %d\n", ret);
627 goto err;
628 }
629 } else {
630 dev_err(pcf->dev, "No IRQ configured\n");
631 goto err;
632 }
633
634 if (enable_irq_wake(client->irq) < 0) 640 if (enable_irq_wake(client->irq) < 0)
635 dev_err(pcf->dev, "IRQ %u cannot be enabled as wake-up source" 641 dev_err(pcf->dev, "IRQ %u cannot be enabled as wake-up source"
636 "in this hardware revision", client->irq); 642 "in this hardware revision", client->irq);
@@ -644,9 +650,12 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
644 650
645 return 0; 651 return 0;
646 652
647err: 653err_destroy_workqueue:
648 destroy_workqueue(pcf->work_queue); 654 destroy_workqueue(pcf->work_queue);
655err_free:
656 i2c_set_clientdata(client, NULL);
649 kfree(pcf); 657 kfree(pcf);
658
650 return ret; 659 return ret;
651} 660}
652 661