From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/6] mfd: axp20x: add AXP221 PMIC support
Date: Tue, 27 May 2014 11:05:40 +0100 [thread overview]
Message-ID: <20140527100540.GJ5875@lee--X1> (raw)
In-Reply-To: <1401183535-31003-2-git-send-email-boris.brezillon@free-electrons.com>
> Add support for the AXP221 PMIC device to the existing AXP20x driver.
>
> The AXP221 defines a new set of registers, power supplies and regulators,
> but most of the API is similar to the AXP20x ones.
> The AXP20x irq chip definition is reused, though some interrupts are not
> available in the AXP221.
>
> Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
> ---
> drivers/mfd/axp20x.c | 58 +++++++++++++++++++++++++++++++++++++++++++---
Quite a difference from 237 lines, eh?
> include/linux/mfd/axp20x.h | 56 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 111 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index dee6539..119a7ed 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
[...]
> @@ -190,7 +233,12 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
> axp20x->dev = &i2c->dev;
> dev_set_drvdata(axp20x->dev, axp20x);
>
> - axp20x->regmap = devm_regmap_init_i2c(i2c, &axp20x_regmap_config);
> + if (axp20x->variant == AXP221_ID)
> + axp20x->regmap = devm_regmap_init_i2c(i2c,
> + &axp22x_regmap_config);
> + else
> + axp20x->regmap = devm_regmap_init_i2c(i2c,
> + &axp20x_regmap_config);
Better to put these into a variable and have one instance of
devm_regmap_init_i2c() where you pass said variable as the second
parameter.
> if (IS_ERR(axp20x->regmap)) {
> ret = PTR_ERR(axp20x->regmap);
> dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
> @@ -206,8 +254,12 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
> return ret;
> }
>
> - ret = mfd_add_devices(axp20x->dev, -1, axp20x_cells,
> - ARRAY_SIZE(axp20x_cells), NULL, 0, NULL);
> + if (axp20x->variant == AXP221_ID)
> + ret = mfd_add_devices(axp20x->dev, -1, axp22x_cells,
> + ARRAY_SIZE(axp22x_cells), NULL, 0, NULL);
> + else
> + ret = mfd_add_devices(axp20x->dev, -1, axp20x_cells,
> + ARRAY_SIZE(axp20x_cells), NULL, 0, NULL);
Same here. New variables to carry the cell structure and its size.
As the if statement is the same at the one above, you can move this
all into the first one.
[...]
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2014-05-27 10:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-27 9:38 [PATCH v3 0/6] mfd: axp20x: add AXP221 PMIC support Boris BREZILLON
2014-05-27 9:38 ` [PATCH v3 1/6] " Boris BREZILLON
2014-05-27 10:05 ` Lee Jones [this message]
2014-05-27 10:14 ` Boris BREZILLON
2014-05-27 9:38 ` [PATCH v3 2/6] regulator: axp20x: prepare support for multiple AXP chip families Boris BREZILLON
2014-05-27 9:38 ` [PATCH v3 3/6] regulator: axp20x: add support for AXP221 regulators Boris BREZILLON
2014-05-27 9:38 ` [PATCH v3 4/6] regulator: axp20x: reset probe data before each probe Boris BREZILLON
2014-05-27 9:38 ` [PATCH v3 5/6] regulator: add support for regulator set registration Boris BREZILLON
2014-06-10 13:40 ` Boris BREZILLON
2014-06-16 8:08 ` Lee Jones
2014-06-16 13:24 ` Boris BREZILLON
2014-05-27 9:38 ` [PATCH v3 6/6] regulator: axp20x: make use of devm_regulator_set_register Boris BREZILLON
2014-05-27 19:49 ` [PATCH v3 0/6] mfd: axp20x: add AXP221 PMIC support Mark Brown
[not found] ` <9ed19670-7a2e-4324-a201-6d3c8514bdb3@googlegroups.com>
2014-05-28 17:49 ` Mark Brown
2014-05-28 19:46 ` Boris BREZILLON
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=20140527100540.GJ5875@lee--X1 \
--to=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).