Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4629327rwb; Mon, 31 Jul 2023 09:38:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlFFK9LWhkb0QeqpozzpRdGD46EvXrw21BowgBJKAC/HFBBEIHTvLr45brKuYoErY5M3LkTa X-Received: by 2002:a19:2d09:0:b0:4fe:6fc:1fc7 with SMTP id k9-20020a192d09000000b004fe06fc1fc7mr257906lfj.27.1690821531667; Mon, 31 Jul 2023 09:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690821531; cv=none; d=google.com; s=arc-20160816; b=x/fe/I+KRbjqYl3fXU/NyfBGWPcygbp9vb/KTSy1U4FFi4+0hWm1GCPorXev6V2H6C CwnIdUeDi7n+hk9fUTjMtJfef5bnE4YTw3XTNvEtiSc/UBFhR3jkpuUSsbyg+IQgoqBl biEAhCPCvAcskxbJqzEV7C6SZMipLdd+jcSJZizchO0IuSzjt1y7SiU/C1rR4FPhlfqV NWvRzc1YFaQkJY3YX0Iaa1W4iCnTBbBNaxi2QWKpXSYK889lyKAFx12w90reusTPUOzM IQiVKvywxL32Anj8+nVP9vCCDgJ2udqV75YSVSENaus68/CePeHB0fe8Mun9I9PZUoFd qEkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=lASX9D/SXLkQVFKzaqPbR/DPUeEbjc9RJspvTv8vBAg=; fh=rv3nUT+xwShanngLb6JROBJF1AeLPeHjl2XzWijbwvQ=; b=YK0iwruJ4fc8JS1WUF0piSS4kt4b0RasTRuxWmPkDb2OZQRCA15jgaQ3kjXftyRA0Z Ng0H8QnnTJU5YGLieMyoyF95dy8x7jfjSV1kJ4JzdNI9NDbkEPauTCKo43kQknBqKfah PSYlFP016O08+GAsRQvAmsrwoBoWGY5Yys9j0XB3V+NCO4LZ1cDZu5nDswAbcqfrNRyq xar2HEk2JxTJ0PGDBe/nQQp+bFXIxi1ZAGrjiugpciOBXiY9mOVS476S22IrwqY+BMPF s2gAhCvA778PmqwrcogYegbbgkojmfJk0sKVRsJherQ9VZP9eQRjFHn2bJ4+EkudZCko L3Og== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d19-20020aa7d5d3000000b0051e24097920si7022461eds.559.2023.07.31.09.38.26; Mon, 31 Jul 2023 09:38:51 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232861AbjGaPyt (ORCPT + 99 others); Mon, 31 Jul 2023 11:54:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232866AbjGaPym (ORCPT ); Mon, 31 Jul 2023 11:54:42 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10651197 for ; Mon, 31 Jul 2023 08:54:38 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1qQVEA-0000u1-0a; Mon, 31 Jul 2023 15:54:34 +0000 Date: Mon, 31 Jul 2023 16:54:01 +0100 From: Daniel Golle To: Miquel Raynal 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: References: <20230731174506.00368411@xps-13> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230731174506.00368411@xps-13> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,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 Miquel, On Mon, Jul 31, 2023 at 05:45:06PM +0200, Miquel Raynal wrote: > 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 '...' > > > > 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(-) > > > > 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_device *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 = devm_kstrdup(&nvmem->dev, entry->name, GFP_KERNEL); > > + attrs[i].attr.name = devm_kasprintf(&nvmem->dev, GFP_KERNEL, > > + "%s@%d", entry->name, > > + entry->offset); > > Shouldn't we use %s@%x instead to match the DT descriptions? True, I agree. > > > attrs[i].attr.mode = 0444; > > attrs[i].size = entry->bytes; > > attrs[i].read = &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). Yes, sure, please go ahead. Cheers Daniel > > Thanks, > Miqu?l