Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp2747408rwb; Mon, 7 Aug 2023 02:51:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGB1xkSwfy8hpd2NvSaJEZ0n16VjMfoyKyJKDICdrWvgRtUfFJMSuxTrP0M/KPV/nqE6y5b X-Received: by 2002:a17:902:e88c:b0:1bc:6e8c:eeff with SMTP id w12-20020a170902e88c00b001bc6e8ceeffmr1590936plg.43.1691401870781; Mon, 07 Aug 2023 02:51:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691401870; cv=none; d=google.com; s=arc-20160816; b=xGF9KA41ZCBsED77vv+1vg/sevq5kHi57OM1uZZb/GR2HrZH+8eCQLjSabh/VKQLz6 06RCXHvZ3pPg5VariZqNZZaX3EaVwA/p3WThstzEF5/XGi5EDDPhZW89WfXiiq6qs53m LGcBwi62/YMEVNVo5T8UKtXBRtG6/zSkVzPK7x0CubAYJJBNcNe3yQ1NA+5DQ/LXiMiT cnX6K/7rNE2WR8q0Ir/5jqbTyCpf5DjvrqDWMdjaMzJ69TucbQfGv6LdEaD78aBuuvgU 64Bp4ml3pB+9s7YO2aJw1vYzGgdsg28nC26ZfgtkC+Ac8avAPpi9PadzFd14L5q6B7hN DRpg== 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=OtYbzRcQ6XjwjvKil4QI+vkjjqINuSRUpPIAc5daf/s=; fh=87GTZ4AHW2JoKQS56eLCaDG0RDcRbK3oJ1irtis6vy8=; b=aGvV4d6iY7S17l/99xieNg8mhsBi00fCq60RNRSRUDBuPP1yIOPagdf21tpW0420FF WBgBp7JClzEMxCNE1VRm8XbI8gDd+rO54PRRw11RXdGg3YGDkSQNpnI35UckhzHksWux ANICbuRs+2KO/5sDgXKWs/hgxZNZp1NjAY8aNCZeyeYGW9isUd+dXMaVkwRxB2AG2Xt1 TBwG3rSEjf515K08MNBUJNhJQdvuGUaTcb7KyNvlQvqDQbITDzL5DsZguJl+ejcThDDS P3G/+Yzf83yTjEWOhvoHQnuNDD+CCsAsH4D+CO4B0sjd/35Eq/DmjM4Kpny18tXk7w0m EZ8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=M4bWRF0n; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a170902d48c00b001bba8a9e29dsi1554601plg.100.2023.08.07.02.50.57; Mon, 07 Aug 2023 02:51:10 -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=@bootlin.com header.s=gm1 header.b=M4bWRF0n; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231573AbjHGJdb (ORCPT + 99 others); Mon, 7 Aug 2023 05:33:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjHGJda (ORCPT ); Mon, 7 Aug 2023 05:33:30 -0400 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02DCEE7B for ; Mon, 7 Aug 2023 02:33:28 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 3E5E42000A; Mon, 7 Aug 2023 09:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691400806; 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=OtYbzRcQ6XjwjvKil4QI+vkjjqINuSRUpPIAc5daf/s=; b=M4bWRF0nJRKyVIFGIyW5YuCqD22A/p/YB9WxeAeCEs9oVK8POVvPZ0WO/G45YfTod+Jp6w IoUh67ZM6ryKacxiqWgLbc4n9hFb2X599dB0NHXRRw6i8M07VXFrEDmWR0UqdhX59hMdDt jX3yYFcg6xSJzciGHbHwWcTQxriEIKyNuooGMFFOWCbO5DNMTJhUeRKp/Xyxh8cR7OoEi3 JoRABVozIDag7WeWpgLRF1kFf04fkID9hKdD48i+6SNqsDnh7ZIjf/uSWQsW6gP9WsQT2y BTGek3QQuEZ6QwLzJAdPCmeW3Iij8XRKt5twPE8agH2SvWbftiIh2Nwz3qH5bA== Date: Mon, 7 Aug 2023 11:33:21 +0200 From: Miquel Raynal To: Greg Kroah-Hartman Cc: Srinivas Kandagatla , Thomas Petazzoni , Robert Marko , Luka Perkov , Michael Walle , linux-kernel@vger.kernel.org, Randy Dunlap , Chen-Yu Tsai , Daniel Golle , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= Subject: Re: [PATCH v8 6/8] nvmem: core: Rework layouts to become platform devices Message-ID: <20230807113321.0f0d46d8@xps-13> In-Reply-To: <2023080704-garage-amused-f18b@gregkh> References: <20230807082419.38780-1-miquel.raynal@bootlin.com> <20230807082419.38780-7-miquel.raynal@bootlin.com> <2023080704-garage-amused-f18b@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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS 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 Greg, gregkh@linuxfoundation.org wrote on Mon, 7 Aug 2023 11:05:48 +0200: > On Mon, Aug 07, 2023 at 10:24:17AM +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 >=20 > This is good, but why are you using a platform device here? Is it a > real platform device, or just a "fake" one you created? If a fake one, > please don't do that, use a real device, or a virtual device. Platform > devices should ONLY represent actual, real, platform devices (i.e. ones > descibed by the firmware). NVMEM layouts have their own firmware node (DT only in this case), so I guess we are in the "real device" situation here? But there is no specific hardware in the physical world, so I don't know in which class they should preferably be. I thought platform devices would be a helpful abstraction. With this additional information, in case you advise for using virtual devices, would you mind being more specific on what you expect? What should be used instead of platform devices? > Sorry but I couldn't answer this question by looking at this patch, the > device creation path isn't exactly obvious :) I would expect this to be handled by the of_platform_populate() call, but perhaps you were looking for something else. Thanks, Miqu=C3=A8l