Skip to contentSkip to conversation

Staging: hv: Transform PDEVICE_OBJECT and DEVICE_OBJECT typedefs into their corresponding structs

PATCH In review Nicolas Palix 5 participants 10 messages Jul 28, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: hv: Transform PDEVICE_OBJECT and DEVICE_OBJECT typedefs into their corresponding structs

Remove typedef DEVICE_OBJECT and use a struct with the same name instead. The new struct name uses lower case (struct device_object).

Remove typedef PDEVICE_OBJECT which aliases a pointer and use the corresponding renamed struct pointer (struct device_object *).

Here is the semantic patch generated to perform this transformation:
(http://www.emn.fr/x-info/coccinelle/)

//<smpl>
@rm_PDEVICE_OBJECT@
@@
-typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;

@rm_DEVICE_OBJECT@
@@
-typedef struct _DEVICE_OBJECT
+struct device_object
{...}
-DEVICE_OBJECT
;

@fixtypedef_PDEVICE_OBJECT@
typedef PDEVICE_OBJECT;
@@
-PDEVICE_OBJECT
+struct device_object*

@fixtypedef_DEVICE_OBJECT@
typedef DEVICE_OBJECT;
@@
-DEVICE_OBJECT
+struct device_object

@fixstruct__DEVICE_OBJECT@
@@
struct
-_DEVICE_OBJECT
+device_object
//</smpl>

---
 drivers/staging/hv/BlkVsc.c             |    4 +-
 drivers/staging/hv/ChannelInterface.c   |   20 ++++++------
 drivers/staging/hv/ChannelInterface.h   |    2 +-
 drivers/staging/hv/ChannelMgmt.h        |    2 +-
 drivers/staging/hv/NetVsc.c             |   52 +++++++++++++++---------------
 drivers/staging/hv/NetVsc.h             |    2 +-
 drivers/staging/hv/RndisFilter.c        |   24 +++++++-------
 drivers/staging/hv/StorVsc.c            |   50 +++++++++++++++---------------
 drivers/staging/hv/Vmbus.c              |   22 ++++++------
 drivers/staging/hv/VmbusPrivate.h       |    8 ++--
 drivers/staging/hv/blkvsc_drv.c         |    4 +-
 drivers/staging/hv/include/NetVscApi.h  |   14 ++++----
 drivers/staging/hv/include/StorVscApi.h |    6 ++--
 drivers/staging/hv/include/VmbusApi.h   |   41 ++++++++++++------------
 drivers/staging/hv/include/vmbus.h      |    4 +-
 drivers/staging/hv/netvsc_drv.c         |   16 +++++-----
 drivers/staging/hv/storvsc_drv.c        |   10 +++---
 drivers/staging/hv/vmbus_drv.c          |   22 ++++++------
 18 files changed, 151 insertions(+), 152 deletions(-)
drivers/staging/hv/BlkVsc.c +2 -2
index dc91aae..1ab2fe9 100644
@@ -34,7 +34,7 @@ static const GUID gBlkVscDeviceType={
 // Static routines
 static int
 BlkVscOnDeviceAdd(
-	DEVICE_OBJECT	*Device,
+	struct device_object	*Device,
 	void			*AdditionalInfo
 	);
 
@@ -77,7 +77,7 @@ BlkVscInitialize(
 
 int
 BlkVscOnDeviceAdd(
-	DEVICE_OBJECT	*Device,
+	struct device_object	*Device,
 	void			*AdditionalInfo
 	)
 {
drivers/staging/hv/ChannelInterface.c +10 -10
index d3b4c14..a7b57d8 100644
@@ -25,7 +25,7 @@
 
 static int
 IVmbusChannelOpen(
-	PDEVICE_OBJECT		Device,
+	struct device_object 		*Device,
 	u32				SendBufferSize,
 	u32				RecvRingBufferSize,
 	void *				UserData,
@@ -46,7 +46,7 @@ IVmbusChannelOpen(
 
 static void
 IVmbusChannelClose(
-	PDEVICE_OBJECT		Device
+	struct device_object 		*Device
 	)
 {
 	VmbusChannelClose((VMBUS_CHANNEL*)Device->context);
@@ -55,7 +55,7 @@ IVmbusChannelClose(
 
 static int
 IVmbusChannelSendPacket(
-	PDEVICE_OBJECT		Device,
+	struct device_object 		*Device,
 	const void *			Buffer,
 	u32				BufferLen,
 	u64				RequestId,
@@ -73,7 +73,7 @@ IVmbusChannelSendPacket(
 
 static int
 IVmbusChannelSendPacketPageBuffer(
-	PDEVICE_OBJECT		Device,
+	struct device_object 		*Device,
 	PAGE_BUFFER			PageBuffers[],
 	u32				PageCount,
 	void *				Buffer,
@@ -91,7 +91,7 @@ IVmbusChannelSendPacketPageBuffer(
 
 static int
 IVmbusChannelSendPacketMultiPageBuffer(
-	PDEVICE_OBJECT		Device,
+	struct device_object 		*Device,
 	MULTIPAGE_BUFFER	*MultiPageBuffer,
 	void *				Buffer,
 	u32				BufferLen,
@@ -107,7 +107,7 @@ IVmbusChannelSendPacketMultiPageBuffer(
 
 static int
 IVmbusChannelRecvPacket (
-	PDEVICE_OBJECT		Device,
+	struct device_object 		*Device,
 	void *				Buffer,
 	u32				BufferLen,
 	u32*				BufferActualLen,
@@ -123,7 +123,7 @@ IVmbusChannelRecvPacket (
 
 static int
 IVmbusChannelRecvPacketRaw(
-	PDEVICE_OBJECT		Device,
+	struct device_object 		*Device,
 	void *				Buffer,
 	u32				BufferLen,
 	u32*				BufferActualLen,
@@ -139,7 +139,7 @@ IVmbusChannelRecvPacketRaw(
 
 static int
 IVmbusChannelEstablishGpadl(
-	PDEVICE_OBJECT		Device,
+	struct device_object 		*Device,
 	void *				Buffer,
 	u32				BufferLen,
 	u32*				GpadlHandle
@@ -153,7 +153,7 @@ IVmbusChannelEstablishGpadl(
 
 static int
 IVmbusChannelTeardownGpadl(
-   PDEVICE_OBJECT		Device,
+   struct device_object 		*Device,
    u32				GpadlHandle
 	)
 {
@@ -182,7 +182,7 @@ GetChannelInterface(
 
 static void
 GetChannelInfo(
-	PDEVICE_OBJECT		Device,
+	struct device_object 		*Device,
 	DEVICE_INFO			*DeviceInfo
 			   )
 {
drivers/staging/hv/ChannelInterface.h +1 -1
index c459e0e..184cff5 100644
@@ -34,7 +34,7 @@ GetChannelInterface(
 
 static void
 GetChannelInfo(
-	PDEVICE_OBJECT		Device,
+	struct device_object 		*Device,
 	DEVICE_INFO			*DeviceInfo
 	);
 
drivers/staging/hv/ChannelMgmt.h +1 -1
index b7afeca..972f878 100644
@@ -45,7 +45,7 @@ typedef enum {
 typedef struct _VMBUS_CHANNEL {
 	LIST_ENTRY					ListEntry;
 
-	DEVICE_OBJECT*				DeviceObject;
+	struct device_object				*DeviceObject;
 
 	HANDLE						PollTimer; // SA-111 workaround
 
drivers/staging/hv/NetVsc.c +26 -26

198 lines not on this page · raw message

drivers/staging/hv/NetVsc.h +1 -1
index d6b0d67..c30472a 100644
@@ -55,7 +55,7 @@
 
 // Per netvsc channel-specific
 typedef struct _NETVSC_DEVICE {
-	DEVICE_OBJECT					*Device;
+	struct device_object *Device;
 
 	int								RefCount;
 
drivers/staging/hv/RndisFilter.c +12 -12
index 714f23e..9597ab4 100644
@@ -112,7 +112,7 @@ RndisFilterReceiveData(
 
 static int
 RndisFilterOnReceive(
-	DEVICE_OBJECT		*Device,
+	struct device_object *Device,
 	NETVSC_PACKET		*Packet
 	);
 
@@ -157,13 +157,13 @@ RndisFilterCloseDevice(
 
 static int
 RndisFilterOnDeviceAdd(
-	DEVICE_OBJECT	*Device,
+	struct device_object *Device,
 	void			*AdditionalInfo
 	);
 
 static int
 RndisFilterOnDeviceRemove(
-	DEVICE_OBJECT *Device
+	struct device_object *Device
 	);
 
 static void
@@ -173,17 +173,17 @@ RndisFilterOnCleanup(
 
 static int
 RndisFilterOnOpen(
-	DEVICE_OBJECT		*Device
+	struct device_object *Device
 	);
 
 static int
 RndisFilterOnClose(
-	DEVICE_OBJECT		*Device
+	struct device_object *Device
 	);
 
 static int
 RndisFilterOnSend(
-	DEVICE_OBJECT		*Device,
+	struct device_object *Device,
 	NETVSC_PACKET		*Packet
 	);
 
@@ -490,7 +490,7 @@ RndisFilterReceiveData(
 
 static int
 RndisFilterOnReceive(
-	DEVICE_OBJECT		*Device,
+	struct device_object *Device,
 	NETVSC_PACKET		*Packet
 	)
 {
@@ -928,7 +928,7 @@ RndisFilterCloseDevice(
 
 int
 RndisFilterOnDeviceAdd(
-	DEVICE_OBJECT	*Device,
+	struct device_object *Device,
 	void			*AdditionalInfo
 	)
 {
@@ -1007,7 +1007,7 @@ RndisFilterOnDeviceAdd(
 
 static int
 RndisFilterOnDeviceRemove(
-	DEVICE_OBJECT *Device
+	struct device_object *Device
 	)
 {
 	NETVSC_DEVICE *netDevice = (NETVSC_DEVICE*)Device->Extension;
@@ -1042,7 +1042,7 @@ RndisFilterOnCleanup(
 
 static int
 RndisFilterOnOpen(
-	DEVICE_OBJECT		*Device
+	struct device_object *Device
 	)
 {
 	int ret;
@@ -1060,7 +1060,7 @@ RndisFilterOnOpen(
 
 static int
 RndisFilterOnClose(
-	DEVICE_OBJECT		*Device
+	struct device_object *Device
 	)
 {
 	int ret;
@@ -1079,7 +1079,7 @@ RndisFilterOnClose(
 
 static int
 RndisFilterOnSend(
-	DEVICE_OBJECT		*Device,
+	struct device_object *Device,
 	NETVSC_PACKET		*Packet
 	)
 {
drivers/staging/hv/StorVsc.c +25 -25

192 lines not on this page · raw message

drivers/staging/hv/Vmbus.c +11 -11
index 72bb08f..4df935e 100644
@@ -44,7 +44,7 @@ static const GUID gVmbusDeviceId={
 };
 
 static DRIVER_OBJECT* gDriver; // vmbus driver object
-static DEVICE_OBJECT* gDevice; // vmbus root device
+static struct device_object *gDevice; // vmbus root device
 
 
 //
@@ -58,7 +58,7 @@ VmbusGetChannelInterface(
 
 static void
 VmbusGetChannelInfo(
-	DEVICE_OBJECT	*DeviceObject,
+	struct device_object *DeviceObject,
 	DEVICE_INFO		*DeviceInfo
 	);
 
@@ -69,13 +69,13 @@ VmbusGetChannelOffers(
 
 static int
 VmbusOnDeviceAdd(
-	DEVICE_OBJECT	*Device,
+	struct device_object *Device,
 	void			*AdditionalInfo
 	);
 
 static int
 VmbusOnDeviceRemove(
-	DEVICE_OBJECT* dev
+	struct device_object *dev
 	);
 
 static void
@@ -203,7 +203,7 @@ Description:
 --*/
 static void
 VmbusGetChannelInfo(
-	DEVICE_OBJECT	*DeviceObject,
+	struct device_object *DeviceObject,
 	DEVICE_INFO		*DeviceInfo
 	)
 {
@@ -222,7 +222,7 @@ Description:
 
 --*/
 
-DEVICE_OBJECT*
+struct device_object *
 VmbusChildDeviceCreate(
 	GUID DeviceType,
 	GUID DeviceInstance,
@@ -248,7 +248,7 @@ Description:
 --*/
 int
 VmbusChildDeviceAdd(
-   DEVICE_OBJECT* ChildDevice)
+   struct device_object *ChildDevice)
 {
 	VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
 
@@ -267,7 +267,7 @@ Description:
 --*/
 void
 VmbusChildDeviceRemove(
-   DEVICE_OBJECT* ChildDevice)
+   struct device_object *ChildDevice)
 {
 	VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
 
@@ -285,7 +285,7 @@ Description:
 --*/
 //void
 //VmbusChildDeviceDestroy(
-//	DEVICE_OBJECT* ChildDevice
+//	struct device_object *ChildDevice
 //	)
 //{
 //	VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
@@ -304,7 +304,7 @@ Description:
 --*/
 static int
 VmbusOnDeviceAdd(
-	DEVICE_OBJECT	*dev,
+	struct device_object *dev,
 	void			*AdditionalInfo
 	)
 {
@@ -342,7 +342,7 @@ Description:
 
 --*/
 int VmbusOnDeviceRemove(
-	DEVICE_OBJECT* dev
+	struct device_object *dev
 	)
 {
 	int ret=0;
drivers/staging/hv/VmbusPrivate.h +4 -4
index 686d05f..5dedaaf 100644
@@ -110,7 +110,7 @@ extern VMBUS_CONNECTION gVmbusConnection;
 //
 // General vmbus interface
 //
-static DEVICE_OBJECT*
+static struct device_object *
 VmbusChildDeviceCreate(
 	GUID deviceType,
 	GUID deviceInstance,
@@ -118,15 +118,15 @@ VmbusChildDeviceCreate(
 
 static int
 VmbusChildDeviceAdd(
-	DEVICE_OBJECT* Device);
+	struct device_object *Device);
 
 static void
 VmbusChildDeviceRemove(
-   DEVICE_OBJECT* Device);
+   struct device_object *Device);
 
 //static void
 //VmbusChildDeviceDestroy(
-//	DEVICE_OBJECT*);
+//	struct device_object *);
 
 static VMBUS_CHANNEL*
 GetChannelFromRelId(
drivers/staging/hv/blkvsc_drv.c +2 -2
index d902653..5cc9097 100644
@@ -260,7 +260,7 @@ static int blkvsc_probe(struct device *device)
 	STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &blkvsc_drv_ctx->drv_obj;
 
 	struct device_context *device_ctx = device_to_device_context(device);
-	DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+	struct device_object *device_obj = &device_ctx->device_obj;
 
 	struct block_device_context *blkdev=NULL;
 	STORVSC_DEVICE_INFO device_info;
@@ -763,7 +763,7 @@ static int blkvsc_remove(struct device *device)
 	STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &blkvsc_drv_ctx->drv_obj;
 
 	struct device_context *device_ctx = device_to_device_context(device);
-	DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+	struct device_object *device_obj = &device_ctx->device_obj;
 	struct block_device_context *blkdev = dev_get_drvdata(device);
 	unsigned long flags;
 
drivers/staging/hv/include/NetVscApi.h +7 -7
index 626054b..5b2782c 100644
@@ -44,15 +44,15 @@ typedef struct _NETVSC_PACKET	*PNETVSC_PACKET;
 // Data types
 //
 
-typedef int (*PFN_ON_OPEN)(DEVICE_OBJECT *Device);
-typedef int (*PFN_ON_CLOSE)(DEVICE_OBJECT *Device);
+typedef int (*PFN_ON_OPEN)(struct device_object *Device);
+typedef int (*PFN_ON_CLOSE)(struct device_object *Device);
 
-typedef void (*PFN_QUERY_LINKSTATUS)(DEVICE_OBJECT *Device);
-typedef int (*PFN_ON_SEND)(DEVICE_OBJECT *dev, PNETVSC_PACKET packet);
+typedef void (*PFN_QUERY_LINKSTATUS)(struct device_object *Device);
+typedef int (*PFN_ON_SEND)(struct device_object *dev, PNETVSC_PACKET packet);
 typedef void (*PFN_ON_SENDRECVCOMPLETION)(void * Context);
 
-typedef int (*PFN_ON_RECVCALLBACK)(DEVICE_OBJECT *dev, PNETVSC_PACKET packet);
-typedef void (*PFN_ON_LINKSTATUS_CHANGED)(DEVICE_OBJECT *dev, u32 Status);
+typedef int (*PFN_ON_RECVCALLBACK)(struct device_object *dev, PNETVSC_PACKET packet);
+typedef void (*PFN_ON_LINKSTATUS_CHANGED)(struct device_object *dev, u32 Status);
 
 // Represent the xfer page packet which contains 1 or more netvsc packet
 typedef struct _XFERPAGE_PACKET {
@@ -71,7 +71,7 @@ typedef struct _NETVSC_PACKET {
 	// Bookkeeping stuff
 	DLIST_ENTRY				ListEntry;
 
-	DEVICE_OBJECT			*Device;
+	struct device_object			*Device;
 	bool					IsDataPacket;
 
 	// Valid only for receives when we break a xfer page packet into multiple netvsc packets
drivers/staging/hv/include/StorVscApi.h +3 -3
index f50fee7..c98d18c 100644
@@ -54,11 +54,11 @@ typedef struct _STORVSC_REQUEST* PSTORVSC_REQUEST;
 //
 // Data types
 //
-typedef int (*PFN_ON_IO_REQUEST)(PDEVICE_OBJECT Device, PSTORVSC_REQUEST Request);
+typedef int (*PFN_ON_IO_REQUEST)(struct device_object *Device, PSTORVSC_REQUEST Request);
 typedef void (*PFN_ON_IO_REQUEST_COMPLTN)(PSTORVSC_REQUEST Request);
 
-typedef int (*PFN_ON_HOST_RESET)(PDEVICE_OBJECT Device);
-typedef void (*PFN_ON_HOST_RESCAN)(PDEVICE_OBJECT Device);
+typedef int (*PFN_ON_HOST_RESET)(struct device_object *Device);
+typedef void (*PFN_ON_HOST_RESCAN)(struct device_object *Device);
 
 
 // Matches Windows-end
drivers/staging/hv/include/VmbusApi.h +20 -21

129 lines not on this page · raw message

drivers/staging/hv/include/vmbus.h +2 -2
index 62ddc1d..e964d85 100644
@@ -53,7 +53,7 @@ struct device_context {
 	GUID					device_id;
 	int						probe_error;
 	struct device			device;
-	DEVICE_OBJECT			device_obj;
+	struct device_object		device_obj;
 };
 
 
@@ -64,7 +64,7 @@ struct device_context {
 //
 // Inlines
 //
-static inline struct device_context *to_device_context(DEVICE_OBJECT *device_obj)
+static inline struct device_context *to_device_context(struct device_object *device_obj)
 {
 	return container_of(device_obj, struct device_context, device_obj);
 }
drivers/staging/hv/netvsc_drv.c +8 -8
index 20adcc6..551be97 100644
@@ -51,10 +51,10 @@ static int netvsc_remove(struct device *device);
 static int netvsc_open(struct net_device *net);
 static void netvsc_xmit_completion(void *context);
 static int netvsc_start_xmit (struct sk_buff *skb, struct net_device *net);
-static int netvsc_recv_callback(DEVICE_OBJECT *device_obj, NETVSC_PACKET* Packet);
+static int netvsc_recv_callback(struct device_object *device_obj, NETVSC_PACKET *Packet);
 static int netvsc_close(struct net_device *net);
 static struct net_device_stats *netvsc_get_stats(struct net_device *net);
-static void netvsc_linkstatus_callback(DEVICE_OBJECT *device_obj, unsigned int status);
+static void netvsc_linkstatus_callback(struct device_object *device_obj, unsigned int status);
 
 //
 // Data types
@@ -172,7 +172,7 @@ static int netvsc_probe(struct device *device)
 	NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj;
 
 	struct device_context *device_ctx = device_to_device_context(device);
-	DEVICE_OBJECT *device_obj = &device_ctx->device_obj;
+	struct device_object *device_obj = &device_ctx->device_obj;
 
 	struct net_device *net = NULL;
 	struct net_device_context *net_device_ctx;
@@ -249,7 +249,7 @@ static int netvsc_remove(struct device *device)
 
 	struct device_context *device_ctx = device_to_device_context(device);
 	struct net_device *net = dev_get_drvdata(&device_ctx->device);
-	DEVICE_OBJECT *device_obj = &device_ctx->device_obj;
+	struct device_object *device_obj = &device_ctx->device_obj;
 
 	DPRINT_ENTER(NETVSC_DRV);
 
@@ -302,7 +302,7 @@ static int netvsc_open(struct net_device *net)
 	struct netvsc_driver_context *net_drv_ctx = (struct netvsc_driver_context*)driver_ctx;
 	NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj;
 
-	DEVICE_OBJECT *device_obj = &net_device_ctx->device_ctx->device_obj;
+	struct device_object *device_obj = &net_device_ctx->device_ctx->device_obj;
 
 	DPRINT_ENTER(NETVSC_DRV);
 
@@ -344,7 +344,7 @@ static int netvsc_close(struct net_device *net)
 	struct netvsc_driver_context *net_drv_ctx = (struct netvsc_driver_context*)driver_ctx;
 	NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj;
 
-	DEVICE_OBJECT *device_obj = &net_device_ctx->device_ctx->device_obj;
+	struct device_object *device_obj = &net_device_ctx->device_ctx->device_obj;
 
 	DPRINT_ENTER(NETVSC_DRV);
 
@@ -515,7 +515,7 @@ Name:	netvsc_linkstatus_callback()
 Desc:	Link up/down notification
 
 --*/
-static void netvsc_linkstatus_callback(DEVICE_OBJECT *device_obj, unsigned int status)
+static void netvsc_linkstatus_callback(struct device_object *device_obj, unsigned int status)
 {
 	struct device_context* device_ctx = to_device_context(device_obj);
 	struct net_device* net = dev_get_drvdata(&device_ctx->device);
@@ -549,7 +549,7 @@ Name:	netvsc_recv_callback()
 Desc:	Callback when we receive a packet from the "wire" on the specify device
 
 --*/
-static int netvsc_recv_callback(DEVICE_OBJECT *device_obj, NETVSC_PACKET* packet)
+static int netvsc_recv_callback(struct device_object *device_obj, NETVSC_PACKET* packet)
 {
 	int ret=0;
 	struct device_context *device_ctx = to_device_context(device_obj);
drivers/staging/hv/storvsc_drv.c +4 -5
index 62aeb27..cafc2a9 100644
@@ -82,7 +82,7 @@ static int storvsc_device_alloc(struct scsi_device *);
 static int storvsc_device_configure(struct scsi_device *);
 static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);
 static void storvsc_host_rescan_callback(struct work_struct *work);
-static void storvsc_host_rescan(DEVICE_OBJECT* device_obj);
+static void storvsc_host_rescan(struct device_object *device_obj);
 static int storvsc_remove(struct device *dev);
 
 static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count, unsigned int len);
@@ -233,7 +233,7 @@ static int storvsc_probe(struct device *device)
 	STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &storvsc_drv_ctx->drv_obj;
 
 	struct device_context *device_ctx = device_to_device_context(device);
-	DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+	struct device_object *device_obj = &device_ctx->device_obj;
 
 	struct Scsi_Host *host;
 	struct host_device_context *host_device_ctx;
@@ -336,7 +336,7 @@ static int storvsc_remove(struct device *device)
 	STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &storvsc_drv_ctx->drv_obj;
 
 	struct device_context *device_ctx = device_to_device_context(device);
-	DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+	struct device_object *device_obj = &device_ctx->device_obj;
 
 	struct Scsi_Host *host = dev_get_drvdata(device);
 	struct host_device_context *host_device_ctx=(struct host_device_context*)host->hostdata;
@@ -912,7 +912,7 @@ Desc:	Rescan the scsi HBA
 --*/
 static void storvsc_host_rescan_callback(struct work_struct *work)
 {
-	DEVICE_OBJECT* device_obj +	struct device_object *device_obj  	    &((struct host_device_context*)work)->device_ctx->device_obj;
 	struct device_context* device_ctx = to_device_context(device_obj);
 	struct Scsi_Host *host = dev_get_drvdata(&device_ctx->device);
@@ -1076,7 +1076,7 @@ static int storvsc_report_luns(struct scsi_device *sdev, unsigned int luns[], un
 	return 0;
 }
 
-static void storvsc_host_rescan(DEVICE_OBJECT* device_obj)
+static void storvsc_host_rescan(struct device_object *device_obj)
 {
 	struct device_context* device_ctx = to_device_context(device_obj);
 	struct Scsi_Host *host = dev_get_drvdata(&device_ctx->device);
drivers/staging/hv/vmbus_drv.c +11 -11
index e615610..8e4146f 100644
@@ -75,11 +75,11 @@ static irqreturn_t vmbus_isr(int irq, void* dev_id);
 static void vmbus_device_release(struct device *device);
 static void vmbus_bus_release(struct device *device);
 
-static DEVICE_OBJECT* vmbus_child_device_create(GUID type, GUID instance, void* context);
-static void vmbus_child_device_destroy(DEVICE_OBJECT* device_obj);
-static int vmbus_child_device_register(DEVICE_OBJECT* root_device_obj, DEVICE_OBJECT* child_device_obj);
-static void vmbus_child_device_unregister(DEVICE_OBJECT* child_device_obj);
-static void vmbus_child_device_get_info(DEVICE_OBJECT *device_obj, DEVICE_INFO *device_info);
+static struct device_object *vmbus_child_device_create(GUID type, GUID instance, void *context);
+static void vmbus_child_device_destroy(struct device_object *device_obj);
+static int vmbus_child_device_register(struct device_object *root_device_obj, struct device_object *child_device_obj);
+static void vmbus_child_device_unregister(struct device_object *child_device_obj);
+static void vmbus_child_device_get_info(struct device_object *device_obj, DEVICE_INFO *device_info);
 
 //static ssize_t vmbus_show_class_id(struct device *dev, struct device_attribute *attr, char *buf);
 //static ssize_t vmbus_show_device_id(struct device *dev, struct device_attribute *attr, char *buf);
@@ -551,7 +551,7 @@ Name:	vmbus_child_device_get_info()
 
 Desc:	Get the vmbus child device info. This is invoked to display various device attributes in sysfs.
 --*/
-static void vmbus_child_device_get_info(DEVICE_OBJECT *device_obj, DEVICE_INFO *device_info)
+static void vmbus_child_device_get_info(struct device_object *device_obj, DEVICE_INFO *device_info)
 {
 	VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
 
@@ -566,10 +566,10 @@ Name:	vmbus_child_device_create()
 Desc:	Creates and registers a new child device on the vmbus.
 
 --*/
-static DEVICE_OBJECT* vmbus_child_device_create(GUID type, GUID instance, void* context)
+static struct device_object *vmbus_child_device_create(GUID type, GUID instance, void* context)
 {
 	struct device_context *child_device_ctx;
-	DEVICE_OBJECT* child_device_obj;
+	struct device_object *child_device_obj;
 
 	DPRINT_ENTER(VMBUS_DRV);
 
@@ -610,7 +610,7 @@ Name:	vmbus_child_device_register()
 Desc:	Register the child device on the specified bus
 
 --*/
-static int vmbus_child_device_register(DEVICE_OBJECT* root_device_obj, DEVICE_OBJECT* child_device_obj)
+static int vmbus_child_device_register(struct device_object *root_device_obj, struct device_object *child_device_obj)
 {
 	int ret=0;
 	struct device_context *root_device_ctx = to_device_context(root_device_obj);
@@ -664,7 +664,7 @@ Name:	vmbus_child_device_unregister()
 Desc:	Remove the specified child device from the vmbus.
 
 --*/
-static void vmbus_child_device_unregister(DEVICE_OBJECT* device_obj)
+static void vmbus_child_device_unregister(struct device_object *device_obj)
 {
 	struct device_context *device_ctx = to_device_context(device_obj);
 
@@ -689,7 +689,7 @@ Name:	vmbus_child_device_destroy()
 Desc:	Destroy the specified child device on the vmbus.
 
 --*/
-static void vmbus_child_device_destroy(DEVICE_OBJECT* device_obj)
+static void vmbus_child_device_destroy(struct device_object *device_obj)
 {
 	DPRINT_ENTER(VMBUS_DRV);
 
Signature · 1 line
1.6.0.4
#1 lore raw
Quoted 9 lines · Nicolas Palix

Remove typedef DEVICE_OBJECT and use a struct with the same name instead. The new struct name uses lower case (struct device_object).

Remove typedef PDEVICE_OBJECT which aliases a pointer and use the corresponding renamed struct pointer (struct device_object *).

Here is the semantic patch generated to perform this transformation:
(http://www.emn.fr/x-info/coccinelle/)

The patch looks technically correct and improves the code, but I'd suggest renaming the structure to fall into a proper namespace. The name device_object is extremely generic and should not be defined as part of a single driver.
Simply putting it into a namespace here would make it hv_device_object, or even mshv_device_object ('hv' still is very generic), but then the 'object' part is still redundant. Since it is part of the 'vmbus' layer, how about naming it 'struct vmbus_device'?

	Arnd <><
#2 lore raw

Arnd,

Excellent suggestion. I will submit a patch to call it hv_vmbus_device which makes it even more clear.

Thanks,

Hank.

Quoted 15 lines · Arnd Bergmann
Quoted 2 lines

The patch looks technically correct and improves the code, but I'd suggest renaming the structure to fall into a proper namespace. The name device_object is extremely generic and should not be defined as part of a single driver.
Simply putting it into a namespace here would make it hv_device_object,
or even mshv_device_object ('hv' still is very generic), but then the 'object' part is still redundant. Since it is part of the 'vmbus' layer, how about naming it 'struct vmbus_device'?

       Arnd <><
#3 lore raw
Quoted 2 lines · Hank Janssen

Excellent suggestion. I will submit a patch to call it hv_vmbus_device which makes it even more clear.

Ok. IMHO it's also important to keep the name space consistent, so if you name it hv_vmbus_device instead of vmbus_device, you should consequently also rename all other vmbus_* names to hv_vmbus_* in follow-on patches. If you don't plan to do that, I guess vmbus_device is fine as well.

	Arnd <><
#4 lore raw
In reply to Nicolas Palix
Quoted 3 lines · Nicolas Palix

Remove typedef DEVICE_OBJECT and use a struct with the same name instead. The new struct name uses lower case (struct device_object).

This should be called "struct hv_device" instead, care to respin the patch like that to keep us from having to change it again? :)

thanks,

greg k-h

#5 lore raw
Quoted 5 lines · On Tuesday 28 July 2009 16:41:23 Greg KH wrote:
Quoted 3 lines · Nicolas Palix

Remove typedef DEVICE_OBJECT and use a struct with the same name instead. The new struct name uses lower case (struct device_object).

Quoted 7 lines

This should be called "struct hv_device" instead, care to respin the patch like that to keep us from having to change it again? :)

thanks,

greg k-h

Ok. So, I guess the pattern for the other typedef is to strip the _OBJECT suffix when present, and always add the prefix hv_, right ?

Signature · 1 line
Nicolas Palix
#6 lore raw
Quoted 2 lines · Nicolas Palix

Ok. So, I guess the pattern for the other typedef is to strip the _OBJECT suffix when present, and always add the prefix hv_, right ?

The 'pattern' is to look at what the code is doing and choose a sensible name.

Signature · 4 lines
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#7 lore raw
Quoted 6 lines · Matthew Wilcox
Quoted 2 lines · Nicolas Palix

Ok. So, I guess the pattern for the other typedef is to strip the _OBJECT suffix when present, and always add the prefix hv_, right ?

The 'pattern' is to look at what the code is doing and choose a sensible name.

Heh, yes. It can be hard, I know I suck at picking names for structures and functions at times, but try to make it unique and descriptive for what it is doing.

thanks,

greg "struct class" k-h

#8 lore raw
In reply to Matthew Wilcox
Quoted 6 lines · Matthew Wilcox
Quoted 2 lines · Nicolas Palix

Ok. So, I guess the pattern for the other typedef is to strip the _OBJECT suffix when present, and always add the prefix hv_, right ?

The 'pattern' is to look at what the code is doing and choose a sensible name.

I took a closer look at how this is used and noticed that there is both the DEVICE_OBJECT typedef and struct device_context. While I don't understand the reason for the split, my feeling is that the contents of DEVICE_OBJECT should really be moved into device_context and that one be renamed to hv_device.

	Arnd <><
#9 lore raw
In reply to Greg KH

Remove typedef DEVICE_OBJECT and use a struct named hv_device instead. Remove typedef PDEVICE_OBJECT which aliases a pointer and use struct hv_device * instead.

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

//<smpl>
@rm_PDEVICE_OBJECT@
@@
-typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;

@rm_DEVICE_OBJECT@
@@
-typedef struct _DEVICE_OBJECT
+struct hv_device
{...}
-DEVICE_OBJECT
;

@fixtypedef_PDEVICE_OBJECT@
typedef PDEVICE_OBJECT;
@@
-PDEVICE_OBJECT
+struct hv_device*

@fixtypedef_DEVICE_OBJECT@
typedef DEVICE_OBJECT;
@@
-DEVICE_OBJECT
+struct hv_device

@fixstruct__DEVICE_OBJECT@
@@
struct
-_DEVICE_OBJECT
+hv_device
//</smpl>

---
 drivers/staging/hv/BlkVsc.c             |    4 +-
 drivers/staging/hv/ChannelInterface.c   |   20 ++++++------
 drivers/staging/hv/ChannelInterface.h   |    2 +-
 drivers/staging/hv/ChannelMgmt.h        |    2 +-
 drivers/staging/hv/NetVsc.c             |   52 +++++++++++++++---------------
 drivers/staging/hv/NetVsc.h             |    2 +-
 drivers/staging/hv/RndisFilter.c        |   24 +++++++-------
 drivers/staging/hv/StorVsc.c            |   50 +++++++++++++++---------------
 drivers/staging/hv/Vmbus.c              |   22 ++++++------
 drivers/staging/hv/VmbusPrivate.h       |    8 ++--
 drivers/staging/hv/blkvsc_drv.c         |    4 +-
 drivers/staging/hv/include/NetVscApi.h  |   14 ++++----
 drivers/staging/hv/include/StorVscApi.h |    6 ++--
 drivers/staging/hv/include/VmbusApi.h   |   41 ++++++++++++------------
 drivers/staging/hv/include/vmbus.h      |    4 +-
 drivers/staging/hv/netvsc_drv.c         |   16 +++++-----
 drivers/staging/hv/storvsc_drv.c        |   10 +++---
 drivers/staging/hv/vmbus_drv.c          |   22 ++++++------
 18 files changed, 151 insertions(+), 152 deletions(-)
drivers/staging/hv/BlkVsc.c +2 -2
index 7903a77..059b134 100644
@@ -34,7 +34,7 @@ static const GUID gBlkVscDeviceType={
 /* Static routines */
 static int
 BlkVscOnDeviceAdd(
-	DEVICE_OBJECT	*Device,
+	struct hv_device *Device,
 	void			*AdditionalInfo
 	);
 
@@ -77,7 +77,7 @@ BlkVscInitialize(
 
 int
 BlkVscOnDeviceAdd(
-	DEVICE_OBJECT	*Device,
+	struct hv_device *Device,
 	void			*AdditionalInfo
 	)
 {
drivers/staging/hv/ChannelInterface.c +10 -10
index d3b4c14..2a58015 100644
@@ -25,7 +25,7 @@
 
 static int
 IVmbusChannelOpen(
-	PDEVICE_OBJECT		Device,
+	struct hv_device *Device,
 	u32				SendBufferSize,
 	u32				RecvRingBufferSize,
 	void *				UserData,
@@ -46,7 +46,7 @@ IVmbusChannelOpen(
 
 static void
 IVmbusChannelClose(
-	PDEVICE_OBJECT		Device
+	struct hv_device *Device
 	)
 {
 	VmbusChannelClose((VMBUS_CHANNEL*)Device->context);
@@ -55,7 +55,7 @@ IVmbusChannelClose(
 
 static int
 IVmbusChannelSendPacket(
-	PDEVICE_OBJECT		Device,
+	struct hv_device *Device,
 	const void *			Buffer,
 	u32				BufferLen,
 	u64				RequestId,
@@ -73,7 +73,7 @@ IVmbusChannelSendPacket(
 
 static int
 IVmbusChannelSendPacketPageBuffer(
-	PDEVICE_OBJECT		Device,
+	struct hv_device *Device,
 	PAGE_BUFFER			PageBuffers[],
 	u32				PageCount,
 	void *				Buffer,
@@ -91,7 +91,7 @@ IVmbusChannelSendPacketPageBuffer(
 
 static int
 IVmbusChannelSendPacketMultiPageBuffer(
-	PDEVICE_OBJECT		Device,
+	struct hv_device *Device,
 	MULTIPAGE_BUFFER	*MultiPageBuffer,
 	void *				Buffer,
 	u32				BufferLen,
@@ -107,7 +107,7 @@ IVmbusChannelSendPacketMultiPageBuffer(
 
 static int
 IVmbusChannelRecvPacket (
-	PDEVICE_OBJECT		Device,
+	struct hv_device *Device,
 	void *				Buffer,
 	u32				BufferLen,
 	u32*				BufferActualLen,
@@ -123,7 +123,7 @@ IVmbusChannelRecvPacket (
 
 static int
 IVmbusChannelRecvPacketRaw(
-	PDEVICE_OBJECT		Device,
+	struct hv_device *Device,
 	void *				Buffer,
 	u32				BufferLen,
 	u32*				BufferActualLen,
@@ -139,7 +139,7 @@ IVmbusChannelRecvPacketRaw(
 
 static int
 IVmbusChannelEstablishGpadl(
-	PDEVICE_OBJECT		Device,
+	struct hv_device *Device,
 	void *				Buffer,
 	u32				BufferLen,
 	u32*				GpadlHandle
@@ -153,7 +153,7 @@ IVmbusChannelEstablishGpadl(
 
 static int
 IVmbusChannelTeardownGpadl(
-   PDEVICE_OBJECT		Device,
+   struct hv_device *Device,
    u32				GpadlHandle
 	)
 {
@@ -182,7 +182,7 @@ GetChannelInterface(
 
 static void
 GetChannelInfo(
-	PDEVICE_OBJECT		Device,
+	struct hv_device *Device,
 	DEVICE_INFO			*DeviceInfo
 			   )
 {
drivers/staging/hv/ChannelInterface.h +1 -1
index edd1c37..3385914 100644
@@ -34,7 +34,7 @@ GetChannelInterface(
 
 static void
 GetChannelInfo(
-	PDEVICE_OBJECT		Device,
+	struct hv_device *Device,
 	DEVICE_INFO			*DeviceInfo
 	);
 
drivers/staging/hv/ChannelMgmt.h +1 -1
index 5831d19..6208cd8 100644
@@ -45,7 +45,7 @@ typedef enum {
 typedef struct _VMBUS_CHANNEL {
 	LIST_ENTRY					ListEntry;
 
-	DEVICE_OBJECT*				DeviceObject;
+	struct hv_device *DeviceObject;
 
 	HANDLE						PollTimer; /* SA-111 workaround */
 
drivers/staging/hv/NetVsc.c +26 -26

198 lines not on this page · raw message

drivers/staging/hv/NetVsc.h +1 -1
index 145b1c5..f7c1680 100644
@@ -55,7 +55,7 @@
 
 /* Per netvsc channel-specific */
 struct NETVSC_DEVICE {
-	DEVICE_OBJECT					*Device;
+	struct hv_device *Device;
 
 	int								RefCount;
 
drivers/staging/hv/RndisFilter.c +12 -12
index fd483fc..cac0727 100644
@@ -112,7 +112,7 @@ RndisFilterReceiveData(
 
 static int
 RndisFilterOnReceive(
-	DEVICE_OBJECT		*Device,
+	struct hv_device *Device,
 	NETVSC_PACKET		*Packet
 	);
 
@@ -157,13 +157,13 @@ RndisFilterCloseDevice(
 
 static int
 RndisFilterOnDeviceAdd(
-	DEVICE_OBJECT	*Device,
+	struct hv_device *Device,
 	void			*AdditionalInfo
 	);
 
 static int
 RndisFilterOnDeviceRemove(
-	DEVICE_OBJECT *Device
+	struct hv_device *Device
 	);
 
 static void
@@ -173,17 +173,17 @@ RndisFilterOnCleanup(
 
 static int
 RndisFilterOnOpen(
-	DEVICE_OBJECT		*Device
+	struct hv_device *Device
 	);
 
 static int
 RndisFilterOnClose(
-	DEVICE_OBJECT		*Device
+	struct hv_device *Device
 	);
 
 static int
 RndisFilterOnSend(
-	DEVICE_OBJECT		*Device,
+	struct hv_device *Device,
 	NETVSC_PACKET		*Packet
 	);
 
@@ -490,7 +490,7 @@ RndisFilterReceiveData(
 
 static int
 RndisFilterOnReceive(
-	DEVICE_OBJECT		*Device,
+	struct hv_device *Device,
 	NETVSC_PACKET		*Packet
 	)
 {
@@ -928,7 +928,7 @@ RndisFilterCloseDevice(
 
 int
 RndisFilterOnDeviceAdd(
-	DEVICE_OBJECT	*Device,
+	struct hv_device *Device,
 	void			*AdditionalInfo
 	)
 {
@@ -1007,7 +1007,7 @@ RndisFilterOnDeviceAdd(
 
 static int
 RndisFilterOnDeviceRemove(
-	DEVICE_OBJECT *Device
+	struct hv_device *Device
 	)
 {
 	struct NETVSC_DEVICE *netDevice = (struct NETVSC_DEVICE*)Device->Extension;
@@ -1042,7 +1042,7 @@ RndisFilterOnCleanup(
 
 static int
 RndisFilterOnOpen(
-	DEVICE_OBJECT		*Device
+	struct hv_device *Device
 	)
 {
 	int ret;
@@ -1060,7 +1060,7 @@ RndisFilterOnOpen(
 
 static int
 RndisFilterOnClose(
-	DEVICE_OBJECT		*Device
+	struct hv_device *Device
 	)
 {
 	int ret;
@@ -1079,7 +1079,7 @@ RndisFilterOnClose(
 
 static int
 RndisFilterOnSend(
-	DEVICE_OBJECT		*Device,
+	struct hv_device *Device,
 	NETVSC_PACKET		*Packet
 	)
 {
drivers/staging/hv/StorVsc.c +25 -25

192 lines not on this page · raw message

drivers/staging/hv/Vmbus.c +11 -11
index 91b226f..1e97951 100644
@@ -46,7 +46,7 @@ static const GUID gVmbusDeviceId={
 };
 
 static DRIVER_OBJECT* gDriver; /* vmbus driver object */
-static DEVICE_OBJECT* gDevice; /* vmbus root device */
+static struct hv_device* gDevice; /* vmbus root device */
 
 
 
@@ -60,7 +60,7 @@ VmbusGetChannelInterface(
 
 static void
 VmbusGetChannelInfo(
-	DEVICE_OBJECT	*DeviceObject,
+	struct hv_device *DeviceObject,
 	DEVICE_INFO		*DeviceInfo
 	);
 
@@ -71,13 +71,13 @@ VmbusGetChannelOffers(
 
 static int
 VmbusOnDeviceAdd(
-	DEVICE_OBJECT	*Device,
+	struct hv_device *Device,
 	void			*AdditionalInfo
 	);
 
 static int
 VmbusOnDeviceRemove(
-	DEVICE_OBJECT* dev
+	struct hv_device *dev
 	);
 
 static void
@@ -205,7 +205,7 @@ Description:
 --*/
 static void
 VmbusGetChannelInfo(
-	DEVICE_OBJECT	*DeviceObject,
+	struct hv_device *DeviceObject,
 	DEVICE_INFO		*DeviceInfo
 	)
 {
@@ -224,7 +224,7 @@ Description:
 
 --*/
 
-DEVICE_OBJECT*
+struct hv_device*
 VmbusChildDeviceCreate(
 	GUID DeviceType,
 	GUID DeviceInstance,
@@ -250,7 +250,7 @@ Description:
 --*/
 int
 VmbusChildDeviceAdd(
-   DEVICE_OBJECT* ChildDevice)
+   struct hv_device *ChildDevice)
 {
 	VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
 
@@ -269,7 +269,7 @@ Description:
 --*/
 void
 VmbusChildDeviceRemove(
-   DEVICE_OBJECT* ChildDevice)
+   struct hv_device *ChildDevice)
 {
 	VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
 
@@ -289,7 +289,7 @@ Description:
 /* **************
 void
 VmbusChildDeviceDestroy(
-DEVICE_OBJECT* ChildDevice
+struct hv_device  *ChildDevice
 )
 {
 VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
@@ -309,7 +309,7 @@ Description:
 --*/
 static int
 VmbusOnDeviceAdd(
-	DEVICE_OBJECT	*dev,
+	struct hv_device *dev,
 	void			*AdditionalInfo
 	)
 {
@@ -347,7 +347,7 @@ Description:
 
 --*/
 int VmbusOnDeviceRemove(
-	DEVICE_OBJECT* dev
+	struct hv_device *dev
 	)
 {
 	int ret=0;
drivers/staging/hv/VmbusPrivate.h +4 -4
index 7182d4d..75013bc 100644
@@ -117,7 +117,7 @@ extern struct VMBUS_CONNECTION gVmbusConnection;
 
 /* General vmbus interface */
 
-static DEVICE_OBJECT*
+static struct hv_device*
 VmbusChildDeviceCreate(
 	GUID deviceType,
 	GUID deviceInstance,
@@ -125,15 +125,15 @@ VmbusChildDeviceCreate(
 
 static int
 VmbusChildDeviceAdd(
-	DEVICE_OBJECT* Device);
+	struct hv_device *Device);
 
 static void
 VmbusChildDeviceRemove(
-   DEVICE_OBJECT* Device);
+   struct hv_device *Device);
 
 /* static void */
 /* VmbusChildDeviceDestroy( */
-/* DEVICE_OBJECT*); */
+/* struct hv_device *); */
 
 static VMBUS_CHANNEL*
 GetChannelFromRelId(
drivers/staging/hv/blkvsc_drv.c +2 -2
index f1efc3e..d595c3b 100644
@@ -263,7 +263,7 @@ static int blkvsc_probe(struct device *device)
 	STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &blkvsc_drv_ctx->drv_obj;
 
 	struct device_context *device_ctx = device_to_device_context(device);
-	DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+	struct hv_device *device_obj = &device_ctx->device_obj;
 
 	struct block_device_context *blkdev=NULL;
 	STORVSC_DEVICE_INFO device_info;
@@ -772,7 +772,7 @@ static int blkvsc_remove(struct device *device)
 	STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &blkvsc_drv_ctx->drv_obj;
 
 	struct device_context *device_ctx = device_to_device_context(device);
-	DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+	struct hv_device *device_obj = &device_ctx->device_obj;
 	struct block_device_context *blkdev = dev_get_drvdata(device);
 	unsigned long flags;
 
drivers/staging/hv/include/NetVscApi.h +7 -7
index fdd8ad9..56ae23a 100644
@@ -44,15 +44,15 @@ typedef struct _NETVSC_PACKET	*PNETVSC_PACKET;
 /* Data types */
 
 
-typedef int (*PFN_ON_OPEN)(DEVICE_OBJECT *Device);
-typedef int (*PFN_ON_CLOSE)(DEVICE_OBJECT *Device);
+typedef int (*PFN_ON_OPEN)(struct hv_device *Device);
+typedef int (*PFN_ON_CLOSE)(struct hv_device *Device);
 
-typedef void (*PFN_QUERY_LINKSTATUS)(DEVICE_OBJECT *Device);
-typedef int (*PFN_ON_SEND)(DEVICE_OBJECT *dev, PNETVSC_PACKET packet);
+typedef void (*PFN_QUERY_LINKSTATUS)(struct hv_device *Device);
+typedef int (*PFN_ON_SEND)(struct hv_device *dev, PNETVSC_PACKET packet);
 typedef void (*PFN_ON_SENDRECVCOMPLETION)(void * Context);
 
-typedef int (*PFN_ON_RECVCALLBACK)(DEVICE_OBJECT *dev, PNETVSC_PACKET packet);
-typedef void (*PFN_ON_LINKSTATUS_CHANGED)(DEVICE_OBJECT *dev, u32 Status);
+typedef int (*PFN_ON_RECVCALLBACK)(struct hv_device *dev, PNETVSC_PACKET packet);
+typedef void (*PFN_ON_LINKSTATUS_CHANGED)(struct hv_device *dev, u32 Status);
 
 /* Represent the xfer page packet which contains 1 or more netvsc packet */
 typedef struct _XFERPAGE_PACKET {
@@ -74,7 +74,7 @@ typedef struct _NETVSC_PACKET {
 	/* Bookkeeping stuff */
 	DLIST_ENTRY				ListEntry;
 
-	DEVICE_OBJECT			*Device;
+	struct hv_device *Device;
 	bool					IsDataPacket;
 
 	/*
drivers/staging/hv/include/StorVscApi.h +3 -3
index 785506b..bd09409 100644
@@ -56,11 +56,11 @@ typedef struct _STORVSC_REQUEST* PSTORVSC_REQUEST;
 
 /* Data types */
 
-typedef int (*PFN_ON_IO_REQUEST)(PDEVICE_OBJECT Device, PSTORVSC_REQUEST Request);
+typedef int (*PFN_ON_IO_REQUEST)(struct hv_device *Device, PSTORVSC_REQUEST Request);
 typedef void (*PFN_ON_IO_REQUEST_COMPLTN)(PSTORVSC_REQUEST Request);
 
-typedef int (*PFN_ON_HOST_RESET)(PDEVICE_OBJECT Device);
-typedef void (*PFN_ON_HOST_RESCAN)(PDEVICE_OBJECT Device);
+typedef int (*PFN_ON_HOST_RESET)(struct hv_device *Device);
+typedef void (*PFN_ON_HOST_RESCAN)(struct hv_device *Device);
 
 
 /* Matches Windows-end */
drivers/staging/hv/include/VmbusApi.h +20 -21

129 lines not on this page · raw message

drivers/staging/hv/include/vmbus.h +2 -2
index c1a8c55..b99c4b5 100644
@@ -53,7 +53,7 @@ struct device_context {
 	GUID					device_id;
 	int						probe_error;
 	struct device			device;
-	DEVICE_OBJECT			device_obj;
+	struct hv_device device_obj;
 };
 
 
@@ -64,7 +64,7 @@ struct device_context {
 
 /* Inlines */
 
-static inline struct device_context *to_device_context(DEVICE_OBJECT *device_obj)
+static inline struct device_context *to_device_context(struct hv_device *device_obj)
 {
 	return container_of(device_obj, struct device_context, device_obj);
 }
drivers/staging/hv/netvsc_drv.c +8 -8
index 82f7700..f0df216 100644
@@ -51,10 +51,10 @@ static int netvsc_remove(struct device *device);
 static int netvsc_open(struct net_device *net);
 static void netvsc_xmit_completion(void *context);
 static int netvsc_start_xmit (struct sk_buff *skb, struct net_device *net);
-static int netvsc_recv_callback(DEVICE_OBJECT *device_obj, NETVSC_PACKET* Packet);
+static int netvsc_recv_callback(struct hv_device *device_obj, NETVSC_PACKET* Packet);
 static int netvsc_close(struct net_device *net);
 static struct net_device_stats *netvsc_get_stats(struct net_device *net);
-static void netvsc_linkstatus_callback(DEVICE_OBJECT *device_obj, unsigned int status);
+static void netvsc_linkstatus_callback(struct hv_device *device_obj, unsigned int status);
 
 
 /* Data types */
@@ -172,7 +172,7 @@ static int netvsc_probe(struct device *device)
 	NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj;
 
 	struct device_context *device_ctx = device_to_device_context(device);
-	DEVICE_OBJECT *device_obj = &device_ctx->device_obj;
+	struct hv_device *device_obj = &device_ctx->device_obj;
 
 	struct net_device *net = NULL;
 	struct net_device_context *net_device_ctx;
@@ -249,7 +249,7 @@ static int netvsc_remove(struct device *device)
 
 	struct device_context *device_ctx = device_to_device_context(device);
 	struct net_device *net = dev_get_drvdata(&device_ctx->device);
-	DEVICE_OBJECT *device_obj = &device_ctx->device_obj;
+	struct hv_device *device_obj = &device_ctx->device_obj;
 
 	DPRINT_ENTER(NETVSC_DRV);
 
@@ -302,7 +302,7 @@ static int netvsc_open(struct net_device *net)
 	struct netvsc_driver_context *net_drv_ctx = (struct netvsc_driver_context*)driver_ctx;
 	NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj;
 
-	DEVICE_OBJECT *device_obj = &net_device_ctx->device_ctx->device_obj;
+	struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj;
 
 	DPRINT_ENTER(NETVSC_DRV);
 
@@ -344,7 +344,7 @@ static int netvsc_close(struct net_device *net)
 	struct netvsc_driver_context *net_drv_ctx = (struct netvsc_driver_context*)driver_ctx;
 	NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj;
 
-	DEVICE_OBJECT *device_obj = &net_device_ctx->device_ctx->device_obj;
+	struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj;
 
 	DPRINT_ENTER(NETVSC_DRV);
 
@@ -515,7 +515,7 @@ Name:	netvsc_linkstatus_callback()
 Desc:	Link up/down notification
 
 --*/
-static void netvsc_linkstatus_callback(DEVICE_OBJECT *device_obj, unsigned int status)
+static void netvsc_linkstatus_callback(struct hv_device *device_obj, unsigned int status)
 {
 	struct device_context* device_ctx = to_device_context(device_obj);
 	struct net_device* net = dev_get_drvdata(&device_ctx->device);
@@ -549,7 +549,7 @@ Name:	netvsc_recv_callback()
 Desc:	Callback when we receive a packet from the "wire" on the specify device
 
 --*/
-static int netvsc_recv_callback(DEVICE_OBJECT *device_obj, NETVSC_PACKET* packet)
+static int netvsc_recv_callback(struct hv_device *device_obj, NETVSC_PACKET* packet)
 {
 	int ret=0;
 	struct device_context *device_ctx = to_device_context(device_obj);
drivers/staging/hv/storvsc_drv.c +4 -5
index cbea8a2..385e84b 100644
@@ -82,7 +82,7 @@ static int storvsc_device_alloc(struct scsi_device *);
 static int storvsc_device_configure(struct scsi_device *);
 static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);
 static void storvsc_host_rescan_callback(struct work_struct *work);
-static void storvsc_host_rescan(DEVICE_OBJECT* device_obj);
+static void storvsc_host_rescan(struct hv_device* device_obj);
 static int storvsc_remove(struct device *dev);
 
 static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count, unsigned int len);
@@ -233,7 +233,7 @@ static int storvsc_probe(struct device *device)
 	STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &storvsc_drv_ctx->drv_obj;
 
 	struct device_context *device_ctx = device_to_device_context(device);
-	DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+	struct hv_device *device_obj = &device_ctx->device_obj;
 
 	struct Scsi_Host *host;
 	struct host_device_context *host_device_ctx;
@@ -336,7 +336,7 @@ static int storvsc_remove(struct device *device)
 	STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &storvsc_drv_ctx->drv_obj;
 
 	struct device_context *device_ctx = device_to_device_context(device);
-	DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+	struct hv_device *device_obj = &device_ctx->device_obj;
 
 	struct Scsi_Host *host = dev_get_drvdata(device);
 	struct host_device_context *host_device_ctx=(struct host_device_context*)host->hostdata;
@@ -912,7 +912,7 @@ Desc:	Rescan the scsi HBA
 --*/
 static void storvsc_host_rescan_callback(struct work_struct *work)
 {
-	DEVICE_OBJECT* device_obj +	struct hv_device *device_obj  	    &((struct host_device_context*)work)->device_ctx->device_obj;
 	struct device_context* device_ctx = to_device_context(device_obj);
 	struct Scsi_Host *host = dev_get_drvdata(&device_ctx->device);
@@ -1076,7 +1076,7 @@ static int storvsc_report_luns(struct scsi_device *sdev, unsigned int luns[], un
 	return 0;
 }
 
-static void storvsc_host_rescan(DEVICE_OBJECT* device_obj)
+static void storvsc_host_rescan(struct hv_device *device_obj)
 {
 	struct device_context* device_ctx = to_device_context(device_obj);
 	struct Scsi_Host *host = dev_get_drvdata(&device_ctx->device);
drivers/staging/hv/vmbus_drv.c +11 -11
index 406fd86..32ae68c 100644
@@ -75,11 +75,11 @@ static irqreturn_t vmbus_isr(int irq, void* dev_id);
 static void vmbus_device_release(struct device *device);
 static void vmbus_bus_release(struct device *device);
 
-static DEVICE_OBJECT* vmbus_child_device_create(GUID type, GUID instance, void* context);
-static void vmbus_child_device_destroy(DEVICE_OBJECT* device_obj);
-static int vmbus_child_device_register(DEVICE_OBJECT* root_device_obj, DEVICE_OBJECT* child_device_obj);
-static void vmbus_child_device_unregister(DEVICE_OBJECT* child_device_obj);
-static void vmbus_child_device_get_info(DEVICE_OBJECT *device_obj, DEVICE_INFO *device_info);
+static struct hv_device *vmbus_child_device_create(GUID type, GUID instance, void* context);
+static void vmbus_child_device_destroy(struct hv_device *device_obj);
+static int vmbus_child_device_register(struct hv_device *root_device_obj, struct hv_device *child_device_obj);
+static void vmbus_child_device_unregister(struct hv_device *child_device_obj);
+static void vmbus_child_device_get_info(struct hv_device *device_obj, DEVICE_INFO *device_info);
 
 /* static ssize_t vmbus_show_class_id(struct device *dev, struct device_attribute *attr, char *buf); */
 /* static ssize_t vmbus_show_device_id(struct device *dev, struct device_attribute *attr, char *buf); */
@@ -542,7 +542,7 @@ Name:	vmbus_child_device_get_info()
 
 Desc:	Get the vmbus child device info. This is invoked to display various device attributes in sysfs.
 --*/
-static void vmbus_child_device_get_info(DEVICE_OBJECT *device_obj, DEVICE_INFO *device_info)
+static void vmbus_child_device_get_info(struct hv_device *device_obj, DEVICE_INFO *device_info)
 {
 	VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
 
@@ -557,10 +557,10 @@ Name:	vmbus_child_device_create()
 Desc:	Creates and registers a new child device on the vmbus.
 
 --*/
-static DEVICE_OBJECT* vmbus_child_device_create(GUID type, GUID instance, void* context)
+static struct hv_device *vmbus_child_device_create(GUID type, GUID instance, void* context)
 {
 	struct device_context *child_device_ctx;
-	DEVICE_OBJECT* child_device_obj;
+	struct hv_device *child_device_obj;
 
 	DPRINT_ENTER(VMBUS_DRV);
 
@@ -601,7 +601,7 @@ Name:	vmbus_child_device_register()
 Desc:	Register the child device on the specified bus
 
 --*/
-static int vmbus_child_device_register(DEVICE_OBJECT* root_device_obj, DEVICE_OBJECT* child_device_obj)
+static int vmbus_child_device_register(struct hv_device *root_device_obj, struct hv_device *child_device_obj)
 {
 	int ret=0;
 	struct device_context *root_device_ctx = to_device_context(root_device_obj);
@@ -655,7 +655,7 @@ Name:	vmbus_child_device_unregister()
 Desc:	Remove the specified child device from the vmbus.
 
 --*/
-static void vmbus_child_device_unregister(DEVICE_OBJECT* device_obj)
+static void vmbus_child_device_unregister(struct hv_device *device_obj)
 {
 	struct device_context *device_ctx = to_device_context(device_obj);
 
@@ -680,7 +680,7 @@ Name:	vmbus_child_device_destroy()
 Desc:	Destroy the specified child device on the vmbus.
 
 --*/
-static void vmbus_child_device_destroy(DEVICE_OBJECT* device_obj)
+static void vmbus_child_device_destroy(struct hv_device *device_obj)
 {
 	DPRINT_ENTER(VMBUS_DRV);
 
Signature · 1 line
1.6.0.4