[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <201407090857.s698vu4m031984@krsrvapps-01.diasemi.com>
Date: Wed, 9 Jul 2014 17:57:56 +0900
From: James Ban <james.ban.opensource@...semi.com>
To: Mark Brown <broonie@...nel.org>
CC: Liam Girdwood <lgirdwood@...il.com>,
Support Opensource <support.opensource@...semi.com>,
LKML <linux-kernel@...r.kernel.org>,
"David Dajun Chen" <david.chen@...semi.com>
Subject: Re: [PATCH V4] regulator: DA9211 : new regulator driver
> -----Original Message-----
> From: Mark Brown [mailto:broonie@...nel.org]
> Sent: Wednesday, July 09, 2014 5:39 PM
> To: Opensource [James Seong-Won Ban]
> Cc: Liam Girdwood; Support Opensource; LKML; David Dajun Chen
> Subject: Re: [PATCH V4] regulator: DA9211 : new regulator driver
>
> On Wed, Jul 09, 2014 at 05:28:59PM +0900, James Ban wrote:
>
> > How about below code for proper handle of interrupt?
>
> That's fine, or you could have a return value which defaults to IRQ_NONE and
> then set it to IRQ_HANDLED when you handle a particular bit - that is more
> common since that way if multiple things happen to flag simultaneously they
> can be handled in one call to the interrupt handler.
Thanks for your comment. Is below code O.K.?
static irqreturn_t da9211_irq_handler(int irq, void *data)
{
struct da9211 *chip = data;
int reg_val, err, ret = IRQ_NONE;
err = regmap_read(chip->regmap, DA9211_REG_EVENT_B, ®_val);
if (err < 0)
goto error_i2c;
if (reg_val & DA9211_E_OV_CURR_A) {
regulator_notifier_call_chain(chip->rdev[0],
REGULATOR_EVENT_OVER_CURRENT,
rdev_get_drvdata(chip->rdev[0]));
err = regmap_write(chip->regmap, DA9211_REG_EVENT_B,
DA9211_E_OV_CURR_A);
if (err < 0)
goto error_i2c;
ret = IRQ_HANDLED;
}
if (reg_val & DA9211_E_OV_CURR_B) {
regulator_notifier_call_chain(chip->rdev[1],
REGULATOR_EVENT_OVER_CURRENT,
rdev_get_drvdata(chip->rdev[1]));
err = regmap_write(chip->regmap, DA9211_REG_EVENT_B,
DA9211_E_OV_CURR_B);
if (err < 0)
goto error_i2c;
ret = IRQ_HANDLED;
}
return ret;
error_i2c:
dev_err(chip->dev, "I2C error : %d\n", err);
return IRQ_NONE;
}
--
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