• Brian Norris's avatar
    mtd: m25p80: fix module autoloading for "jedec, spi-nor" and "spi-nor" · de57732d
    Brian Norris authored
    Commit 43163022 ("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: default avatarBrian Norris <computersforpeace@gmail.com>
    Reviewed-by: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
    de57732d
m25p80.c 7.94 KB