[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080103005319.GA714@doriath.ww600.siemens.net>
Date: Thu, 3 Jan 2008 03:53:19 +0300
From: Dmitry Baryshkov <dbaryshkov@...il.com>
To: linux-kernel@...r.kernel.org, cbou@...l.ru, dwmw2@...radead.org
Subject: [PATCH] pda-power: only register available psu
Currently pda-power adds both ac and usb power supply units.
This patch fixes it so that psu are added only if they are enabled.
Signed-off-by: Dmitry Baryshkov <dbaryshkov@...il.com>
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index c058f28..42eac09 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -168,21 +168,14 @@ static int pda_power_probe(struct platform_device *pdev)
pda_power_supplies[1].num_supplicants = pdata->num_supplicants;
}
- ret = power_supply_register(&pdev->dev, &pda_power_supplies[0]);
- if (ret) {
- dev_err(dev, "failed to register %s power supply\n",
- pda_power_supplies[0].name);
- goto supply0_failed;
- }
-
- ret = power_supply_register(&pdev->dev, &pda_power_supplies[1]);
- if (ret) {
- dev_err(dev, "failed to register %s power supply\n",
- pda_power_supplies[1].name);
- goto supply1_failed;
- }
-
if (ac_irq) {
+ ret = power_supply_register(&pdev->dev, &pda_power_supplies[0]);
+ if (ret) {
+ dev_err(dev, "failed to register %s power supply\n",
+ pda_power_supplies[0].name);
+ goto ac_failed;
+ }
+
ret = request_irq(ac_irq->start, power_changed_isr,
get_irq_flags(ac_irq), ac_irq->name,
&pda_power_supplies[0]);
@@ -193,6 +186,13 @@ static int pda_power_probe(struct platform_device *pdev)
}
if (usb_irq) {
+ ret = power_supply_register(&pdev->dev, &pda_power_supplies[1]);
+ if (ret) {
+ dev_err(dev, "failed to register %s power supply\n",
+ pda_power_supplies[1].name);
+ goto usb_failed;
+ }
+
ret = request_irq(usb_irq->start, power_changed_isr,
get_irq_flags(usb_irq), usb_irq->name,
&pda_power_supplies[1]);
@@ -205,13 +205,14 @@ static int pda_power_probe(struct platform_device *pdev)
goto success;
usb_irq_failed:
+ power_supply_unregister(&pda_power_supplies[1]);
+usb_failed:
if (ac_irq)
free_irq(ac_irq->start, &pda_power_supplies[0]);
ac_irq_failed:
- power_supply_unregister(&pda_power_supplies[1]);
-supply1_failed:
- power_supply_unregister(&pda_power_supplies[0]);
-supply0_failed:
+ if (ac_irq)
+ power_supply_unregister(&pda_power_supplies[0]);
+ac_failed:
noirqs:
wrongid:
success:
--
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists