From nobody Thu Nov 28 02:45:58 2024 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 010FD14267; Mon, 7 Oct 2024 00:14:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728260098; cv=none; b=dNub63l9OrjPePo1Dscpk+bjJwbrL+FqQbJWpKxoC4IBzQn8ciitPjkM12/Z+py9/rYmE7UdXRKEn0nJHIcVXbnlUnf8FWWRSmyDsh1i6S815cRVK4DsG1+Aa+zmmzAmHTUqCg8EJi/xYAf1vwy4fR2INA0B9RBDtzIb42/ZlCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728260098; c=relaxed/simple; bh=3EAE5Wl4zK8cef/TNe/paFWhmOnSq1SzHQhGAN0cUSM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lbdcnsq/bpDqj0MqRsfRhJADf240WHre+uzpMAXl3Vh6AXSVpxyA89ChbMeN4hMDFj4tct5EhlhyswkgvM1KzENW9bxS0912gi65JTVqjEIZc761h7hBxQ9/WMAFtgdMWn0MHbzB/B23r2AfYyDW8HoODJgEGH8lgYoxg+l8nds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 06C131007; Sun, 6 Oct 2024 17:15:26 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C364D3F640; Sun, 6 Oct 2024 17:14:54 -0700 (PDT) From: Andre Przywara To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Liam Girdwood , Mark Brown Cc: devicetree@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Botka , Chris Morgan Subject: [PATCH v2 3/5] mfd: axp20x: Allow multiple regulators Date: Mon, 7 Oct 2024 01:14:06 +0100 Message-ID: <20241007001408.27249-4-andre.przywara@arm.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241007001408.27249-1-andre.przywara@arm.com> References: <20241007001408.27249-1-andre.przywara@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" At the moment trying to register a second AXP chip makes the probe fail, as some sysfs registration fails due to a duplicate name: ... [ 3.688215] axp20x-i2c 0-0035: AXP20X driver loaded [ 3.695610] axp20x-i2c 0-0036: AXP20x variant AXP323 found [ 3.706151] sysfs: cannot create duplicate filename '/bus/platform/devic= es/axp20x-regulator' [ 3.714718] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc1-= 00026-g50bf2e2c079d-dirty #192 [ 3.724020] Hardware name: Avaota A1 (DT) [ 3.728029] Call trace: [ 3.730477] dump_backtrace+0x94/0xec [ 3.734146] show_stack+0x18/0x24 [ 3.737462] dump_stack_lvl+0x80/0xf4 [ 3.741128] dump_stack+0x18/0x24 [ 3.744444] sysfs_warn_dup+0x64/0x80 [ 3.748109] sysfs_do_create_link_sd+0xf0/0xf8 [ 3.752553] sysfs_create_link+0x20/0x40 [ 3.756476] bus_add_device+0x64/0x104 [ 3.760229] device_add+0x310/0x760 [ 3.763717] platform_device_add+0x10c/0x238 [ 3.767990] mfd_add_device+0x4ec/0x5c8 [ 3.771829] mfd_add_devices+0x88/0x11c [ 3.775666] axp20x_device_probe+0x70/0x184 [ 3.779851] axp20x_i2c_probe+0x9c/0xd8 ... This is because we use PLATFORM_DEVID_NONE for the mfd_add_devices() call, which would number the child devices in the same 0-based way, even for the second (or any other) instance. Use PLATFORM_DEVID_AUTO instead, which automatically assigns non-conflicting device numbers. Signed-off-by: Andre Przywara Reviewed-by: Chen-Yu Tsai --- drivers/mfd/axp20x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 5ceea359289f4..bc08ae4332604 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -1419,7 +1419,7 @@ int axp20x_device_probe(struct axp20x_dev *axp20x) } } =20 - ret =3D mfd_add_devices(axp20x->dev, -1, axp20x->cells, + ret =3D mfd_add_devices(axp20x->dev, PLATFORM_DEVID_AUTO, axp20x->cells, axp20x->nr_cells, NULL, 0, NULL); =20 if (ret) { --=20 2.46.2