Commit d2ee52aa authored by K. Y. Srinivasan's avatar K. Y. Srinivasan Committed by Greg Kroah-Hartman

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: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a91befc1
...@@ -735,6 +735,27 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id, ...@@ -735,6 +735,27 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id,
return 1; 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 */ /* Looks like: i2c:S */
static int do_i2c_entry(const char *filename, struct i2c_device_id *id, static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
char *alias) char *alias)
...@@ -994,6 +1015,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, ...@@ -994,6 +1015,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
do_table(symval, sym->st_size, do_table(symval, sym->st_size,
sizeof(struct virtio_device_id), "virtio", sizeof(struct virtio_device_id), "virtio",
do_virtio_entry, mod); 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")) else if (sym_is(symname, "__mod_i2c_device_table"))
do_table(symval, sym->st_size, do_table(symval, sym->st_size,
sizeof(struct i2c_device_id), "i2c", sizeof(struct i2c_device_id), "i2c",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment