Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4704225rwb; Mon, 31 Jul 2023 10:48:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlH3YcDk6sRlyOXyNOSy1K1AV+jCi1lOXBCwYtpOcYmrbnuoHtLa9xnrVBHGkovG235x2VoR X-Received: by 2002:a17:907:d86:b0:98d:f2c9:a1eb with SMTP id go6-20020a1709070d8600b0098df2c9a1ebmr612719ejc.24.1690825737219; Mon, 31 Jul 2023 10:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690825737; cv=none; d=google.com; s=arc-20160816; b=QhYcrUZmLwHGVyq8RlOTO2/Piq8HQmnToDp+ybMBufMICxwktgrLXLhT5PRf9f9M1T zSrmoll/pfcJWSs5mIK1p+ibTJ+RyGTYmBmIua7lk9IRzJPVUfXpufdeWsNFKKwIPiOb KbpSq0aK1OP8S4JXA5E2X8MHGOc1jAY7AI0K9mCO+1uFPSeTWvf7guk+B/5eMf4cjXe3 52dUH6saXaDGtVchhCenpf8vZeEjIPzT6rLHMQOk0GcUIP4rSIkJJ5fxejQJEeWas01Q C09BC/iYIxUYE07cZXwQ9LcMtisEAja1A/pKHrQM2jOsJngE0pIYIsMjj9BLNke4vVlT 8rVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=dtnsSgdIFE3nvfrIp3Ekkqlk6qi/iH176UsC3eyjzqg=; fh=Go6s0/zEioE94Bii1B2MjFgm3MHKzhuRUVtc8xQ8xkM=; b=ht12VBOx1bICW7nnWcCVduJMnhsIfmccfRsO3Q4VphO+l5E79TYQkjr/AnAeU23vvQ 8w+9Dh54gYrfuWWMrx5X3+AEMJaQVyMLjT2q6Igo8LZ4FnTDEIu8nWXwUWFhVujqbf84 XX0zN6JeVJP6fTVxaphb5ncdlisosvZjUK+WEf4EOgPfXd8DT+ou5nRArTgKwqpti1OM dhs5S2NXjMkDknONpqi+hZu4+ThguwZCZUN0KYdj89L+mPMowSu2l3mixY9BMq6Wo3Td KeRX5Mxi/F8j6fWZtmMG1qra27NplL8Iezsfyy66bWD1DeW1NnHJZFz3MiB/EAe7Doi4 bJjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="QUFctZO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u20-20020a1709060b1400b0099bc98ccef6si6713455ejg.446.2023.07.31.10.48.31; Mon, 31 Jul 2023 10:48:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="QUFctZO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232570AbjGaQGO (ORCPT + 99 others); Mon, 31 Jul 2023 12:06:14 -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 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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