• Mark Brown's avatar
    spi: Check we have a spi_device_id for each DT compatible · 5fa6863b
    Mark Brown authored
    Currently for SPI devices we use the spi_device_id for module autoloading
    even on systems using device tree, meaning that listing a compatible string
    in the of_match_table isn't enough to have the module for a SPI driver
    autoloaded.
    
    We attempted to fix this by generating OF based modaliases for devices
    instantiated from DT in 3ce6c9e2 ("spi: add of_device_uevent_modalias
    support") but this meant we no longer reported spi_device_id based aliases
    which broke drivers such as spi-nor which don't list all the compatible
    strings they support directly for DT, and in at least that case it's not
    super practical to do so given the very large number of compatibles
    needed, much larger than the number spi_device_ids due to vendor strings.
    As a result fell back to using spi_device_id based modalises.
    
    Try to close the gap by printing a warning when a SPI driver has a DT
    compatible that won't be matched as a SPI device ID with the goal of having
    drivers provide both. Given fallback compatibles this check is going to be
    excessive but it should be robust which is probably more important here.
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    Link: https://lore.kernel.org/r/20210921192149.50740-1-broonie@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    5fa6863b
spi.c 116 KB