From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 253B3C001DC for ; Mon, 31 Jul 2023 16:06:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232951AbjGaQGP (ORCPT ); Mon, 31 Jul 2023 12:06:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229775AbjGaQGK (ORCPT ); Mon, 31 Jul 2023 12:06:10 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 930D01BCC for ; Mon, 31 Jul 2023 09:05:46 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id AE15BE0007; Mon, 31 Jul 2023 16:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1690819534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dtnsSgdIFE3nvfrIp3Ekkqlk6qi/iH176UsC3eyjzqg=; b=QUFctZO/yKZIYSNQ0gF/bVbyEHezEI17EEZ0xAXGfnssmzBT3jwsKL0AzYllZzGNPGTpzT vIT/VPj7kr+U57pzZdtO6+Vw2U+1PR8JrLWU9rPL9Cc4SYSay2wcAeBJAD2TRCcsJVqzo9 gPsKjVWKHYB+xcArjuOENzaG/8Tcwfe6srhxYORKTCqGaT58w9jSMKNRHg+/9ug5e05X9n B57A2ybRCkuz98R5oOC8CduSJeyHnBCwnMyq+2Wt3v5PdYuFnknPBaGYvLNVpHuxRBWEae mhQPAH/jqjw3T1MvACS1EBFjdkV3Tlsgb8me7rxf1mHQODoM9w7vJ/U+YA7i7w== Date: Mon, 31 Jul 2023 18:05:31 +0200 From: Miquel Raynal To: Chen-Yu Tsai Cc: Srinivas Kandagatla , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Thomas Petazzoni , Robert Marko , Luka Perkov , Michael Walle , Randy Dunlap Subject: Re: [PATCH v6 3/3] nvmem: core: Expose cells through sysfs Message-ID: <20230731180531.7c616b3b@xps-13> In-Reply-To: <20230718102617.GA982837@google.com> References: <20230717075147.43326-1-miquel.raynal@bootlin.com> <20230717075147.43326-4-miquel.raynal@bootlin.com> <20230718102617.GA982837@google.com> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chen-Yu, > > static int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem, > > @@ -1006,6 +1101,12 @@ struct nvmem_device *nvmem_register(const struct= nvmem_config *config) > > if (rval) > > goto err_remove_cells; > > =20 > > +#ifdef CONFIG_NVMEM_SYSFS > > + rval =3D nvmem_populate_sysfs_cells(nvmem); > > + if (rval) > > + goto err_remove_cells; =20 >=20 > This breaks nvmem / efuse devices with multiple cells that share the > same name. Something like this in DT: >=20 > efuse: efuse@11f10000 { > compatible =3D "mediatek,mt8183-efuse", > "mediatek,efuse"; > reg =3D <0 0x11f10000 0 0x1000>; > #address-cells =3D <1>; > #size-cells =3D <1>; > thermal_calibration: calib@180 { > reg =3D <0x180 0xc>; > }; >=20 > mipi_tx_calibration: calib@190 { > reg =3D <0x190 0xc>; > }; >=20 > svs_calibration: calib@580 { > reg =3D <0x580 0x64>; > }; > }; >=20 > creates three cells, all named DT, and sysfs will complain: >=20 > sysfs: cannot create duplicate filename '/devices/platform/soc/11f100= 00.efuse/nvmem1/cells/calib' > mediatek,efuse: probe of 11f10000.efuse failed with error -17 >=20 > This causes the MT8183-based Chromebooks to lose display capability, > among other things. Sorry for the breakage, I did not identify this case, but you're right this is incorrectly handled currently. > The problem lies in the nvmem DT parsing code, where the cell name is > derived from the node name, without including the address portion. > However I'm not sure we can change that, since it could be considered > ABI? I would be in favor suffixing the cell names anyway as they have not been exposed yet to userspace at all (well, not more than a couple of days in -next). Thanks, Miqu=C3=A8l