Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5723416rwp; Mon, 17 Jul 2023 08:31:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlHdXOH7oZmK+aEGYXrQLBYaYFdhNlNx0NDD+ntYfUZIuwG4li0eDAOc5wVFA0urrszdRydd X-Received: by 2002:ac2:4bd5:0:b0:4f9:567a:7a59 with SMTP id o21-20020ac24bd5000000b004f9567a7a59mr14340760lfq.30.1689607893462; Mon, 17 Jul 2023 08:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689607893; cv=none; d=google.com; s=arc-20160816; b=IJqQizrXi87RwVoW4y4ipM+/6HgOUXOw1cmRTanogv912HE0zBimPtDV6Bfleel2vf I/npLEqbjkX7zjoRg9ZPSKx95P7N6NNBxTtvK2Qks/jabr7u+syK3K5OjQ8TwXUUKUPG VprnEyL2BLgZ5UC7tOymZ3C590mKDXEu5PtSXLN1roSjmgeM2V6adNwsxjrNUOYziemR 6P3Ik6TgpeMdorFMCMvGE7gMJtclOTpqqew7waNM7xL89XzzaMise4Ipzd5+TiZ2Dbfz VS1NP/Lmu5TjCUEtsaJpa6Q6EUkbCdRCx61Re9UNDkByWhEzYk5qLYjOlF4eUzV0JUki iRXA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DwbCeApRX3UE5SThW90LCJorg+AbNb6hjqC0Zt+3qtw=; fh=IYgqeSjKM8ssIKPhfx1gWJKrDYVks9miokYVQ2A7dro=; b=CayF5EJ7UishQuEUTOCET59RxlzTbCPJEtOgU/2jac2VvpFtt/lHBLAQhnZSK8MhA9 LNXAPw1V219pg1zTJ5tvNIQOVJC3oS6JO4uAm0FNRHGezrHIxdEjvd4RoJd3UTD3rfIb AjfMOGMkQmXawWyoCMMYX92/hk0s57A+FT+YMWXYNOl35O/GeMXCUujqcOKRlSv0shKD f811wVGkBsQB/rqIw2XTt4FkXTZT8O2fdvnjvRbYnfLwLZDI3MjgDnWAtWlsvkSUve9i JH3/x+NwURf6k1LpjSxYJPBfvCwRQODEvwBCqoaIiiZotpeJX1NYw68t24acFYFHBpPH SYnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M3txzvjo; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020aa7d5cb000000b0052176ba2183si4072700eds.40.2023.07.17.08.31.06; Mon, 17 Jul 2023 08:31:33 -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=@linuxfoundation.org header.s=korg header.b=M3txzvjo; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231627AbjGQOdO (ORCPT + 99 others); Mon, 17 Jul 2023 10:33:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232194AbjGQOcq (ORCPT ); Mon, 17 Jul 2023 10:32:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83713199C for ; Mon, 17 Jul 2023 07:32:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D45AB6105C for ; Mon, 17 Jul 2023 14:32:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E20DBC433C8; Mon, 17 Jul 2023 14:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689604332; bh=/2I8JbAXNjgUMRStRV5TBGj0in8yPViD7RUzOpxGG3Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=M3txzvjoFs2D+qCbuLXByBLpAWrxizOceENLrtprK/wRTK7Bj+3YarOyUSN8j8mRT 9GtnJQpfNu2Y4tA4ABr8CeOhyfkqGhFcgnUgIZcSrHfQb99JCnmEBinlUQ6+BMiQoh 5FsW/2LWG1JBHK6JBTtLOajZ4VXHn4PXv0dF6t0c= Date: Mon, 17 Jul 2023 16:32:09 +0200 From: Greg Kroah-Hartman To: Miquel Raynal Cc: Srinivas Kandagatla , 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: <2023071717-channel-supernova-4cc9@gregkh> References: <20230717075147.43326-1-miquel.raynal@bootlin.com> <20230717075147.43326-4-miquel.raynal@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230717075147.43326-4-miquel.raynal@bootlin.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, 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 On Mon, Jul 17, 2023 at 09:51:47AM +0200, 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. > > There is one limitation though: if a layout is built as a module but is > not properly installed in the system and loaded manually with insmod > while the nvmem device driver was built-in, the cells won't appear in > sysfs. But if done like that, the cells won't be usable by the built-in > kernel drivers anyway. Wait, what? That should not be an issue here, if so, then this change is not correct and should be fixed as this is NOT an issue for sysfs (otherwise the whole tree wouldn't work.) Please fix up your dependancies if this is somehow not working properly. thanks, greg k-h