aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2009-09-22 19:46:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:43 -0400
commit75368bf6c2876d8f33abfe77aa3864869a3893eb (patch)
tree97a543508a8aeb45646d059f8cdd561ae0a76ef2 /scripts/mod
parentb5f3294f0be5496aec01e5aa709a5fab8bb2f225 (diff)
spi: add support for device table matching
With this patch spi drivers can use standard spi_driver.id_table and MODULE_DEVICE_TABLE() mechanisms to bind against the devices. Just like we do with I2C drivers. This is useful when a single driver supports several variants of devices but it is not possible to detect them in run-time (like non-JEDEC chips probing in drivers/mtd/devices/m25p80.c), and when platform_data usage is overkill. This patch also makes life a lot easier on OpenFirmware platforms, since with OF we extensively use proper device IDs in modaliases. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: David Brownell <dbrownell@users.sourceforge.net> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Jean Delvare <khali@linux-fr.org> Cc: Ben Dooks <ben-linux@fluff.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/file2alias.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 40e0045876ee..9d446e34519c 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
657 return 1; 657 return 1;
658} 658}
659 659
660/* Looks like: S */
661static int do_spi_entry(const char *filename, struct spi_device_id *id,
662 char *alias)
663{
664 sprintf(alias, "%s", id->name);
665
666 return 1;
667}
668
660static const struct dmifield { 669static const struct dmifield {
661 const char *prefix; 670 const char *prefix;
662 int field; 671 int field;
@@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
853 do_table(symval, sym->st_size, 862 do_table(symval, sym->st_size,
854 sizeof(struct i2c_device_id), "i2c", 863 sizeof(struct i2c_device_id), "i2c",
855 do_i2c_entry, mod); 864 do_i2c_entry, mod);
865 else if (sym_is(symname, "__mod_spi_device_table"))
866 do_table(symval, sym->st_size,
867 sizeof(struct spi_device_id), "spi",
868 do_spi_entry, mod);
856 else if (sym_is(symname, "__mod_dmi_device_table")) 869 else if (sym_is(symname, "__mod_dmi_device_table"))
857 do_table(symval, sym->st_size, 870 do_table(symval, sym->st_size,
858 sizeof(struct dmi_system_id), "dmi", 871 sizeof(struct dmi_system_id), "dmi",