提交 2f632369 编写于 作者: J Javier Martinez Canillas 提交者: Linus Torvalds

modpost: don't add a trailing wildcard for OF module aliases

Commit ac551828 ("modpost: i2c aliases need no trailing wildcard")
removed the wildcard at the end of the I2C module aliases because I2C
devices have no IDs so the aliases are just arbitrary device names.

This is also true for OF modaliases since a compatible string is used to
define a specific IP hardware block.  So the modalias should match a
specific compatible string and not attempt to match a compatible string
whose name matches the beginning of another one.

For example, the following driver module:

  $ modinfo cros_ec_keyb | grep alias
  alias:          platform:cros-ec-keyb
  alias:          of:N*T*Cgoogle,cros-ec-keyb*

will be tried to be loaded for an alias of:N*T*Cgoogle,cros-ec-keyb-v2
but there could be a different driver that supports the device for that
compatible string so it's better to remove the trailing wildcard for OF.

Also, remove the word "always" from the add_wildcard() function comment
since that was carried from the time where a wildcard was always added
at the end of the module alias for all the devices.
Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com>
Suggested-by: NBrian Norris <computersforpeace@gmail.com>
Reviewed-by: NSjoerd Simons <sjoerd.simons@collabora.co.uk>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 c510eff6
...@@ -125,7 +125,7 @@ do { \ ...@@ -125,7 +125,7 @@ do { \
sprintf(str + strlen(str), "*"); \ sprintf(str + strlen(str), "*"); \
} while(0) } while(0)
/* Always end in a wildcard, for future extension */ /* End in a wildcard, for future extension */
static inline void add_wildcard(char *str) static inline void add_wildcard(char *str)
{ {
int len = strlen(str); int len = strlen(str);
...@@ -704,7 +704,6 @@ static int do_of_entry (const char *filename, void *symval, char *alias) ...@@ -704,7 +704,6 @@ static int do_of_entry (const char *filename, void *symval, char *alias)
if (isspace (*tmp)) if (isspace (*tmp))
*tmp = '_'; *tmp = '_';
add_wildcard(alias);
return 1; return 1;
} }
ADD_TO_DEVTABLE("of", of_device_id, do_of_entry); ADD_TO_DEVTABLE("of", of_device_id, do_of_entry);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册