diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 09:59:14 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 09:59:14 -0700 | 
| commit | 244dc4e54b73567fae7f8fd9ba56584be9375442 (patch) | |
| tree | c7b47b122fde55c92f7f32797aef1e3e1c7030d1 /scripts/mod/file2alias.c | |
| parent | e7f2f9918c0e97aa98ba147ca387e2c7238f0711 (diff) | |
| parent | e758936e02700ff88a0b08b722a3847b95283ef2 (diff) | |
Merge git://git.infradead.org/users/dwmw2/random-2.6
* git://git.infradead.org/users/dwmw2/random-2.6:
  Fix autoloading of MacBook Pro backlight driver.
  Automatic MODULE_ALIAS() for DMI match tables.
  Remove asm/a.out.h files for all architectures without a.out support.
  Introduce HAVE_AOUT symbol to remove hard-coded arch list for BINFMT_AOUT
  Remove redundant CONFIG_ARCH_SUPPORTS_AOUT
  S390: Update comments about why we don't use <asm-generic/statfs.h>
  SPARC: Use <asm-generic/statfs.h>
  PowerPC: Use <asm-generic/statfs.h>
  PARISC: Use <asm-generic/statfs.h>
  x86_64: Use <asm-generic/statfs.h>
  IA64: Use <asm-generic/statfs.h>
  ARM: Use <asm-generic/statfs.h>
  Make <asm-generic/statfs.h> suitable for 64-bit platforms.
  Define and use PCI_DEVICE_ID_MARVELL_88ALP01_CCIC for CAFÉ camera driver
  [MTD] [NAND] Define and use PCI_DEVICE_ID_MARVELL_88ALP01_NAND for CAFÉ
  Use PCI_DEVICE_ID_88ALP01 for CAFÉ chip, rather than PCI_DEVICE_ID_CAFE.
  EFS: Don't set f_fsid in statfs().
Diffstat (limited to 'scripts/mod/file2alias.c')
| -rw-r--r-- | scripts/mod/file2alias.c | 57 | 
1 files changed, 57 insertions, 0 deletions
| diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 4c9890ec2528..473f94e56ead 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -629,6 +629,59 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,  	return 1;  } +static const struct dmifield { +	const char *prefix; +	int field; +} dmi_fields[] = { +	{ "bvn", DMI_BIOS_VENDOR }, +	{ "bvr", DMI_BIOS_VERSION }, +	{ "bd",  DMI_BIOS_DATE }, +	{ "svn", DMI_SYS_VENDOR }, +	{ "pn",  DMI_PRODUCT_NAME }, +	{ "pvr", DMI_PRODUCT_VERSION }, +	{ "rvn", DMI_BOARD_VENDOR }, +	{ "rn",  DMI_BOARD_NAME }, +	{ "rvr", DMI_BOARD_VERSION }, +	{ "cvn", DMI_CHASSIS_VENDOR }, +	{ "ct",  DMI_CHASSIS_TYPE }, +	{ "cvr", DMI_CHASSIS_VERSION }, +	{ NULL,  DMI_NONE } +}; + +static void dmi_ascii_filter(char *d, const char *s) +{ +	/* Filter out characters we don't want to see in the modalias string */ +	for (; *s; s++) +		if (*s > ' ' && *s < 127 && *s != ':') +			*(d++) = *s; + +	*d = 0; +} + + +static int do_dmi_entry(const char *filename, struct dmi_system_id *id, +			char *alias) +{ +	int i, j; + +	sprintf(alias, "dmi*"); + +	for (i = 0; i < ARRAY_SIZE(dmi_fields); i++) { +		for (j = 0; j < 4; j++) { +			if (id->matches[j].slot && +			    id->matches[j].slot == dmi_fields[i].field) { +				sprintf(alias + strlen(alias), ":%s*", +					dmi_fields[i].prefix); +				dmi_ascii_filter(alias + strlen(alias), +						 id->matches[j].substr); +				strcat(alias, "*"); +			} +		} +	} + +	strcat(alias, ":"); +	return 1; +}  /* Ignore any prefix, eg. some architectures prepend _ */  static inline int sym_is(const char *symbol, const char *name)  { @@ -760,6 +813,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,  		do_table(symval, sym->st_size,  			 sizeof(struct i2c_device_id), "i2c",  			 do_i2c_entry, mod); +	else if (sym_is(symname, "__mod_dmi_device_table")) +		do_table(symval, sym->st_size, +			 sizeof(struct dmi_system_id), "dmi", +			 do_dmi_entry, mod);  	free(zeros);  } | 
