Skip to content

Commit d1ab423

Browse files
smunautsravnborg
authored andcommitted
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: Sylvain Munaut <tnt@246tNt.com> Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent 55b637c commit d1ab423

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎scripts/mod/file2alias.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,16 @@ static int do_pcmcia_entry(const char *filename,
353353

354354
static int do_of_entry (const char *filename, struct of_device_id *of, char *alias)
355355
{
356+
int len;
356357
char *tmp;
357-
sprintf (alias, "of:N%sT%sC%s",
358+
len = sprintf (alias, "of:N%sT%s",
358359
of->name[0] ? of->name : "*",
359-
of->type[0] ? of->type : "*",
360-
of->compatible[0] ? of->compatible : "*");
360+
of->type[0] ? of->type : "*");
361+
362+
if (of->compatible[0])
363+
sprintf (&alias[len], "%sC%s",
364+
of->type[0] ? "*" : "",
365+
of->compatible);
361366

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

0 commit comments

Comments
 (0)