Commit d1ab4235 authored by Sylvain Munaut's avatar Sylvain Munaut Committed by Sam Ravnborg

powerpc: Fix the MODALIAS generation in modpost for of devices

Since the devices may have multiple (or none) compatible properties,
the uevent generated internally by the kernel may have multiple
"C..." entries. So the MODALIAS stored in the module must have
wilcard before and after the compatible entry.
Also, if the 'compatible' field is not used for matching, there
will be no 'C' and that must handled as well.

The previous code handled all those case incorrectly and it
"mostly" worked ... but not always.
Signed-off-by: default avatarSylvain Munaut <tnt@246tNt.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 55b637c6
...@@ -353,11 +353,16 @@ static int do_pcmcia_entry(const char *filename, ...@@ -353,11 +353,16 @@ static int do_pcmcia_entry(const char *filename,
static int do_of_entry (const char *filename, struct of_device_id *of, char *alias) static int do_of_entry (const char *filename, struct of_device_id *of, char *alias)
{ {
int len;
char *tmp; char *tmp;
sprintf (alias, "of:N%sT%sC%s", len = sprintf (alias, "of:N%sT%s",
of->name[0] ? of->name : "*", of->name[0] ? of->name : "*",
of->type[0] ? of->type : "*", of->type[0] ? of->type : "*");
of->compatible[0] ? of->compatible : "*");
if (of->compatible[0])
sprintf (&alias[len], "%sC%s",
of->type[0] ? "*" : "",
of->compatible);
/* Replace all whitespace with underscores */ /* Replace all whitespace with underscores */
for (tmp = alias; tmp && *tmp; tmp++) for (tmp = alias; tmp && *tmp; tmp++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment