mtd: spi-nor: Prefer asynchronous probe
authorDouglas Anderson <dianders@chromium.org>
Wed, 2 Sep 2020 23:00:40 +0000 (16:00 -0700)
committerVignesh Raghavendra <vigneshr@ti.com>
Tue, 29 Sep 2020 13:13:15 +0000 (18:43 +0530)
commit03edda0e1edaa3c2e99239c66e3c14d749318fd6
tree3b782f6f9f61c8a153bfe52ab2f513d4ac9e24f2
parentba4f184e126b751d1bffad5897f263108befc780
mtd: spi-nor: Prefer asynchronous probe

On my system the spi_nor_probe() took ~6 ms at bootup.  That's not a
lot, but every little bit adds up to a slow bootup.  While we can get
this out of the boot path by making it a module, there are times where
it is convenient (or even required) for this to be builtin the kernel.
Let's set that we prefer async probe so that we don't block other
drivers from probing while we are probing.

This is a tiny little change that is almost guaranteed to be safe for
anything that is able to run as a module, which SPI_NOR is.
Specifically modules are already probed asynchronously.  Also: since
other things in the system may have enabled asynchronous probe the
system may already be doing other things during our probe.

There is a small possibility that some other driver that was a client
of SPI_NOR didn't handle -EPROBE_DEFER and was relying on probe
ordering and only worked when the SPI_NOR and the SPI bus were
builtin.  In that case the other driver has a bug that's waiting to
hit and the other driver should be fixed.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Link: https://lore.kernel.org/r/20200902160002.1.I658d1c0db9adfeb9a59bc55e96a19e192c959e55@changeid
drivers/mtd/spi-nor/core.c