Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4657354rwb; Mon, 31 Jul 2023 10:05:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlHIusPOzhn9Jn7vfkkvdN8iRZN6ku4ZI9oQZHhNWVhgaQ4dicUtClUwQ4qdTb4O8ahFVd+G X-Received: by 2002:a05:6a20:9151:b0:13b:9cf1:a779 with SMTP id x17-20020a056a20915100b0013b9cf1a779mr12496031pzc.37.1690823105605; Mon, 31 Jul 2023 10:05:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690823105; cv=none; d=google.com; s=arc-20160816; b=HuFDjprj/TWm18WQll2o4CRGycks4LbnEUQoH/1CxZv9d0gIs+OS2wyclfb+LrmW0D u2JrSiwCUjWXAh3wBNxlmzjrC19tIP72xEKRq/NsP94UClXmEaAnxHORmXOZ0SR+Qpyc J90I/H02azfwZMarHWwLzICJd6XKEi2+SS0tdvPikjYXHi8ZkGzNN5GR8NdmDLE3vFEw 9muTydtUllG2P/dtCKJZcEu6jaIR5HfLy4Ysql+KYPL7Jj3FuODXy7LwQkMDKdUKfBLz e3ENNOsXTA/w6cFbgCw7DOsaVwHNSSGy7lkpAQl5fH6/8kDp1Inwjht2Aa/EQ0TAzCV8 uhvQ== 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=2FSIAqeOuayaaKRncvVUn+1XDuP+hp1ypNaupfCM5SM=; fh=n3Y+56vncth7Qd07pei9VET1fvYV1MiZ8gDqhpiryLA=; b=kSzQ5wWjnZeYPbXDtIQAamgPnSzCmf6JjQf/R6BMYuWgHdsHadOJVpKkxw8QLjyuZL qcYLinyMgXpfxeOrWx4hYXvJEVRCjYOw4YTLCPUO1uGAv7jORQ8c5hCH1IE+NpYvtak8 UURyd+2+xRMDXbKsfD985Nq9S/VCDjczC+Y6jJNW0WAEKi/VG+ZM5SjN3lg1kXd1/eu+ Qo3ZDHEtlxuVSUitpn9XShfl/GnBr78TUM8z8hAapHFaoYlVr6ALhgtbQLDWQs8iLt+k HhIvp48aGNa0aLYdxhLhuD1VVFHQJd7OwdBEIB8ZtYEepxV3th+Efykpszpj/js8xXmD Mgmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=fcgKkc8x; 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 f5-20020a635545000000b0056399efdbdcsi7325429pgm.846.2023.07.31.10.04.51; Mon, 31 Jul 2023 10:05:05 -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=fcgKkc8x; 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 S231742AbjGaPpN (ORCPT + 99 others); Mon, 31 Jul 2023 11:45:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbjGaPpM (ORCPT ); Mon, 31 Jul 2023 11:45:12 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34BDDE57 for ; Mon, 31 Jul 2023 08:45:11 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id D39B1FF808; Mon, 31 Jul 2023 15:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1690818309; 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=2FSIAqeOuayaaKRncvVUn+1XDuP+hp1ypNaupfCM5SM=; b=fcgKkc8x3RLFYjGjA3iMwYuPa3RXERO4PvbkifpA+X+sHvhNY40AteS47Hw448DXV3e+Rj w/tlSmSfUkVIXf/MNCRlsO2GHay90FU/lita5D0sUHe83F7Y9Uj0UBL21rp5pQGBu2+H66 L5kd//FLoHxl7KQXftccr/Oq8MFT7z30mNA1YTtEC4L5OH0pZWmsR92w1Q4lcLumBgRr4u Jy4thZahsQwo6QzukqWWZRnJwpzOdyGnGXuDzM9e1KBh+3C6ffjFaeJTdjk/ASMF3/pAYA 01SedJQJ169RGkMxDDLjwBYJiz+lrLlO3v1WfwxxymtzJabVjP1Sk7xOyCJ2CQ== Date: Mon, 31 Jul 2023 17:45:06 +0200 From: Miquel Raynal To: Daniel Golle Cc: Greg Kroah-Hartman , Srinivas Kandagatla , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] nvmem: core: append offset to cell name in sysfs Message-ID: <20230731174506.00368411@xps-13> In-Reply-To: References: 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=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,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 Daniel, daniel@makrotopia.org wrote on Tue, 18 Jul 2023 14:55:57 +0100: > The device tree node names are not required to be unique. Append the > offset to the name to make cell nodes with identical names become > accessible via sysfs and avoid kernel stackdump caused by > sysfs: cannot create duplicate filename '...' >=20 > Fixes: 757f8b3835c9 ("nvmem: core: Expose cells through sysfs") > Signed-off-by: Daniel Golle > --- > drivers/nvmem/core.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c > index 70e951088826d..90fe9dc30f8ba 100644 > --- a/drivers/nvmem/core.c > +++ b/drivers/nvmem/core.c > @@ -480,7 +480,9 @@ static int nvmem_populate_sysfs_cells(struct nvmem_de= vice *nvmem) > /* Initialize each attribute to take the name and size of the cell */ > list_for_each_entry(entry, &nvmem->cells, node) { > sysfs_bin_attr_init(&attrs[i]); > - attrs[i].attr.name =3D devm_kstrdup(&nvmem->dev, entry->name, GFP_KERN= EL); > + attrs[i].attr.name =3D devm_kasprintf(&nvmem->dev, GFP_KERNEL, > + "%s@%d", entry->name, > + entry->offset); Shouldn't we use %s@%x instead to match the DT descriptions? > attrs[i].attr.mode =3D 0444; > attrs[i].size =3D entry->bytes; > attrs[i].read =3D &nvmem_cell_attr_read; I plan another version of the series which triggered these patches, if you don't mind I will squash patch 1 into my patches and pick this one as a preparation change (likely with the above fix if you agree and without the Fixes tag). Thanks, Miqu=C3=A8l