]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: m25p80: fix module autoloading for "jedec, spi-nor" and "spi-nor"
authorBrian Norris <computersforpeace@gmail.com>
Mon, 16 Nov 2015 22:34:50 +0000 (14:34 -0800)
committerBrian Norris <computersforpeace@gmail.com>
Fri, 20 Nov 2015 00:46:42 +0000 (16:46 -0800)
commitfc777ddca38fefab42bc024b34b66140125a0e33
tree92bfd6133631e499af1f3b0249e16d6180c51cd2
parentacc749b90d8c65886573d2a71c90fba0331f6b3b
mtd: m25p80: fix module autoloading for "jedec, spi-nor" and "spi-nor"

Commit 9d1e7a1648d1 ("mtd: m25p80: allow arbitrary OF matching for
"jedec,spi-nor"") moved the "jedec,spi-nor" handling from the
spi_device_id table to the of_match_table, to better handle matching
complex device tree compatible strings. With that patch, device tree
support works as expected when m25p80.c is built into the kernel.

However, that commit ignored the fact that:

 (1) (non-DT) platform devices might want to use the "spi-nor" string
     for matching with this driver, rather than picking an arbitrary one
     like "m25p80"
 (2) the core SPI uevent/modalias code doesn't yet support kernel module
     autoloading via of_match_table strings; so for DT-based devices, it
     will only report (part of) the first compatible string used

Problem (1) has been reported previously, and I forgot to patch it up
afterward.

Problem (2) was noticed recently here:
http://lists.infradead.org/pipermail/linux-mtd/2015-October/062369.html
https://lkml.org/lkml/2015/11/12/574

Specifically, this patch fixes m25p80.ko module autoloading for cases
like this:

flash@xxx {
compatible = "jedec,spi-nor";
...
};

because modalias of "spi:spi-nor" (the only module loading info provided
by the SPI core for this device) will now be listed as an alias in
m25p80.ko.

Notably, it does *not* help cases like this:

flash@xxx {
compatible = "vendor,shiny-new-device", "jedec,spi-nor";
...
};

unless we also list "shiny-new-device" in m25p_ids[]. There has been
discussion on future work for this issue here:
https://lkml.org/lkml/2015/11/12/574

Cc: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
drivers/mtd/devices/m25p80.c