power: max77665-charger: get irq number through platform_get_irq()
Laxman Dewangan [Tue, 16 Apr 2013 10:38:46 +0000 (15:38 +0530)]
Get the max77665 charger submodule interrupt number through
platform_get_irq() rather than getting it through platform data.

bug 1216535

Change-Id: I32314086dbfe3a1a435fcd7012b7cae73d081eb5
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/219790
Reviewed-by: Sivaram Nair <sivaramn@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit

arch/arm/mach-tegra/board-pluto-sensors.c
drivers/power/max77665-charger.c
include/linux/max77665-charger.h

index a46cbb8..4cba496 100644 (file)
@@ -257,7 +257,6 @@ static struct max77665_charger_plat_data max77665_charger = {
        .num_cables = MAX_CABLES,
        .cables = maxim_cable,
        .extcon_name = "tegra-udc",
-       .irq_base = MAX77665_TEGRA_IRQ_BASE,
        .update_status = max17042_update_status,
 };
 
index 574cce6..608f4af 100644 (file)
@@ -66,6 +66,7 @@ static const uint32_t chgin_ilim[] = {
 
 struct max77665_charger {
        struct device           *dev;
+       int                     irq;
        struct power_supply     ac;
        struct power_supply     usb;
        struct max77665_charger_plat_data *plat_data;
@@ -577,22 +578,20 @@ static __devinit int max77665_battery_probe(struct platform_device *pdev)
        if (!charger->edev)
                goto chrg_error;
 
-       if (charger->plat_data->irq_base) {
-               ret = devm_request_threaded_irq(&pdev->dev,
-                       charger->plat_data->irq_base + MAX77665_IRQ_CHARGER,
-                       NULL, max77665_charger_irq_handler,
-                       0, "charger_irq", charger);
-               if (ret) {
-                       dev_err(&pdev->dev,
+       charger->irq = platform_get_irq(pdev, 0);
+       ret = request_threaded_irq(charger->irq, NULL,
+                       max77665_charger_irq_handler, 0, "charger_irq",
+                       charger);
+       if (ret) {
+               dev_err(&pdev->dev,
                                "failed: irq request error :%d)\n", ret);
-                       goto chrg_error;
-               }
+               goto chrg_error;
        }
 
        ret = max77665_enable_charger(charger, charger->edev);
        if (ret < 0) {
                dev_err(charger->dev, "failed to enable charger\n");
-               goto chrg_error;
+               goto free_irq;
        }
 
        wake_lock_init(&charger->wdt_wake_lock, WAKE_LOCK_SUSPEND,
@@ -604,6 +603,8 @@ static __devinit int max77665_battery_probe(struct platform_device *pdev)
 
        return 0;
 
+free_irq:
+       free_irq(charger->irq, charger);
 chrg_error:
        power_supply_unregister(&charger->usb);
 pwr_sply_error:
@@ -616,6 +617,7 @@ static int __devexit max77665_battery_remove(struct platform_device *pdev)
 {
        struct max77665_charger *charger = platform_get_drvdata(pdev);
 
+       free_irq(charger->irq, charger);
        power_supply_unregister(&charger->ac);
        power_supply_unregister(&charger->usb);
 
index 8f19e3b..45225be 100644 (file)
@@ -87,7 +87,6 @@ struct max77665_charger_plat_data {
        uint8_t num_cables;
        struct max77665_charger_cable *cables;
        char *extcon_name;
-       int irq_base;
        void (*update_status)(int);
 };
 #endif