From: Fabio Estevam <festevam@gmail.com>
To: sameo@linux.intel.com
Cc: broonie@opensource.wolfsonmicro.com,
ashish.jangam@kpitcummins.com, dchen@diasemi.com, arnd@arndb.de,
kernel@pengutronix.de, linux-kernel@vger.kernel.org,
Fabio Estevam <fabio.estevam@freescale.com>,
Anton Vorontsov <cbou@mail.ru>
Subject: [PATCH 5/6] power: da9052-battery: Convert to the new da9052 interrupt functions
Date: Thu, 4 Oct 2012 00:15:08 -0300 [thread overview]
Message-ID: <1349320509-26930-5-git-send-email-festevam@gmail.com> (raw)
In-Reply-To: <1349320509-26930-1-git-send-email-festevam@gmail.com>
From: Fabio Estevam <fabio.estevam@freescale.com>
Convert to the new da9052 interrupt functions, so that we can get rid of
irq_base references.
Cc: Anton Vorontsov <cbou@mail.ru>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Build tested only.
drivers/power/da9052-battery.c | 44 +++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 19 deletions(-)
diff --git a/drivers/power/da9052-battery.c b/drivers/power/da9052-battery.c
index d9d034d..73cec97 100644
--- a/drivers/power/da9052-battery.c
+++ b/drivers/power/da9052-battery.c
@@ -440,8 +440,10 @@ static int da9052_bat_check_health(struct da9052_battery *bat, int *health)
static irqreturn_t da9052_bat_irq(int irq, void *data)
{
struct da9052_battery *bat = data;
+ int virq;
- irq -= bat->da9052->irq_base;
+ virq = regmap_irq_get_virq(bat->da9052->irq_data, irq);
+ irq -= virq;
if (irq == DA9052_IRQ_CHGEND)
bat->status = POWER_SUPPLY_STATUS_FULL;
@@ -567,7 +569,7 @@ static struct power_supply template_battery = {
.get_property = da9052_bat_get_property,
};
-static const char *const da9052_bat_irqs[] = {
+static char *da9052_bat_irqs[] = {
"BATT TEMP",
"DCIN DET",
"DCIN REM",
@@ -576,12 +578,20 @@ static const char *const da9052_bat_irqs[] = {
"CHG END",
};
+static int da9052_bat_irq_bits[] = {
+ DA9052_IRQ_TBAT,
+ DA9052_IRQ_DCIN,
+ DA9052_IRQ_DCINREM,
+ DA9052_IRQ_VBUS,
+ DA9052_IRQ_VBUSREM,
+ DA9052_IRQ_CHGEND,
+};
+
static s32 __devinit da9052_bat_probe(struct platform_device *pdev)
{
struct da9052_pdata *pdata;
struct da9052_battery *bat;
int ret;
- int irq;
int i;
bat = kzalloc(sizeof(struct da9052_battery), GFP_KERNEL);
@@ -602,15 +612,14 @@ static s32 __devinit da9052_bat_probe(struct platform_device *pdev)
bat->psy.use_for_apm = 1;
for (i = 0; i < ARRAY_SIZE(da9052_bat_irqs); i++) {
- irq = platform_get_irq_byname(pdev, da9052_bat_irqs[i]);
- ret = request_threaded_irq(bat->da9052->irq_base + irq,
- NULL, da9052_bat_irq,
- IRQF_TRIGGER_LOW | IRQF_ONESHOT,
- da9052_bat_irqs[i], bat);
+ ret = da9052_request_irq(bat->da9052,
+ da9052_bat_irq_bits[i], da9052_bat_irqs[i],
+ da9052_bat_irq, bat);
+
if (ret != 0) {
dev_err(bat->da9052->dev,
- "DA9052 failed to request %s IRQ %d: %d\n",
- da9052_bat_irqs[i], irq, ret);
+ "DA9052 failed to request %s IRQ: %d\n",
+ da9052_bat_irqs[i], ret);
goto err;
}
}
@@ -623,23 +632,20 @@ static s32 __devinit da9052_bat_probe(struct platform_device *pdev)
return 0;
err:
- while (--i >= 0) {
- irq = platform_get_irq_byname(pdev, da9052_bat_irqs[i]);
- free_irq(bat->da9052->irq_base + irq, bat);
- }
+ while (--i >= 0)
+ da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat);
+
kfree(bat);
return ret;
}
static int __devexit da9052_bat_remove(struct platform_device *pdev)
{
int i;
- int irq;
struct da9052_battery *bat = platform_get_drvdata(pdev);
- for (i = 0; i < ARRAY_SIZE(da9052_bat_irqs); i++) {
- irq = platform_get_irq_byname(pdev, da9052_bat_irqs[i]);
- free_irq(bat->da9052->irq_base + irq, bat);
- }
+ for (i = 0; i < ARRAY_SIZE(da9052_bat_irqs); i++)
+ da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat);
+
power_supply_unregister(&bat->psy);
kfree(bat);
--
1.7.9.5
next prev parent reply other threads:[~2012-10-04 3:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-04 3:15 [PATCH 1/6] mfd: da9052-core: Use regmap_irq_get_virq() and fix the probe Fabio Estevam
2012-10-04 3:15 ` [PATCH 2/6] mfd: da9052: Introduce da9052-irq.c Fabio Estevam
2012-10-04 7:12 ` Arnd Bergmann
2012-10-04 11:14 ` Mark Brown
2012-10-04 12:17 ` Arnd Bergmann
2012-10-04 11:25 ` Mark Brown
2012-10-04 3:15 ` [PATCH 3/6] Input: da9052_tsi.c: Fix interrupt handling Fabio Estevam
2012-10-04 3:15 ` Fabio Estevam
2012-10-04 3:15 ` [PATCH 4/6] Input: da9052_onkey.c: Convert to the new da9052 interrupt functions Fabio Estevam
2012-10-04 3:15 ` Fabio Estevam
2012-10-05 18:57 ` Mark Brown
2012-10-04 3:15 ` Fabio Estevam [this message]
2012-10-05 18:58 ` [PATCH 5/6] power: da9052-battery: " Mark Brown
2012-11-18 4:20 ` Anton Vorontsov
2012-11-18 12:30 ` Fabio Estevam
2012-10-04 3:15 ` [PATCH 6/6] gpio: gpio-da9052: " Fabio Estevam
2012-10-04 11:26 ` Mark Brown
2012-10-08 6:20 ` Linus Walleij
2012-10-08 10:40 ` Fabio Estevam
2012-10-09 12:04 ` Linus Walleij
2012-10-09 12:19 ` Fabio Estevam
2012-10-04 11:26 ` [PATCH 1/6] mfd: da9052-core: Use regmap_irq_get_virq() and fix the probe Mark Brown
2012-11-12 16:22 ` Fabio Estevam
2012-11-18 23:44 ` Samuel Ortiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349320509-26930-5-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=arnd@arndb.de \
--cc=ashish.jangam@kpitcummins.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=cbou@mail.ru \
--cc=dchen@diasemi.com \
--cc=fabio.estevam@freescale.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.