Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1558165rdb; Mon, 2 Oct 2023 13:28:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9piCFNeucQ7XCfMgiXKRYrmwkoZ6sEUFjqBH2n9YXxZJWMjKdQufJuaIjoXZ8vF4jPtAU X-Received: by 2002:a05:6830:165a:b0:6b9:9288:613c with SMTP id h26-20020a056830165a00b006b99288613cmr13394127otr.13.1696278502635; Mon, 02 Oct 2023 13:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696278502; cv=none; d=google.com; s=arc-20160816; b=ZkoFewu0J58a5bn6WAojgZe3TDhr3t7YQEqtbW3wO2pqVnNR00jQlj4KlIKGwj4fQ2 YEqr1GYI52up8ZJoGWkj5CnLuscYlKJxGxyuGw1QrkP4waGhrXWqKSQNXPt86uzBG85x oUaEWlyBDHpzj3eE2l2Y4J+d6rtqb79kY0Qobvw3OETjMvbquzfj9P71/VovugPOnpPD mubrQaZccTnxUX/Xd9e0TwNmnuy3Tl53gAiuSve9zgIIuZz9rosA/dkNnxzv+48Yb8sr JtcZnMrPOf3qGQefeh+0vFVEJBCCPGz0zc6RROqwSY+2HOw77OBXpqdHXosfYH3QMbEP Tw4g== 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=AY6CEUXfWvCVK8bHGt4MBD50WkCv7rvLNyBiVvtUYjk=; fh=Mc2WuASxbojsZj6dmJ6mjZrY9Kb8us6ffi0DF0aExKI=; b=yxkyK75dbclDjHOccG273MnGjk594JUCYijgyLgXAys1N4E1Ui5nOVBzFCjNNCyV0c 9cbAO5cpWz04J62ZE7AwE9Z4tO0E6MDCJbdP+DvAW7VT/XUe1wkL1b8s1FfrD7HH4Iam NUEWDVQafKJSPm9M67ClI0a5j8MD7UJ54Rnv+GhWIuFSBTCby0IWT5JaO6gRhlV1oD8H 9RHvho3vG+3AoDGvzu2pZY6zyaITe/zAmaBGcf/q3ebJJzG4Hy7T5uXJAah6pF+OrM2K fl2GNY/RoTgefeayayWLoPvy/Tj2RFahW6J2YOCSKcuESszb0dt+j+F/JkxSQOyijiK/ /s8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KalJIx+1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id i198-20020a639dcf000000b00537c6c285a0si27055104pgd.167.2023.10.02.13.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 13:28:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KalJIx+1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id A20D18089862; Mon, 2 Oct 2023 08:16:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238006AbjJBPQW (ORCPT + 99 others); Mon, 2 Oct 2023 11:16:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237973AbjJBPQU (ORCPT ); Mon, 2 Oct 2023 11:16:20 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEE78B3 for ; Mon, 2 Oct 2023 08:16:16 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 745A31C0009; Mon, 2 Oct 2023 15:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1696259775; 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=AY6CEUXfWvCVK8bHGt4MBD50WkCv7rvLNyBiVvtUYjk=; b=KalJIx+1ICwgQ4vaILtd1YXpqzAo8gDl5U5EFJJNMZkznoqMdE2vMzJidDTdKPZON/n28W UlsSzZfoP5m8CSUb0hMfx23ul1+GibQ35/fX7iPPK/2TFQzUSexI8ETlneCOzgJ6pCMJSv 9fSu+8M6b8O1W46L8q8qLNO45V8iCX5OKXwdPF9XGegw8zGXVMTRP1qpzWIsq0tskDDo/R 2KxybmkDs9Zi1OjyYD2ppdP9dglAR89XY2OJ3u+X+PJitEyhWygrNMMXUKmnMDvdQpWeRf JrMxIu1YtqloTKKhHxR6nhqr0m4gCy4gMOQBbKTEYe4y093kIoskhm/dwdrEgg== Date: Mon, 2 Oct 2023 17:16:12 +0200 From: Miquel Raynal To: Greg Kroah-Hartman Cc: Srinivas Kandagatla , Michael Walle , Thomas Petazzoni , Robert Marko , Luka Perkov , linux-kernel@vger.kernel.org, Randy Dunlap , Chen-Yu Tsai , Daniel Golle , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= Subject: Re: [PATCH v10 1/3] nvmem: core: Rework layouts to become platform devices Message-ID: <20231002171612.067b84a8@xps-13> In-Reply-To: <2023100200-snowcap-arena-a548@gregkh> References: <20230922174854.611975-1-miquel.raynal@bootlin.com> <20230922174854.611975-2-miquel.raynal@bootlin.com> <2023100200-snowcap-arena-a548@gregkh> 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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 pete.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 (pete.vger.email [0.0.0.0]); Mon, 02 Oct 2023 08:16:52 -0700 (PDT) Hi Greg, gregkh@linuxfoundation.org wrote on Mon, 2 Oct 2023 11:35:02 +0200: > On Fri, Sep 22, 2023 at 07:48:52PM +0200, Miquel Raynal wrote: > > Current layout support was initially written without modules support in > > mind. When the requirement for module support rose, the existing base > > was improved to adopt modularization support, but kind of a design flaw > > was introduced. With the existing implementation, when a storage device > > registers into NVMEM, the core tries to hook a layout (if any) and > > populates its cells immediately. This means, if the hardware description > > expects a layout to be hooked up, but no driver was provided for that, > > the storage medium will fail to probe and try later from > > scratch. Technically, the layouts are more like a "plus" and, even we > > consider that the hardware description shall be correct, we could still > > probe the storage device (especially if it contains the rootfs). > >=20 > > One way to overcome this situation is to consider the layouts as > > devices, and leverage the existing notifier mechanism. When a new NVMEM > > device is registered, we can: > > - populate its nvmem-layout child, if any > > - try to modprobe the relevant driver, if relevant > > - try to hook the NVMEM device with a layout in the notifier > > And when a new layout is registered: > > - try to hook all the existing NVMEM devices which are not yet hooked to > > a layout with the new layout > > This way, there is no strong order to enforce, any NVMEM device creation > > or NVMEM layout driver insertion will be observed as a new event which > > may lead to the creation of additional cells, without disturbing the > > probes with costly (and sometimes endless) deferrals. > >=20 > > Signed-off-by: Miquel Raynal =20 >=20 > Did I miss why these were decided to be platform devices and not normal > devices on their own "bus" that are attached to the parent device > properly? Why platform for a dynamic thing? I don't think you missed anything, following the discussion "how to picture these layouts as devices" I came up with the simplest approach: using the platform infrastructure. I thought creating my own additional bus just for that would involve too much code duplication. I agree the current implementation kind of abuses the platform infrastructure. I will have a look in order to maybe mutate this into its own bus. > If I did agree with this, it should be documented here in the changelog > why this is required to be this way so I don't ask the question again in > the future :) Haha, I don't think you did ;) Thanks, Miqu=C3=A8l