Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3709967rdh; Thu, 28 Sep 2023 23:10:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEuFqxm+tDEOlFCExxnjDfjR1JLJIk3eN3Qy41OtdItHT/Orf+FfMxhSizn5tHP+jZxUVLm X-Received: by 2002:a17:902:bc4b:b0:1bf:557c:5a2c with SMTP id t11-20020a170902bc4b00b001bf557c5a2cmr2774409plz.44.1695967845197; Thu, 28 Sep 2023 23:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695967845; cv=none; d=google.com; s=arc-20160816; b=dlpwsv0so+nUFygLVLlA37NdI8Pqr5qRIvvwnd4D0p4BXJhXEIg8sBo8hL9O4JmlX/ yXJxT/DaW6eYgXaKvWRvjdlpxZiHrxYWCmxDe+iqD02/FOcLw6ep909t4V+CdEVj+4K7 6acYJzsmJaB+hHGIojZrFvRmxXRTp9z/ceyFxdi9KFO01o/6cMV/oGJZDotBiBiE0XWC ybQK0gyZloCyCuWJ8tCs3tac+495YUeGAS/iyLW2tcmnupWJvK6T84Yu2BjFf9X07bxI sbq+bWdQnI5V/Inhs5R3eqIf/Y6qc+zojG9V6cqnk813pHjJw4cw9Jj+k3ebDjkcs7vm WL+A== 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=sdpUjdlYlpa92f1nPpUG6ehOC52V0CnDc6Jg5u1qRx8=; fh=2EMv6Ee5TLaeiEAL/RdHZsJEKmO8ue9udvR2Ea6pQ5U=; b=a19qW85/skI8S0C0+tc3iFXMyHHatuloB3/2d5dVbjCHNIkOYHglgQlvpRxbOQEpMi KXFMKCmayCDn2k+FmqVKBNUxg6td2yeOh3th8k6eDqz3s+JAGnFPnQ9ni4mPm38aIsrm IFXtZ0S2jkQ5LL5fELJzjH69M3zFuNug+S5L3Q64k4/NeSaz0iDnbgz2jg9ZgpfweQNg f11K+TMo0i4lcPBCqaOSbaiKYw6f/0SXvaoSUe0AnMfvkKI04YLCA+TMl7AdscxyqMEk zmDY2x6QF3QIIPgHIXt3kEbufXDzhqnMRw76uBWhjTWNxeMzbX0a0UcimCwHQ3+T6EM5 UDzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id u12-20020a170902e5cc00b001c5c344a425si14780293plf.418.2023.09.28.23.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 23:10:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 9728F82A95EC; Thu, 28 Sep 2023 22:56:15 -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 S232519AbjI2Fzy (ORCPT + 99 others); Fri, 29 Sep 2023 01:55:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbjI2Fzx (ORCPT ); Fri, 29 Sep 2023 01:55:53 -0400 X-Greylist: delayed 69118 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 28 Sep 2023 22:55:50 PDT Received: from 20.mo581.mail-out.ovh.net (20.mo581.mail-out.ovh.net [46.105.49.208]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F8F9199 for ; Thu, 28 Sep 2023 22:55:49 -0700 (PDT) Received: from director6.ghost.mail-out.ovh.net (unknown [10.109.138.21]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id 6341E23E34 for ; Fri, 29 Sep 2023 05:18:35 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-q6b6x (unknown [10.110.208.152]) by director6.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 5A8AB1FD2C; Fri, 29 Sep 2023 05:18:32 +0000 (UTC) Received: from RCM-web9.webmail.mail.ovh.net ([151.80.29.21]) by ghost-submission-6684bf9d7b-q6b6x with ESMTPSA id EObvEyheFmXGzSUAxx48XA (envelope-from ); Fri, 29 Sep 2023 05:18:32 +0000 MIME-Version: 1.0 Date: Fri, 29 Sep 2023 07:18:32 +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: <1a27a3341379b9679174f7c5143bbeb3@milecki.pl> References: <20230922174854.611975-1-miquel.raynal@bootlin.com> <20230922174854.611975-4-miquel.raynal@bootlin.com> <1a27a3341379b9679174f7c5143bbeb3@milecki.pl> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <5f1221613fb71b87c01c82add9fe5097@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: 6785517264681413533 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrtddugdelhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeggfffhvfevufgjfhgfkfigihgtgfesthekjhdttderjeenucfhrhhomheptfgrfhgrlhcuofhilhgvtghkihcuoehrrghfrghlsehmihhlvggtkhhirdhplheqnecuggftrfgrthhtvghrnhepjedvlefguedthfefleehgeeftdeludeluedvgfeffeevhfevtdehteejteefheegnecukfhppeduvdejrddtrddtrddupdefuddruddurddvudekrddutdeipdduhedurdektddrvdelrddvudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehrrghfrghlsehmihhlvggtkhhirdhplheqpdhnsggprhgtphhtthhopedupdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehkedupdhmohguvgepshhmthhpohhuth 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 22:56:15 -0700 (PDT) On 2023-09-28 17:31, Rafał Miłecki wrote: > 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 The same test after converting U-Boot env into layout driver: # hexdump -C /sys/bus/nvmem/devices/mtd1/cells/ipaddr@15c 00000000 31 39 32 2e 31 36 38 2e 31 2e 31 |192.168.1.1| 0000000b Looks good! -- Rafał Miłecki