From: Mark Brown <broonie@kernel.org>
To: James Ban <james.ban.opensource@diasemi.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Support Opensource <support.opensource@diasemi.com>,
LKML <linux-kernel@vger.kernel.org>,
David Dajun Chen <david.chen@diasemi.com>
Subject: Re: [PATCH V4] regulator: DA9211 : new regulator driver
Date: Tue, 8 Jul 2014 09:36:19 +0200 [thread overview]
Message-ID: <20140708073619.GO30458@sirena.org.uk> (raw)
In-Reply-To: <201407030730.s637UuCh011846@krsrvapps-01.diasemi.com>
[-- Attachment #1: Type: text/plain, Size: 1677 bytes --]
On Thu, Jul 03, 2014 at 04:29:03PM +0900, James Ban wrote:
This is greatly improved, thanks, however there are still a few issues
which should be addressed:
> +static irqreturn_t da9211_irq_handler(int irq, void *data)
> +{
> + struct da9211 *chip = data;
> + int reg_val, ret;
> +
> + ret = regmap_read(chip->regmap, DA9211_REG_EVENT_B, ®_val);
> + if (ret < 0)
> + goto error_i2c;
> +
> + if (reg_val & DA9211_E_OV_CURR_A) {
> + if (reg_val & DA9211_E_OV_CURR_B) {
> +
> + return IRQ_HANDLED;
This is buggy - the driver should only return IRQ_HANDLED if it handled
the interrupt somehow, otherwise it should return IRQ_NONE and let the
interrupt core handle things. This is especially important since the
device appears to require that interrupts are explicitly acknoweldged so
if something is flagged but not handled the interrupt will just sit
constantly asserted.
> +static int da9211_regulator_init(struct da9211 *chip)
> +{
> + struct regulator_config config = { };
> + int i, ret;
> + unsigned int data;
> +
> + ret = regmap_update_bits(chip->regmap, DA9211_REG_PAGE_CON,
> + DA9211_REG_PAGE_MASK, DA9211_REG_PAGE2);
> + if (ret < 0) {
> + dev_err(chip->dev, "Failed to update PAGE reg: %d\n", ret);
> + goto err;
> + }
It would be better to model the paging in the register map in the regmap
- the API has support for this, it's going to be more robust to use it.
> + dev_info(chip->dev, "# IRQ configured [%d]\n", chip->chip_irq);
> + for (i = 0; i < chip->num_regulator; i++)
> + regulator_unregister(chip->rdev[i]);
Use devm_regulator_register().
> + if (chip->chip_irq != 0)
> + free_irq(chip->chip_irq, chip);
devm_request_threaded_irq().
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-07-08 8:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-03 7:29 James Ban
2014-07-08 7:36 ` Mark Brown [this message]
2014-07-09 1:06 James Ban
2014-07-09 8:28 James Ban
2014-07-09 8:38 ` Mark Brown
2014-07-09 8:57 James Ban
2014-07-09 9:15 ` Mark Brown
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=20140708073619.GO30458@sirena.org.uk \
--to=broonie@kernel.org \
--cc=david.chen@diasemi.com \
--cc=james.ban.opensource@diasemi.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=support.opensource@diasemi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome