diff options
| author | Jean Delvare <[email protected]> | 2008-04-29 21:11:39 +0000 |
|---|---|---|
| committer | Jean Delvare <[email protected]> | 2008-04-29 21:11:39 +0000 |
| commit | d2653e92732bd3911feff6bee5e23dbf959381db (patch) | |
| tree | fd3a413bc150855a09de29b2d253b7dbeb2705ff /scripts/mod/file2alias.c | |
| parent | i2c-amd756-s4882: Fix an error path (diff) | |
| download | kernel-d2653e92732bd3911feff6bee5e23dbf959381db.tar.gz kernel-d2653e92732bd3911feff6bee5e23dbf959381db.zip | |
i2c: Add support for device alias names
Based on earlier work by Jon Smirl and Jochen Friedrich.
This patch allows new-style i2c chip drivers to have alias names using
the official kernel aliasing system and MODULE_DEVICE_TABLE(). At this
point, the old i2c driver binding scheme (driver_name/type) is still
supported.
Signed-off-by: Jean Delvare <[email protected]>
Cc: Jochen Friedrich <[email protected]>
Cc: Jon Smirl <[email protected]>
Cc: Kay Sievers <[email protected]>
Diffstat (limited to 'scripts/mod/file2alias.c')
| -rw-r--r-- | scripts/mod/file2alias.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 769b69db89c1..e04c4218cb52 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -576,6 +576,15 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id, return 1; } +/* Looks like: i2c:S */ +static int do_i2c_entry(const char *filename, struct i2c_device_id *id, + char *alias) +{ + sprintf(alias, I2C_MODULE_PREFIX "%s", id->name); + + return 1; +} + /* Ignore any prefix, eg. v850 prepends _ */ static inline int sym_is(const char *symbol, const char *name) { @@ -704,6 +713,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, do_table(symval, sym->st_size, sizeof(struct virtio_device_id), "virtio", do_virtio_entry, mod); + else if (sym_is(symname, "__mod_i2c_device_table")) + do_table(symval, sym->st_size, + sizeof(struct i2c_device_id), "i2c", + do_i2c_entry, mod); free(zeros); } |
