Commit 775ef25e authored by Nicolas Palix's avatar Nicolas Palix Committed by Greg Kroah-Hartman

Staging: hv: Remove typedef DRIVER_OBJECT and PDRIVER_OBJECT

typedef DRIVER_OBJECT and PDRIVER_OBJECT are removed and their usages
are replace by the use of struct hv_driver and struct hv_driver *
respectively.

Here is the semantic patch generated to perform this transformation:
(http://coccinelle.lip6.fr/)

//<smpl>
@rm_DRIVER_OBJECT@
@@
-typedef struct _DRIVER_OBJECT
+struct hv_driver
{...}
-DRIVER_OBJECT
;

@rm_PDRIVER_OBJECT@
@@
-typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
+struct hv_driver;

@fixtypedef_DRIVER_OBJECT@
typedef DRIVER_OBJECT;
@@
-DRIVER_OBJECT
+struct hv_driver

@fixstruct__DRIVER_OBJECT@
@@
struct
-_DRIVER_OBJECT
+hv_driver

@fixtypedef_PDRIVER_OBJECT@
typedef PDRIVER_OBJECT;
@@
-PDRIVER_OBJECT
+struct hv_driver*
//</smpl>
Signed-off-by: default avatarNicolas Palix <npalix@diku.dk>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b7d7ae6f
...@@ -41,7 +41,7 @@ BlkVscOnDeviceAdd( ...@@ -41,7 +41,7 @@ BlkVscOnDeviceAdd(
int int
BlkVscInitialize( BlkVscInitialize(
DRIVER_OBJECT *Driver struct hv_driver *Driver
) )
{ {
STORVSC_DRIVER_OBJECT* storDriver = (STORVSC_DRIVER_OBJECT*)Driver; STORVSC_DRIVER_OBJECT* storDriver = (STORVSC_DRIVER_OBJECT*)Driver;
......
...@@ -51,7 +51,7 @@ NetVscOnDeviceRemove( ...@@ -51,7 +51,7 @@ NetVscOnDeviceRemove(
static void static void
NetVscOnCleanup( NetVscOnCleanup(
DRIVER_OBJECT *Driver struct hv_driver *Driver
); );
static void static void
...@@ -231,7 +231,7 @@ static inline struct NETVSC_DEVICE *ReleaseInboundNetDevice(struct hv_device *De ...@@ -231,7 +231,7 @@ static inline struct NETVSC_DEVICE *ReleaseInboundNetDevice(struct hv_device *De
--*/ --*/
int int
NetVscInitialize( NetVscInitialize(
DRIVER_OBJECT *drv struct hv_driver *drv
) )
{ {
NETVSC_DRIVER_OBJECT* driver = (NETVSC_DRIVER_OBJECT*)drv; NETVSC_DRIVER_OBJECT* driver = (NETVSC_DRIVER_OBJECT*)drv;
...@@ -983,7 +983,7 @@ NetVscOnDeviceRemove( ...@@ -983,7 +983,7 @@ NetVscOnDeviceRemove(
--*/ --*/
void void
NetVscOnCleanup( NetVscOnCleanup(
DRIVER_OBJECT *drv struct hv_driver *drv
) )
{ {
DPRINT_ENTER(NETVSC); DPRINT_ENTER(NETVSC);
......
...@@ -168,7 +168,7 @@ RndisFilterOnDeviceRemove( ...@@ -168,7 +168,7 @@ RndisFilterOnDeviceRemove(
static void static void
RndisFilterOnCleanup( RndisFilterOnCleanup(
DRIVER_OBJECT *Driver struct hv_driver *Driver
); );
static int static int
...@@ -1032,7 +1032,7 @@ RndisFilterOnDeviceRemove( ...@@ -1032,7 +1032,7 @@ RndisFilterOnDeviceRemove(
static void static void
RndisFilterOnCleanup( RndisFilterOnCleanup(
DRIVER_OBJECT *Driver struct hv_driver *Driver
) )
{ {
DPRINT_ENTER(NETVSC); DPRINT_ENTER(NETVSC);
......
...@@ -118,7 +118,7 @@ StorVscOnHostReset( ...@@ -118,7 +118,7 @@ StorVscOnHostReset(
static void static void
StorVscOnCleanup( StorVscOnCleanup(
DRIVER_OBJECT *Device struct hv_driver *Device
); );
static void static void
...@@ -263,7 +263,7 @@ static inline STORVSC_DEVICE* FinalReleaseStorDevice(struct hv_device *Device) ...@@ -263,7 +263,7 @@ static inline STORVSC_DEVICE* FinalReleaseStorDevice(struct hv_device *Device)
--*/ --*/
int int
StorVscInitialize( StorVscInitialize(
DRIVER_OBJECT *Driver struct hv_driver *Driver
) )
{ {
STORVSC_DRIVER_OBJECT* storDriver = (STORVSC_DRIVER_OBJECT*)Driver; STORVSC_DRIVER_OBJECT* storDriver = (STORVSC_DRIVER_OBJECT*)Driver;
...@@ -807,7 +807,7 @@ StorVscOnIORequest( ...@@ -807,7 +807,7 @@ StorVscOnIORequest(
--*/ --*/
void void
StorVscOnCleanup( StorVscOnCleanup(
DRIVER_OBJECT *Driver struct hv_driver *Driver
) )
{ {
DPRINT_ENTER(STORVSC); DPRINT_ENTER(STORVSC);
......
...@@ -45,7 +45,7 @@ static const GUID gVmbusDeviceId={ ...@@ -45,7 +45,7 @@ static const GUID gVmbusDeviceId={
.Data = {0xfc, 0x60, 0x37, 0xac, 0xdf, 0x9a, 0xaa, 0x40, 0x94, 0x27, 0xa7, 0x0e, 0xd6, 0xde, 0x95, 0xc5} .Data = {0xfc, 0x60, 0x37, 0xac, 0xdf, 0x9a, 0xaa, 0x40, 0x94, 0x27, 0xa7, 0x0e, 0xd6, 0xde, 0x95, 0xc5}
}; };
static DRIVER_OBJECT* gDriver; /* vmbus driver object */ static struct hv_driver *gDriver; /* vmbus driver object */
static struct hv_device* gDevice; /* vmbus root device */ static struct hv_device* gDevice; /* vmbus root device */
...@@ -82,22 +82,22 @@ VmbusOnDeviceRemove( ...@@ -82,22 +82,22 @@ VmbusOnDeviceRemove(
static void static void
VmbusOnCleanup( VmbusOnCleanup(
DRIVER_OBJECT* drv struct hv_driver *drv
); );
static int static int
VmbusOnISR( VmbusOnISR(
DRIVER_OBJECT* drv struct hv_driver *drv
); );
static void static void
VmbusOnMsgDPC( VmbusOnMsgDPC(
DRIVER_OBJECT* drv struct hv_driver *drv
); );
static void static void
VmbusOnEventDPC( VmbusOnEventDPC(
DRIVER_OBJECT* drv struct hv_driver *drv
); );
/*++; /*++;
...@@ -111,7 +111,7 @@ VmbusOnEventDPC( ...@@ -111,7 +111,7 @@ VmbusOnEventDPC(
--*/ --*/
int int
VmbusInitialize( VmbusInitialize(
DRIVER_OBJECT* drv struct hv_driver *drv
) )
{ {
VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv; VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv;
...@@ -377,7 +377,7 @@ int VmbusOnDeviceRemove( ...@@ -377,7 +377,7 @@ int VmbusOnDeviceRemove(
--*/ --*/
void void
VmbusOnCleanup( VmbusOnCleanup(
DRIVER_OBJECT* drv struct hv_driver *drv
) )
{ {
/* VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv; */ /* VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv; */
...@@ -401,7 +401,7 @@ VmbusOnCleanup( ...@@ -401,7 +401,7 @@ VmbusOnCleanup(
--*/ --*/
void void
VmbusOnMsgDPC( VmbusOnMsgDPC(
DRIVER_OBJECT* drv struct hv_driver *drv
) )
{ {
void *page_addr = gHvContext.synICMessagePage[0]; void *page_addr = gHvContext.synICMessagePage[0];
...@@ -460,7 +460,7 @@ VmbusOnMsgDPC( ...@@ -460,7 +460,7 @@ VmbusOnMsgDPC(
--*/ --*/
void void
VmbusOnEventDPC( VmbusOnEventDPC(
DRIVER_OBJECT* drv struct hv_driver* drv
) )
{ {
/* TODO: Process any events */ /* TODO: Process any events */
...@@ -479,7 +479,7 @@ VmbusOnEventDPC( ...@@ -479,7 +479,7 @@ VmbusOnEventDPC(
--*/ --*/
int int
VmbusOnISR( VmbusOnISR(
DRIVER_OBJECT* drv struct hv_driver *drv
) )
{ {
/* VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv; */ /* VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv; */
......
...@@ -109,7 +109,7 @@ typedef struct _NETVSC_PACKET { ...@@ -109,7 +109,7 @@ typedef struct _NETVSC_PACKET {
/* Represents the net vsc driver */ /* Represents the net vsc driver */
typedef struct _NETVSC_DRIVER_OBJECT { typedef struct _NETVSC_DRIVER_OBJECT {
DRIVER_OBJECT Base; /* Must be the first field */ struct hv_driver Base; /* Must be the first field */
u32 RingBufferSize; u32 RingBufferSize;
u32 RequestExtSize; u32 RequestExtSize;
...@@ -147,7 +147,7 @@ typedef struct _NETVSC_DEVICE_INFO { ...@@ -147,7 +147,7 @@ typedef struct _NETVSC_DEVICE_INFO {
int int
NetVscInitialize( NetVscInitialize(
DRIVER_OBJECT* drv struct hv_driver *drv
); );
#endif /* _NETVSC_API_H_ */ #endif /* _NETVSC_API_H_ */
...@@ -98,7 +98,7 @@ typedef struct _STORVSC_REQUEST { ...@@ -98,7 +98,7 @@ typedef struct _STORVSC_REQUEST {
/* Represents the block vsc driver */ /* Represents the block vsc driver */
typedef struct _STORVSC_DRIVER_OBJECT { typedef struct _STORVSC_DRIVER_OBJECT {
DRIVER_OBJECT Base; /* Must be the first field */ struct hv_driver Base; /* Must be the first field */
/* Set by caller (in bytes) */ /* Set by caller (in bytes) */
u32 RingBufferSize; u32 RingBufferSize;
...@@ -129,11 +129,11 @@ typedef struct _STORVSC_DEVICE_INFO { ...@@ -129,11 +129,11 @@ typedef struct _STORVSC_DEVICE_INFO {
int int
StorVscInitialize( StorVscInitialize(
DRIVER_OBJECT *Driver struct hv_driver *Driver
); );
int int
BlkVscInitialize( BlkVscInitialize(
DRIVER_OBJECT *Driver struct hv_driver *Driver
); );
#endif /* _STORVSC_API_H_ */ #endif /* _STORVSC_API_H_ */
...@@ -34,13 +34,6 @@ ...@@ -34,13 +34,6 @@
#define MAX_PAGE_BUFFER_COUNT 16 #define MAX_PAGE_BUFFER_COUNT 16
#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */ #define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
/* Fwd declarations */
typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
/* Data types */ /* Data types */
...@@ -68,19 +61,20 @@ typedef struct _MULTIPAGE_BUFFER { ...@@ -68,19 +61,20 @@ typedef struct _MULTIPAGE_BUFFER {
#pragma pack(pop) #pragma pack(pop)
struct hv_driver;
struct hv_device; struct hv_device;
/* All drivers */ /* All drivers */
typedef int (*PFN_ON_DEVICEADD)(struct hv_device *Device, void* AdditionalInfo); typedef int (*PFN_ON_DEVICEADD)(struct hv_device *Device, void* AdditionalInfo);
typedef int (*PFN_ON_DEVICEREMOVE)(struct hv_device *Device); typedef int (*PFN_ON_DEVICEREMOVE)(struct hv_device *Device);
typedef char** (*PFN_ON_GETDEVICEIDS)(void); typedef char** (*PFN_ON_GETDEVICEIDS)(void);
typedef void (*PFN_ON_CLEANUP)(PDRIVER_OBJECT Driver); typedef void (*PFN_ON_CLEANUP)(struct hv_driver *Driver);
/* Vmbus extensions */ /* Vmbus extensions */
/* typedef int (*PFN_ON_MATCH)(struct hv_device *dev, PDRIVER_OBJECT drv); */ /* typedef int (*PFN_ON_MATCH)(struct hv_device *dev, struct hv_driver *drv); */
/* typedef int (*PFN_ON_PROBE)(struct hv_device *dev); */ /* typedef int (*PFN_ON_PROBE)(struct hv_device *dev); */
typedef int (*PFN_ON_ISR)(PDRIVER_OBJECT drv); typedef int (*PFN_ON_ISR)(struct hv_driver *drv);
typedef void (*PFN_ON_DPC)(PDRIVER_OBJECT drv); typedef void (*PFN_ON_DPC)(struct hv_driver *drv);
typedef void (*PFN_GET_CHANNEL_OFFERS)(void); typedef void (*PFN_GET_CHANNEL_OFFERS)(void);
typedef struct hv_device *(*PFN_ON_CHILDDEVICE_CREATE)(GUID DeviceType, GUID DeviceInstance, void *Context); typedef struct hv_device *(*PFN_ON_CHILDDEVICE_CREATE)(GUID DeviceType, GUID DeviceInstance, void *Context);
...@@ -205,7 +199,7 @@ typedef struct _VMBUS_CHANNEL_INTERFACE { ...@@ -205,7 +199,7 @@ typedef struct _VMBUS_CHANNEL_INTERFACE {
typedef void (*VMBUS_GET_CHANNEL_INTERFACE)(VMBUS_CHANNEL_INTERFACE *Interface); typedef void (*VMBUS_GET_CHANNEL_INTERFACE)(VMBUS_CHANNEL_INTERFACE *Interface);
/* Base driver object */ /* Base driver object */
typedef struct _DRIVER_OBJECT { struct hv_driver {
const char* name; const char* name;
GUID deviceType; /* the device type supported by this driver */ GUID deviceType; /* the device type supported by this driver */
...@@ -215,12 +209,12 @@ typedef struct _DRIVER_OBJECT { ...@@ -215,12 +209,12 @@ typedef struct _DRIVER_OBJECT {
PFN_ON_CLEANUP OnCleanup; PFN_ON_CLEANUP OnCleanup;
VMBUS_CHANNEL_INTERFACE VmbusChannelInterface; VMBUS_CHANNEL_INTERFACE VmbusChannelInterface;
} DRIVER_OBJECT; };
/* Base device object */ /* Base device object */
struct hv_device { struct hv_device {
DRIVER_OBJECT* Driver; /* the driver for this device */ struct hv_driver *Driver; /* the driver for this device */
char name[64]; char name[64];
GUID deviceType; /* the device type id of this device */ GUID deviceType; /* the device type id of this device */
GUID deviceInstance; /* the device instance id of this device */ GUID deviceInstance; /* the device instance id of this device */
...@@ -231,7 +225,7 @@ struct hv_device { ...@@ -231,7 +225,7 @@ struct hv_device {
/* Vmbus driver object */ /* Vmbus driver object */
typedef struct _VMBUS_DRIVER_OBJECT { typedef struct _VMBUS_DRIVER_OBJECT {
DRIVER_OBJECT Base; /* !! Must be the 1st field !! */ struct hv_driver Base; /* !! Must be the 1st field !! */
/* Set by the caller */ /* Set by the caller */
PFN_ON_CHILDDEVICE_CREATE OnChildDeviceCreate; PFN_ON_CHILDDEVICE_CREATE OnChildDeviceCreate;
...@@ -257,7 +251,7 @@ typedef struct _VMBUS_DRIVER_OBJECT { ...@@ -257,7 +251,7 @@ typedef struct _VMBUS_DRIVER_OBJECT {
int int
VmbusInitialize( VmbusInitialize(
DRIVER_OBJECT* drv struct hv_driver *drv
); );
#endif /* _VMBUS_API_H_ */ #endif /* _VMBUS_API_H_ */
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
/* Data types */ /* Data types */
typedef int (*PFN_DRIVERINITIALIZE)(DRIVER_OBJECT *drv); typedef int (*PFN_DRIVERINITIALIZE)(struct hv_driver *drv);
typedef int (*PFN_DRIVEREXIT)(DRIVER_OBJECT *drv); typedef int (*PFN_DRIVEREXIT)(struct hv_driver *drv);
struct driver_context { struct driver_context {
GUID class_id; GUID class_id;
......
...@@ -765,7 +765,7 @@ static int vmbus_match(struct device *device, struct device_driver *driver) ...@@ -765,7 +765,7 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
if (memcmp(&device_ctx->class_id, &driver_ctx->class_id, sizeof(GUID)) == 0) if (memcmp(&device_ctx->class_id, &driver_ctx->class_id, sizeof(GUID)) == 0)
{ {
/* !! NOTE: The driver_ctx is not a vmbus_drv_ctx. We typecast it here to access the */ /* !! NOTE: The driver_ctx is not a vmbus_drv_ctx. We typecast it here to access the */
/* DRIVER_OBJECT field */ /* struct hv_driver field */
struct vmbus_driver_context *vmbus_drv_ctx = (struct vmbus_driver_context*)driver_ctx; struct vmbus_driver_context *vmbus_drv_ctx = (struct vmbus_driver_context*)driver_ctx;
device_ctx->device_obj.Driver = &vmbus_drv_ctx->drv_obj.Base; device_ctx->device_obj.Driver = &vmbus_drv_ctx->drv_obj.Base;
DPRINT_INFO(VMBUS_DRV, "device object (%p) set to driver object (%p)", &device_ctx->device_obj, device_ctx->device_obj.Driver); DPRINT_INFO(VMBUS_DRV, "device object (%p) set to driver object (%p)", &device_ctx->device_obj, device_ctx->device_obj.Driver);
......
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