All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: "Rafał Miłecki" <rafal@milecki.pl>
Cc: "Rafał Miłecki" <zajec5@gmail.com>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Brian Norris" <computersforpeace@gmail.com>,
	"Boris Brezillon" <boris.brezillon@free-electrons.com>,
	"Marek Vasut" <marek.vasut@gmail.com>,
	"Richard Weinberger" <richard@nod.at>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH RFC API ONLY] mtd: get parsers from lookup table
Date: Mon, 16 Jul 2018 23:11:49 +0200	[thread overview]
Message-ID: <20180716231149.0704591f@bbrezillon> (raw)
In-Reply-To: <1b51d369d433ae0093ba4dac1062c9e0@milecki.pl>

On Mon, 16 Jul 2018 22:58:19 +0200
Rafał Miłecki <rafal@milecki.pl> wrote:

> On 2018-07-16 18:23, Boris Brezillon wrote:
> > Hi Rafal,
> > 
> > On Mon, 16 Jul 2018 13:17:12 +0200
> > Rafał Miłecki <zajec5@gmail.com> wrote:
> >   
> >> From: Rafał Miłecki <rafal@milecki.pl>
> >> 
> >> Existing implementation of specifying flash device parsers became a 
> >> bit
> >> hacky and needs a cleanup. Currently it requires:
> >> 1) Passing parsers in a custom platform data by arch code
> >> or
> >> 2) Hardcoding parsers table in a flash driver
> >> 
> >> The purpose of the new implementation is to:
> >> 1) Clean up flash drivers
> >> 2) Have a generic solution
> >> 3) Avoid code duplication
> >> 
> >> That new implementation assigns table of parsers to a MTD's parent
> >> device. That way flash driver doesn't have to take care of passing
> >> parsers. It's inspired by GPIO lookup table.
> >> 
> >> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> >> ---
> >> It's obviously a RFC patch only. It doesn't really implement anything.
> >> It DOESN'T COMPILE.
> >> 
> >> I'd like to know if you like this idea and if it's worth for me to
> >> actually spend time implementing it.  
> > 
> > I love the idea. Actually, I'd like to extend that to fixed partition
> > definitions (those passed to mtd_device_register()) so that they can be
> > parsed by the fixed-partition parser (the one already taking care of
> > compatible = "fixed-partitions").  
> 
> That was something I planned to handle next, so it's great to hear we
> share the ideas for further improvements! That will extremely simplify
> mtd_device_register().

Cool!

> 
> In 99% cases there is only one place in the code registering a given
> platform device. As there is only one place registering "sharpsl-nand"
> device, we can assume the resulting name will be "sharpsl-nand.0".
> 
> If there was another code doing the same, you couldn't know if you
> should expect "sharpsl-nand.0" or "sharpsl-nand.1".

It's only true if you use platform_device->id = PLATFORM_DEVID_AUTO,
and I think we can assume linking a lookup table to a device with ->id
= PLATFORM_DEVID_AUTO is broken. In other cases, the id defined at
platform_device definition time (either PLATFORM_DEVID_NONE or a
statically assigned id).

> 
> I believe we should be fine guessing in these 99% cases and only depend
> on order (semi-risking a race) in that 1% (or less).

      reply	other threads:[~2018-07-16 21:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 11:17 [PATCH RFC API ONLY] mtd: get parsers from lookup table Rafał Miłecki
2018-07-16 16:23 ` Boris Brezillon
2018-07-16 20:58   ` Rafał Miłecki
2018-07-16 21:11     ` Boris Brezillon [this message]

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=20180716231149.0704591f@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=rafal@milecki.pl \
    --cc=richard@nod.at \
    --cc=zajec5@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.