From 768fa21919b7f30b77f0b3ba94939f5556d111d5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 25 Aug 2011 15:07:32 -0700 Subject: Staging: hv: fix up driver registering mess Individual drivers should never be touching the 'struct device' field, so if that is a requirement to pass to the vmbus core, you know something is wrong. This patch fixes that all up, and resolves the problem where the module reference counting was not happening properly for the individual drivers as well. Overall, it reduces the lines of code the individual drivers have to have, which tells you that this is the correct thing to do. Also, somehow the _GPL marking for the functions got removed on an older patch. As the name of the function was changing, properly change the _GPL marking as well at the same time. Cc: K. Y. Srinivasan Cc: Haiyang Zhang Cc: Hank Janssen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/hv/hv_util.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/staging/hv/hv_util.c') diff --git a/drivers/staging/hv/hv_util.c b/drivers/staging/hv/hv_util.c index b0d89deec765..f2f456f5e444 100644 --- a/drivers/staging/hv/hv_util.c +++ b/drivers/staging/hv/hv_util.c @@ -34,8 +34,6 @@ static u8 *shut_txf_buf; static u8 *time_txf_buf; static u8 *hbeat_txf_buf; -static const char *driver_name = "hv_util"; - static void shutdown_onchannelcallback(void *context) { struct vmbus_channel *channel = context; @@ -244,6 +242,7 @@ MODULE_DEVICE_TABLE(vmbus, id_table); /* The one and only one */ static struct hv_driver util_drv = { + .name = "hv_util", .id_table = id_table, .probe = util_probe, .remove = util_remove, @@ -277,9 +276,7 @@ static int __init init_hyperv_utils(void) hv_cb_utils[HV_KVP_MSG].callback = &hv_kvp_onchannelcallback; - util_drv.driver.name = driver_name; - - return vmbus_child_driver_register(&util_drv.driver); + return vmbus_driver_register(&util_drv); } static void exit_hyperv_utils(void) @@ -311,7 +308,7 @@ static void exit_hyperv_utils(void) kfree(shut_txf_buf); kfree(time_txf_buf); kfree(hbeat_txf_buf); - vmbus_child_driver_unregister(&util_drv.driver); + vmbus_driver_unregister(&util_drv); } module_init(init_hyperv_utils); -- cgit v1.2.3-55-g7522