Skip to content
  • Jean Delvare's avatar
    modpost: i2c aliases need no trailing wildcard · ac551828
    Jean Delvare authored
    
    
    Not all device types need a wildcard at the end of their module
    aliases. In particular, for i2c module aliases, the trailing wildcard
    is not only unneeded, it could also cause the wrong driver to be
    loaded.
    
    As I2C devices have no IDs, i2c module aliases are simple, arbitrary
    device names. For example:
    
    $ /sbin/modinfo lm90
    filename:       /lib/modules/2.6.25-git18/kernel/drivers/hwmon/lm90.ko
    author:         Jean Delvare <khali@linux-fr.org>
    description:    LM90/ADM1032 driver
    license:        GPL
    vermagic:       2.6.25-git18 mod_unload
    depends:        hwmon
    alias:          i2c:lm90*
    alias:          i2c:adm1032*
    alias:          i2c:lm99*
    alias:          i2c:lm86*
    alias:          i2c:max6657*
    alias:          i2c:adt7461*
    alias:          i2c:max6680*
    $
    
    This would cause trouble if one I2C chip name matches the beginning of
    another I2C chip name and both chips are supported by different
    drivers. For example, an i2c device named lm9042 would cause the lm90
    driver to be loaded, while it doesn't support that device. This case
    has yet to be seen in practice, but still, I'd like to fix it now. The
    cleanest fix is to remove the trailing wildcard from i2c module aliases.
    
    Here's a patch doing this.
    
    Not all device type aliases need a trailing wildcard, in particular
    the i2c aliases don't. Don't add a wildcard by default in do_table(),
    instead let each device type handler add it if needed.
    
    I have tested types acpi, dmi, eisa, i2c, ide, ieee1394, input, pci,
    pcmcia, platform, pnp, scsi, serio, ssb and usb. Other types (ccw, of,
    vio, parisc, sdio and virtio) are untested.
    Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
    Acked-by: default avatarJochen Friedrich <jochen@scram.de>
    Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
    ac551828