Browse Source

Staging: hv: rename context to channel in struct hv_device

As it really is a channel, not a "context" name it so.

This also entailed making a few more functions typesafe as they were
sending a struct vmbus_channel pointer as a void pointer.

There are still a few more that need to be converted (the osd callbacks
are one), but this is good for now.

Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Greg Kroah-Hartman 14 years ago
parent
commit
cae5b843c8

+ 7 - 7
drivers/staging/hv/channel_interface.c

@@ -31,21 +31,21 @@ static int ivmbus_open(struct hv_device *device, u32 sendbuffer_size,
 			     void (*channel_callback)(void *context),
 			     void *context)
 {
-	return vmbus_open(device->context, sendbuffer_size,
+	return vmbus_open(device->channel, sendbuffer_size,
 				recv_ringbuffer_size, userdata, userdatalen,
 				channel_callback, context);
 }
 
 static void ivmbus_close(struct hv_device *device)
 {
-	vmbus_close(device->context);
+	vmbus_close(device->channel);
 }
 
 static int ivmbus_sendpacket(struct hv_device *device, const void *buffer,
 				   u32 bufferlen, u64 requestid, u32 type,
 				   u32 flags)
 {
-	return vmbus_sendpacket(device->context, buffer, bufferlen,
+	return vmbus_sendpacket(device->channel, buffer, bufferlen,
 				      requestid, type, flags);
 }
 
@@ -54,7 +54,7 @@ static int ivmbus_sendpacket_pagebuffer(struct hv_device *device,
 				u32 pagecount, void *buffer,
 				u32 bufferlen, u64 requestid)
 {
-	return vmbus_sendpacket_pagebuffer(device->context, pagebuffers,
+	return vmbus_sendpacket_pagebuffer(device->channel, pagebuffers,
 						pagecount, buffer, bufferlen,
 						requestid);
 }
@@ -63,7 +63,7 @@ static int ivmbus_sendpacket_multipagebuffer(struct hv_device *device,
 				struct hv_multipage_buffer *multi_pagebuffer,
 				void *buffer, u32 bufferlen, u64 requestid)
 {
-	return vmbus_sendpacket_multipagebuffer(device->context,
+	return vmbus_sendpacket_multipagebuffer(device->channel,
 						     multi_pagebuffer, buffer,
 						     bufferlen, requestid);
 }
@@ -72,7 +72,7 @@ static int ivmbus_recvpacket(struct hv_device *device, void *buffer,
 				   u32 bufferlen, u32 *buffer_actuallen,
 				   u64 *requestid)
 {
-	return vmbus_recvpacket(device->context, buffer, bufferlen,
+	return vmbus_recvpacket(device->channel, buffer, bufferlen,
 				      buffer_actuallen, requestid);
 }
 
@@ -80,7 +80,7 @@ static int ivmbus_recvpacket_raw(struct hv_device *device, void *buffer,
 				      u32 bufferlen, u32 *buffer_actuallen,
 				      u64 *requestid)
 {
-	return vmbus_recvpacket_raw(device->context, buffer, bufferlen,
+	return vmbus_recvpacket_raw(device->channel, buffer, bufferlen,
 					 buffer_actuallen, requestid);
 }
 

+ 4 - 4
drivers/staging/hv/netvsc.c

@@ -240,7 +240,7 @@ static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device)
 	 * channel.  Note: This call uses the vmbus connection rather
 	 * than the channel to establish the gpadl handle.
 	 */
-	ret = vmbus_establish_gpadl(Device->context, netDevice->ReceiveBuffer,
+	ret = vmbus_establish_gpadl(Device->channel, netDevice->ReceiveBuffer,
 				    netDevice->ReceiveBufferSize,
 				    &netDevice->ReceiveBufferGpadlHandle);
 	if (ret != 0) {
@@ -368,7 +368,7 @@ static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device)
 	 * channel.  Note: This call uses the vmbus connection rather
 	 * than the channel to establish the gpadl handle.
 	 */
-	ret = vmbus_establish_gpadl(Device->context, netDevice->SendBuffer,
+	ret = vmbus_establish_gpadl(Device->channel, netDevice->SendBuffer,
 				    netDevice->SendBufferSize,
 				    &netDevice->SendBufferGpadlHandle);
 	if (ret != 0) {
@@ -467,7 +467,7 @@ static int NetVscDestroyReceiveBuffer(struct netvsc_device *NetDevice)
 	if (NetDevice->ReceiveBufferGpadlHandle) {
 		DPRINT_INFO(NETVSC, "Tearing down receive buffer's GPADL...");
 
-		ret = vmbus_teardown_gpadl(NetDevice->Device->context,
+		ret = vmbus_teardown_gpadl(NetDevice->Device->channel,
 					   NetDevice->ReceiveBufferGpadlHandle);
 
 		/* If we failed here, we might as well return and have a leak rather than continue and a bugchk */
@@ -538,7 +538,7 @@ static int NetVscDestroySendBuffer(struct netvsc_device *NetDevice)
 	/* Teardown the gpadl on the vsp end */
 	if (NetDevice->SendBufferGpadlHandle) {
 		DPRINT_INFO(NETVSC, "Tearing down send buffer's GPADL...");
-		ret = vmbus_teardown_gpadl(NetDevice->Device->context,
+		ret = vmbus_teardown_gpadl(NetDevice->Device->channel,
 					   NetDevice->SendBufferGpadlHandle);
 
 		/*

+ 2 - 2
drivers/staging/hv/vmbus.c

@@ -65,12 +65,12 @@ static void VmbusGetChannelOffers(void)
  */
 struct hv_device *VmbusChildDeviceCreate(struct hv_guid *DeviceType,
 					 struct hv_guid *DeviceInstance,
-					 void *Context)
+					 struct vmbus_channel *channel)
 {
 	struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
 
 	return vmbusDriver->OnChildDeviceCreate(DeviceType, DeviceInstance,
-						Context);
+						channel);
 }
 
 /*

+ 2 - 2
drivers/staging/hv/vmbus_api.h

@@ -152,7 +152,7 @@ struct hv_device {
 	/* the device instance id of this device */
 	struct hv_guid deviceInstance;
 
-	struct vmbus_channel *context;
+	struct vmbus_channel *channel;
 
 	/* Device extension; */
 	void *Extension;
@@ -167,7 +167,7 @@ struct vmbus_driver {
 	/* Set by the caller */
 	struct hv_device * (*OnChildDeviceCreate)(struct hv_guid *DeviceType,
 						struct hv_guid *DeviceInstance,
-						void *Context);
+						struct vmbus_channel *channel);
 	void (*OnChildDeviceDestroy)(struct hv_device *device);
 	int (*OnChildDeviceAdd)(struct hv_device *RootDevice,
 				struct hv_device *ChildDevice);

+ 5 - 5
drivers/staging/hv/vmbus_drv.c

@@ -71,7 +71,7 @@ static void vmbus_bus_release(struct device *device);
 
 static struct hv_device *vmbus_child_device_create(struct hv_guid *type,
 						   struct hv_guid *instance,
-						   void *context);
+						   struct vmbus_channel *channel);
 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);
@@ -134,10 +134,10 @@ static void get_channel_info(struct hv_device *device,
 {
 	struct vmbus_channel_debug_info debug_info;
 
-	if (!device->context)
+	if (!device->channel)
 		return;
 
-	vmbus_get_debug_info(device->context, &debug_info);
+	vmbus_get_debug_info(device->channel, &debug_info);
 
 	info->ChannelId = debug_info.RelId;
 	info->ChannelState = debug_info.State;
@@ -508,7 +508,7 @@ EXPORT_SYMBOL(vmbus_get_interface);
  */
 static struct hv_device *vmbus_child_device_create(struct hv_guid *type,
 						   struct hv_guid *instance,
-						   void *context)
+						   struct vmbus_channel *channel)
 {
 	struct vm_device *child_device_ctx;
 	struct hv_device *child_device_obj;
@@ -541,7 +541,7 @@ static struct hv_device *vmbus_child_device_create(struct hv_guid *type,
 		instance->data[14], instance->data[15]);
 
 	child_device_obj = &child_device_ctx->device_obj;
-	child_device_obj->context = context;
+	child_device_obj->channel = channel;
 	memcpy(&child_device_obj->deviceType, type, sizeof(struct hv_guid));
 	memcpy(&child_device_obj->deviceInstance, instance,
 	       sizeof(struct hv_guid));

+ 1 - 1
drivers/staging/hv/vmbus_private.h

@@ -104,7 +104,7 @@ extern struct VMBUS_CONNECTION gVmbusConnection;
 
 struct hv_device *VmbusChildDeviceCreate(struct hv_guid *deviceType,
 					 struct hv_guid *deviceInstance,
-					 void *context);
+					 struct vmbus_channel *channel);
 
 int VmbusChildDeviceAdd(struct hv_device *Device);