Subject: Re: [PATCH 1/2] i2c: Add support for device alias names

From: Kay Sievers <[email-masked]>
Date: Mon, 28 Apr 2008 17:07:25 +0200

On Mon, 2008-04-28 at 11:39 +0200, Jean Delvare wrote:
> Based on earlier work by Jon Smirl and Jochen Friedrich.
> 
> This patch allows new-style i2c chip drivers to have alias names using
> the official kernel aliasing system and MODULE_DEVICE_TABLE(). At this
> point, the old i2c driver binding scheme (driver_name/type) is still
> supported.
> 
> Signed-off-by: Jean Delvare <[email-masked]>
> Cc: Jochen Friedrich <[email-masked]>
> Cc: Jon Smirl <[email-masked]>
> Cc: Kay Sievers <[email-masked]>
> ---
> One thing I am still not happy with is that the aliases created have a
> trailing "*":
> 
> $ /sbin/modinfo lm90
> filename:       /lib/modules/2.6.25-git11/kernel/drivers/hwmon/lm90.ko
> author:         Jean Delvare <[email-masked]>
> description:    LM90/ADM1032 driver
> license:        GPL
> vermagic:       2.6.25-git11 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. This has yet to be seen, but still, I'd like to see this
> problem fixed quickly.

Right, the trailing "*" is not nice.

We should terminate the string, so the trailing "*" will not match
longer strings. The usual thing is to add a ":" to the end, which would
then show up as
  alias: i2c:max6680:*

See DMI and ACPI:
  alias dmi:*:svnFUJITSU:pnLifeBook*:pvr*:rvnFUJITSU:* apanel
  alias acpi*:ASIM0000:* atlas_btns

If i2c device modaliases could ever contain multiple strings, it should
be:
  alias: i2c*:max6680:*
to match the module, regardless of the order of the strings in the
modalias:

Thanks,
Kay