All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Mark Brown <broonie@kernel.org>, Lee Jones <lee.jones@linaro.org>
Cc: Support Opensource <support.opensource@diasemi.com>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Milo Kim <milo.kim@ti.com>,
	patches@opensource.wolfsonmicro.com,
	Fabio Estevam <fabio.estevam@freescale.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Johan Hovold <johan@kernel.org>, stable <stable@vger.kernel.org>
Subject: [PATCH RESEND] mfd: da9052: fix broken regulator probe
Date: Fri, 15 May 2015 16:27:40 +0200	[thread overview]
Message-ID: <1431700060-6778-1-git-send-email-johan@kernel.org> (raw)
In-Reply-To: <20150513154333.GB19543@x1>

Fix broken probe of da9052 regulators, which since commit b3f6c73db732
("mfd: da9052-core: Fix platform-device id collision") use a
non-deterministic platform-device id to retrieve static regulator
information. Fortunately, adequate error handling was in place so probe
would simply fail with an error message.

Update the mfd-cell ids to be zero-based and use those to identify the
cells when probing the regulator devices.

Fixes: b3f6c73db732 ("mfd: da9052-core: Fix platform-device id collision")
Cc: stable <stable@vger.kernel.org>	# v3.19
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
---

Resending per Lee's request to get an ack from Mark Brown.

Johan


 drivers/mfd/da9052-core.c            | 8 ++++----
 drivers/regulator/da9052-regulator.c | 5 +++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index ae498b53ee40..46e3840c7a37 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -433,6 +433,10 @@ EXPORT_SYMBOL_GPL(da9052_adc_read_temp);
 static const struct mfd_cell da9052_subdev_info[] = {
 	{
 		.name = "da9052-regulator",
+		.id = 0,
+	},
+	{
+		.name = "da9052-regulator",
 		.id = 1,
 	},
 	{
@@ -484,10 +488,6 @@ static const struct mfd_cell da9052_subdev_info[] = {
 		.id = 13,
 	},
 	{
-		.name = "da9052-regulator",
-		.id = 14,
-	},
-	{
 		.name = "da9052-onkey",
 	},
 	{
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c
index 8a4df7a1f2ee..e628d4c2f2ae 100644
--- a/drivers/regulator/da9052-regulator.c
+++ b/drivers/regulator/da9052-regulator.c
@@ -394,6 +394,7 @@ static inline struct da9052_regulator_info *find_regulator_info(u8 chip_id,
 
 static int da9052_regulator_probe(struct platform_device *pdev)
 {
+	const struct mfd_cell *cell = mfd_get_cell(pdev);
 	struct regulator_config config = { };
 	struct da9052_regulator *regulator;
 	struct da9052 *da9052;
@@ -409,7 +410,7 @@ static int da9052_regulator_probe(struct platform_device *pdev)
 	regulator->da9052 = da9052;
 
 	regulator->info = find_regulator_info(regulator->da9052->chip_id,
-					      pdev->id);
+					      cell->id);
 	if (regulator->info == NULL) {
 		dev_err(&pdev->dev, "invalid regulator ID specified\n");
 		return -EINVAL;
@@ -419,7 +420,7 @@ static int da9052_regulator_probe(struct platform_device *pdev)
 	config.driver_data = regulator;
 	config.regmap = da9052->regmap;
 	if (pdata && pdata->regulators) {
-		config.init_data = pdata->regulators[pdev->id];
+		config.init_data = pdata->regulators[cell->id];
 	} else {
 #ifdef CONFIG_OF
 		struct device_node *nproot = da9052->dev->of_node;
-- 
2.3.6


  parent reply	other threads:[~2015-05-15 14:28 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 19:23 [PATCH v2 0/5] mfd: Fix platform device ids to avoid probe failure Bartlomiej Zolnierkiewicz
2015-03-20 19:23 ` [PATCH v2 1/5] mfd: max8997: " Bartlomiej Zolnierkiewicz
2015-03-20 19:23 ` [PATCH v2 2/5] mfd: da9055: " Bartlomiej Zolnierkiewicz
2015-03-20 19:23 ` [PATCH v2 3/5] mfd: lp8788: " Bartlomiej Zolnierkiewicz
2015-03-20 19:23 ` [PATCH v2 4/5] mfd: wm831x: " Bartlomiej Zolnierkiewicz
2015-03-20 19:23 ` [PATCH v2 5/5] mfd: da9052: Fix platform device names Bartlomiej Zolnierkiewicz
2015-03-23 10:07 ` [PATCH v2 0/5] mfd: Fix platform device ids to avoid probe failure Johan Hovold
2015-03-23 13:11   ` Bartlomiej Zolnierkiewicz
2015-03-25 11:02     ` Johan Hovold
2015-03-25 11:07       ` [PATCH 1/2] mfd: da9052: fix broken regulator probe Johan Hovold
2015-03-25 11:07         ` [PATCH 2/2] mfd: core: fix platform-device name collisions Johan Hovold
2015-03-25 12:02           ` Bartlomiej Zolnierkiewicz
2015-03-26  8:34           ` Lee Jones
2015-03-25 12:01         ` [PATCH 1/2] mfd: da9052: fix broken regulator probe Bartlomiej Zolnierkiewicz
2015-03-26  8:32         ` Lee Jones
2015-04-14 13:04           ` Johan Hovold
2015-04-29  7:44             ` Johan Hovold
2015-04-29  8:41               ` Lee Jones
2015-05-13 15:43                 ` Lee Jones
2015-05-13 16:08                   ` Mark Brown
2015-05-13 16:54                     ` Lee Jones
2015-05-13 17:29                       ` Mark Brown
2015-05-14  7:19                         ` Lee Jones
2015-05-15 14:47                           ` Johan Hovold
2015-05-18  9:10                             ` Lee Jones
2015-05-18  9:51                               ` Johan Hovold
2015-05-18 10:13                                 ` Lee Jones
2015-05-18 16:28                                   ` Mark Brown
2015-05-18 16:24                                 ` Mark Brown
2015-05-18 16:46                                   ` Johan Hovold
2015-05-18 18:46                                     ` Mark Brown
2015-05-19 10:01                                       ` Johan Hovold
2015-05-19 10:38                                         ` Mark Brown
2015-05-19 11:01                                           ` Johan Hovold
2015-05-19 12:01                                             ` Mark Brown
2015-05-15 14:27                   ` Johan Hovold [this message]
2015-05-18 18:47                     ` [PATCH RESEND] " Mark Brown
2015-05-18 18:57                     ` Lee Jones
2015-03-30  7:18         ` [PATCH 1/2] " Lee Jones
2015-03-25 12:04       ` [PATCH v2 0/5] mfd: Fix platform device ids to avoid probe failure Bartlomiej Zolnierkiewicz

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=1431700060-6778-1-git-send-email-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=broonie@kernel.org \
    --cc=fabio.estevam@freescale.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=milo.kim@ti.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=sameo@linux.intel.com \
    --cc=stable@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 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.