Staging: hv: Introduce a function to map a generic driver pointer to a pointer to...
authorK. Y. Srinivasan <kys@microsoft.com>
Tue, 26 Apr 2011 16:20:21 +0000 (09:20 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 26 Apr 2011 22:51:45 +0000 (15:51 -0700)
In preparation for getting rid of the priv element from struct hv_driver,
introduce a function to map a generic driver pointer to a pointer to
struct netvsc_driver.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/hv/netvsc_api.h

index b4bed36365949d3bcc0ba19cb533c0bbfd223ec4..48b512be07268b4df604d8721e43d4681e199170 100644 (file)
@@ -26,6 +26,7 @@
 #define _NETVSC_API_H_
 
 #include "vmbus_api.h"
+#include "vmbus.h"
 
 /* Fwd declaration */
 struct hv_netvsc_packet;
@@ -103,6 +104,13 @@ struct netvsc_driver {
        void *ctx;
 };
 
+static inline
+struct netvsc_driver *drv_to_netvscdrv(struct device_driver *d)
+{
+       struct hv_driver *hvdrv = drv_to_hv_drv(d);
+       return container_of(hvdrv, struct netvsc_driver, base);
+}
+
 struct netvsc_device_info {
        unsigned char mac_adr[6];
        bool link_state;        /* 0 - link up, 1 - link down */