Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3345594rdh; Thu, 28 Sep 2023 09:02:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRq1+Tilslg/BH6rT7JB7pEmwdYcUII2+kWLj439f+WRFRdsH/r4A9LLyX6PZhAz6e0CzF X-Received: by 2002:a17:902:dacd:b0:1c6:1d3d:b412 with SMTP id q13-20020a170902dacd00b001c61d3db412mr1742720plx.30.1695916953970; Thu, 28 Sep 2023 09:02:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695916953; cv=none; d=google.com; s=arc-20160816; b=qqYLil4ZWdCyLwwwF7cmm5+8TL6h1Sy+2lYSfJxQGkC/SNv8BTI8VB2Y1GvpQ/mQtV 1Xyfz+Vo+QD2+qMZVlhkm+hcXh+0Cz/8zsBAx1UoMoToAEScDXcVR6bSgpR7fnLewlqk gldTlt++RjOkcLj3cxzvuDsSpfTBH2hkUDYU7IyoleeTUDGud1ONFkdmRJI9kSCPt+tY xHtdMn/jfC8r/hDE7RRF3Lzf7G8WYqi3BpeuF6jqNDhDODCW81+y5twz+fDy0KT/a+Wj myalRkRcKCZ4xdXzgAxkcqAawBYBA28V6KKdTeuSZlSJc5KGMT0d1Q4ar9RMLoltnVDf mQ6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version; bh=LkTAyVbE3kzYMgR6y1l9jDe5pbqbz+dFVVe/RljzTgI=; fh=2EMv6Ee5TLaeiEAL/RdHZsJEKmO8ue9udvR2Ea6pQ5U=; b=y6dV+5UeinF1FhtVI1Qc4b3PeLj3X6unHci11ybNMUQDW52l1KI07QO2JVTYuCCRFb ojoo5RD3VYu197VIWng7slvmo/1Y66FPBAgOxq/XF2tFzpC2i6UZUb1wDl9BNgwMEjd6 kjF66wBDNAryi9Pir5hzU5hZFCE1p2bHCGuHrXoqMaEjbiDyub1hneOZns23jDJ+j/0b tUCIc/ShyVZ+7TshBzXhhIUFcGUjE0dg0o3/GHShmlBAbaEwOpLBRYv2t2aSp2N1QA82 7eLsE1/Y9SX3iqaYhdrlAdX+93/EcpPdEcm94Ri49NgZW3As+rKb577aC6YRPvppYbVA VirQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id z14-20020a170903018e00b001c7245a1e73si6249012plg.32.2023.09.28.09.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 09:02:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2CB9780E7616; Thu, 28 Sep 2023 08:51:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231952AbjI1PvJ (ORCPT + 99 others); Thu, 28 Sep 2023 11:51:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231887AbjI1PvH (ORCPT ); Thu, 28 Sep 2023 11:51:07 -0400 X-Greylist: delayed 600 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 28 Sep 2023 08:51:01 PDT Received: from 8.mo560.mail-out.ovh.net (8.mo560.mail-out.ovh.net [188.165.52.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3BE2B7 for ; Thu, 28 Sep 2023 08:51:01 -0700 (PDT) Received: from director4.ghost.mail-out.ovh.net (unknown [10.108.16.31]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id 5F14E23E38 for ; Thu, 28 Sep 2023 15:31:21 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-xtrd6 (unknown [10.110.103.92]) by director4.ghost.mail-out.ovh.net (Postfix) with ESMTPS id ADCE01FDB6; Thu, 28 Sep 2023 15:31:20 +0000 (UTC) Received: from RCM-web4.webmail.mail.ovh.net ([176.31.235.81]) by ghost-submission-6684bf9d7b-xtrd6 with ESMTPSA id cUnAJ0icFWWmLwAAgHucVw (envelope-from ); Thu, 28 Sep 2023 15:31:20 +0000 MIME-Version: 1.0 Date: Thu, 28 Sep 2023 17:31:20 +0200 From: =?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?= To: Miquel Raynal Cc: Srinivas Kandagatla , Greg Kroah-Hartman , Michael Walle , Thomas Petazzoni , Robert Marko , Luka Perkov , linux-kernel@vger.kernel.org, Randy Dunlap , Chen-Yu Tsai , Daniel Golle Subject: Re: [PATCH v10 3/3] nvmem: core: Expose cells through sysfs In-Reply-To: <20230922174854.611975-4-miquel.raynal@bootlin.com> References: <20230922174854.611975-1-miquel.raynal@bootlin.com> <20230922174854.611975-4-miquel.raynal@bootlin.com> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <1a27a3341379b9679174f7c5143bbeb3@milecki.pl> X-Sender: rafal@milecki.pl X-Originating-IP: 31.11.218.106 X-Webmail-UserID: rafal@milecki.pl Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 11261532344254573469 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrtddtgdeitdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeggfffhvfevufgjfhgfkfigihgtgfesthekjhdttderjeenucfhrhhomheptfgrfhgrlhcuofhilhgvtghkihcuoehrrghfrghlsehmihhlvggtkhhirdhplheqnecuggftrfgrthhtvghrnhepjedvlefguedthfefleehgeeftdeludeluedvgfeffeevhfevtdehteejteefheegnecukfhppeduvdejrddtrddtrddupdefuddruddurddvudekrddutdeipddujeeirdefuddrvdefhedrkedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeorhgrfhgrlhesmhhilhgvtghkihdrphhlqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheeitddpmhhouggvpehsmhhtphhouhht X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 28 Sep 2023 08:51:30 -0700 (PDT) On 2023-09-22 19:48, Miquel Raynal wrote: > The binary content of nvmem devices is available to the user so in the > easiest cases, finding the content of a cell is rather easy as it is > just a matter of looking at a known and fixed offset. However, nvmem > layouts have been recently introduced to cope with more advanced > situations, where the offset and size of the cells is not known in > advance or is dynamic. When using layouts, more advanced parsers are > used by the kernel in order to give direct access to the content of > each > cell, regardless of its position/size in the underlying > device. Unfortunately, these information are not accessible by users, > unless by fully re-implementing the parser logic in userland. > > Let's expose the cells and their content through sysfs to avoid these > situations. Of course the relevant NVMEM sysfs Kconfig option must be > enabled for this support to be available. > > Not all nvmem devices expose cells. Indeed, the .bin_attrs attribute > group member will be filled at runtime only when relevant and will > remain empty otherwise. In this case, as the cells attribute group will > be empty, it will not lead to any additional folder/file creation. > > Exposed cells are read-only. There is, in practice, everything in the > core to support a write path, but as I don't see any need for that, I > prefer to keep the interface simple (and probably safer). The interface > is documented as being in the "testing" state which means we can later > add a write attribute if though relevant. > > Signed-off-by: Miquel Raynal Tested-by: Rafał Miłecki # hexdump -C /sys/bus/nvmem/devices/u-boot-env0/cells/ipaddr@15c 00000000 31 39 32 2e 31 36 38 2e 31 2e 31 |192.168.1.1| 0000000b -- Rafał Miłecki