public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Michael Walle" <michael@walle.cc>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Robert Marko" <robert.marko@sartura.hr>,
	"Luka Perkov" <luka.perkov@sartura.hr>,
	linux-kernel@vger.kernel.org,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Chen-Yu Tsai" <wenst@chromium.org>,
	"Daniel Golle" <daniel@makrotopia.org>,
	"Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH v10 1/3] nvmem: core: Rework layouts to become platform devices
Date: Mon, 2 Oct 2023 17:16:12 +0200	[thread overview]
Message-ID: <20231002171612.067b84a8@xps-13> (raw)
In-Reply-To: <2023100200-snowcap-arena-a548@gregkh>

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).
> > 
> > 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.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>  
> 
> 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èl

  reply	other threads:[~2023-10-02 15:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 17:48 [PATCH v10 0/3] NVMEM cells in sysfs Miquel Raynal
2023-09-22 17:48 ` [PATCH v10 1/3] nvmem: core: Rework layouts to become platform devices Miquel Raynal
2023-09-28 20:24   ` Rafał Miłecki
2023-10-02  9:23   ` Srinivas Kandagatla
2023-10-03  9:43     ` Miquel Raynal
2023-10-05 14:58       ` Miquel Raynal
2023-10-02  9:35   ` Greg Kroah-Hartman
2023-10-02 15:16     ` Miquel Raynal [this message]
2023-09-22 17:48 ` [PATCH v10 2/3] ABI: sysfs-nvmem-cells: Expose cells through sysfs Miquel Raynal
2023-09-22 17:48 ` [PATCH v10 3/3] nvmem: core: " Miquel Raynal
2023-09-28 15:31   ` Rafał Miłecki
2023-09-29  5:18     ` Rafał Miłecki
2023-10-01 15:59       ` Miquel Raynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231002171612.067b84a8@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=daniel@makrotopia.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luka.perkov@sartura.hr \
    --cc=michael@walle.cc \
    --cc=rafal@milecki.pl \
    --cc=rdunlap@infradead.org \
    --cc=robert.marko@sartura.hr \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox