Skip to content

Commit

Permalink
powerpc: Fix the MODALIAS generation in modpost for of devices
Browse files Browse the repository at this point in the history
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: Sylvain Munaut <[email protected]>
Signed-off-by: Paul Mackerras <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
  • Loading branch information
smunaut authored and sravnborg committed May 19, 2007
1 parent 55b637c commit d1ab423
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/mod/file2alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
int len;
char *tmp;
sprintf (alias, "of:N%sT%sC%s",
len = sprintf (alias, "of:N%sT%s",
of->name[0] ? of->name : "*",
of->type[0] ? of->type : "*",
of->compatible[0] ? of->compatible : "*");
of->type[0] ? of->type : "*");

if (of->compatible[0])
sprintf (&alias[len], "%sC%s",
of->type[0] ? "*" : "",
of->compatible);

/* Replace all whitespace with underscores */
for (tmp = alias; tmp && *tmp; tmp++)
Expand Down

0 comments on commit d1ab423

Please sign in to comment.