From d2ee52aaf30072e4a761e785c752e305ce10152f Mon Sep 17 00:00:00 2001 From: "K. Y. Srinivasan" Date: Thu, 25 Aug 2011 09:48:30 -0700 Subject: Staging: hv: Add code to parse struct hv_vmbus_device_id table Add code to parse struct hv_vmbus_device_id table. Signed-off-by: K. Y. Srinivasan Signed-off-by: Haiyang Zhang Signed-off-by: Greg Kroah-Hartman --- scripts/mod/file2alias.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'scripts') diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index e26e2fb462d4..b74d21ab91f7 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -735,6 +735,27 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id, return 1; } +/* + * Looks like: vmbus:guid + * Each byte of the guid will be represented by two hex characters + * in the name. + */ + +static int do_vmbus_entry(const char *filename, struct hv_vmbus_device_id *id, + char *alias) +{ + int i; + char guid_name[((sizeof(struct hv_vmbus_device_id) + 1)) * 2]; + + for (i = 0; i < (sizeof(struct hv_vmbus_device_id) * 2); i += 2) + sprintf(&guid_name[i], "%02x", id->guid[i/2]); + + strcpy(alias, "vmbus:"); + strcat(alias, guid_name); + + return 1; +} + /* Looks like: i2c:S */ static int do_i2c_entry(const char *filename, struct i2c_device_id *id, char *alias) @@ -994,6 +1015,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_vmbus_device_table")) + do_table(symval, sym->st_size, + sizeof(struct hv_vmbus_device_id), "vmbus", + do_vmbus_entry, mod); else if (sym_is(symname, "__mod_i2c_device_table")) do_table(symval, sym->st_size, sizeof(struct i2c_device_id), "i2c", -- cgit v1.2.3 From ebf16e38515188b61962ba84b59e898ad64ffff6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 25 Aug 2011 11:28:11 -0700 Subject: Staging: hv: file2alias: fix up alias creation logic for hv_vmbus_device_id When I added the driver_data field to hv_vmbus_device_id, I forgot to take into the account how the alias was created, so it would append the kernel pointer to the end of the alias, which is not correct. This changes how the hv_vmbus_device_id alias is created to proper account for the driver_data field. As no module yet uses this alias, it is safe to fix this up at this point in the commit stream. Cc: K. Y. Srinivasan Cc: Haiyang Zhang Signed-off-by: Greg Kroah-Hartman --- scripts/mod/file2alias.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index b74d21ab91f7..f936d1fa969d 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -745,9 +745,9 @@ static int do_vmbus_entry(const char *filename, struct hv_vmbus_device_id *id, char *alias) { int i; - char guid_name[((sizeof(struct hv_vmbus_device_id) + 1)) * 2]; + char guid_name[((sizeof(id->guid) + 1)) * 2]; - for (i = 0; i < (sizeof(struct hv_vmbus_device_id) * 2); i += 2) + for (i = 0; i < (sizeof(id->guid) * 2); i += 2) sprintf(&guid_name[i], "%02x", id->guid[i/2]); strcpy(alias, "vmbus:"); -- cgit v1.2.3