lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 20 Mar 2015 20:23:23 +0100
From:	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
To:	Lee Jones <lee.jones@...aro.org>,
	Samuel Ortiz <sameo@...ux.intel.com>
Cc:	Johan Hovold <johan@...nel.org>,
	Support Opensource <support.opensource@...semi.com>,
	Milo Kim <milo.kim@...com>,
	patches@...nsource.wolfsonmicro.com,
	Fabio Estevam <fabio.estevam@...escale.com>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	linux-kernel@...r.kernel.org, b.zolnierkie@...sung.com
Subject: [PATCH v2 5/5] mfd: da9052: Fix platform device names

Commit 6e3f62f0793e ("mfd: core: Fix platform-device id generation")
changed the way platform device ids are generated from mfd id base and
cell ids in mfd_add_device().  Unfortunately the change in question
breaks mfd drivers which are using mfd_add_devices() with mfd id base
equal to -1 and non-zero cell ids (used to distinguish cells with
the same name field).  The result is that mfd core tries to register
platform devices with the same name which obviously fails and leads
to mfd device probe failure.

Changing mfd_add_devices() mfd id base from -1 to 0 and at the same
time setting proper cell ids for all cells fixes the issue.

In case of da9052 mfd driver the issue has already been fixed by
commit b3f6c73db732 ("mfd: da9052-core: Fix platform-device id
collision").  Unfortunately as the fix makes auto devid generation
to be used for all mfd platform devices it causes unneccessary change
of platform device names.  Fix the driver to use the original names.

Cc: Johan Hovold <johan@...nel.org>
Cc: Fabio Estevam <fabio.estevam@...escale.com>
Cc: Support Opensource <support.opensource@...semi.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
---
 drivers/mfd/da9052-core.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index ae498b5..77d41ad 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,41 +488,48 @@ static const struct mfd_cell da9052_subdev_info[] = {
 		.id = 13,
 	},
 	{
-		.name = "da9052-regulator",
-		.id = 14,
-	},
-	{
 		.name = "da9052-onkey",
+		.id = -1,
 	},
 	{
 		.name = "da9052-rtc",
+		.id = -1,
 	},
 	{
 		.name = "da9052-gpio",
+		.id = -1,
 	},
 	{
 		.name = "da9052-hwmon",
+		.id = -1,
 	},
 	{
 		.name = "da9052-leds",
+		.id = -1,
 	},
 	{
 		.name = "da9052-wled1",
+		.id = -1,
 	},
 	{
 		.name = "da9052-wled2",
+		.id = -1,
 	},
 	{
 		.name = "da9052-wled3",
+		.id = -1,
 	},
 	{
 		.name = "da9052-tsi",
+		.id = -1,
 	},
 	{
 		.name = "da9052-bat",
+		.id = -1,
 	},
 	{
 		.name = "da9052-watchdog",
+		.id = -1,
 	},
 };
 
@@ -554,7 +565,7 @@ int da9052_device_init(struct da9052 *da9052, u8 chip_id)
 		return ret;
 	}
 
-	ret = mfd_add_devices(da9052->dev, PLATFORM_DEVID_AUTO,
+	ret = mfd_add_devices(da9052->dev, 0,
 			      da9052_subdev_info,
 			      ARRAY_SIZE(da9052_subdev_info), NULL, 0, NULL);
 	if (ret) {
-- 
1.8.2.3

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ