Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cae5b843 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7053a27a
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -31,21 +31,21 @@ static int ivmbus_open(struct hv_device *device, u32 sendbuffer_size,
			     void (*channel_callback)(void *context),
			     void (*channel_callback)(void *context),
			     void *context)
			     void *context)
{
{
	return vmbus_open(device->context, sendbuffer_size,
	return vmbus_open(device->channel, sendbuffer_size,
				recv_ringbuffer_size, userdata, userdatalen,
				recv_ringbuffer_size, userdata, userdatalen,
				channel_callback, context);
				channel_callback, context);
}
}


static void ivmbus_close(struct hv_device *device)
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,
static int ivmbus_sendpacket(struct hv_device *device, const void *buffer,
				   u32 bufferlen, u64 requestid, u32 type,
				   u32 bufferlen, u64 requestid, u32 type,
				   u32 flags)
				   u32 flags)
{
{
	return vmbus_sendpacket(device->context, buffer, bufferlen,
	return vmbus_sendpacket(device->channel, buffer, bufferlen,
				      requestid, type, flags);
				      requestid, type, flags);
}
}


@@ -54,7 +54,7 @@ static int ivmbus_sendpacket_pagebuffer(struct hv_device *device,
				u32 pagecount, void *buffer,
				u32 pagecount, void *buffer,
				u32 bufferlen, u64 requestid)
				u32 bufferlen, u64 requestid)
{
{
	return vmbus_sendpacket_pagebuffer(device->context, pagebuffers,
	return vmbus_sendpacket_pagebuffer(device->channel, pagebuffers,
						pagecount, buffer, bufferlen,
						pagecount, buffer, bufferlen,
						requestid);
						requestid);
}
}
@@ -63,7 +63,7 @@ static int ivmbus_sendpacket_multipagebuffer(struct hv_device *device,
				struct hv_multipage_buffer *multi_pagebuffer,
				struct hv_multipage_buffer *multi_pagebuffer,
				void *buffer, u32 bufferlen, u64 requestid)
				void *buffer, u32 bufferlen, u64 requestid)
{
{
	return vmbus_sendpacket_multipagebuffer(device->context,
	return vmbus_sendpacket_multipagebuffer(device->channel,
						     multi_pagebuffer, buffer,
						     multi_pagebuffer, buffer,
						     bufferlen, requestid);
						     bufferlen, requestid);
}
}
@@ -72,7 +72,7 @@ static int ivmbus_recvpacket(struct hv_device *device, void *buffer,
				   u32 bufferlen, u32 *buffer_actuallen,
				   u32 bufferlen, u32 *buffer_actuallen,
				   u64 *requestid)
				   u64 *requestid)
{
{
	return vmbus_recvpacket(device->context, buffer, bufferlen,
	return vmbus_recvpacket(device->channel, buffer, bufferlen,
				      buffer_actuallen, requestid);
				      buffer_actuallen, requestid);
}
}


@@ -80,7 +80,7 @@ static int ivmbus_recvpacket_raw(struct hv_device *device, void *buffer,
				      u32 bufferlen, u32 *buffer_actuallen,
				      u32 bufferlen, u32 *buffer_actuallen,
				      u64 *requestid)
				      u64 *requestid)
{
{
	return vmbus_recvpacket_raw(device->context, buffer, bufferlen,
	return vmbus_recvpacket_raw(device->channel, buffer, bufferlen,
					 buffer_actuallen, requestid);
					 buffer_actuallen, requestid);
}
}


+4 −4
Original line number Original line Diff line number Diff line
@@ -240,7 +240,7 @@ static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device)
	 * channel.  Note: This call uses the vmbus connection rather
	 * channel.  Note: This call uses the vmbus connection rather
	 * than the channel to establish the gpadl handle.
	 * 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->ReceiveBufferSize,
				    &netDevice->ReceiveBufferGpadlHandle);
				    &netDevice->ReceiveBufferGpadlHandle);
	if (ret != 0) {
	if (ret != 0) {
@@ -368,7 +368,7 @@ static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device)
	 * channel.  Note: This call uses the vmbus connection rather
	 * channel.  Note: This call uses the vmbus connection rather
	 * than the channel to establish the gpadl handle.
	 * 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->SendBufferSize,
				    &netDevice->SendBufferGpadlHandle);
				    &netDevice->SendBufferGpadlHandle);
	if (ret != 0) {
	if (ret != 0) {
@@ -467,7 +467,7 @@ static int NetVscDestroyReceiveBuffer(struct netvsc_device *NetDevice)
	if (NetDevice->ReceiveBufferGpadlHandle) {
	if (NetDevice->ReceiveBufferGpadlHandle) {
		DPRINT_INFO(NETVSC, "Tearing down receive buffer's GPADL...");
		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);
					   NetDevice->ReceiveBufferGpadlHandle);


		/* If we failed here, we might as well return and have a leak rather than continue and a bugchk */
		/* 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 */
	/* Teardown the gpadl on the vsp end */
	if (NetDevice->SendBufferGpadlHandle) {
	if (NetDevice->SendBufferGpadlHandle) {
		DPRINT_INFO(NETVSC, "Tearing down send buffer's GPADL...");
		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);
					   NetDevice->SendBufferGpadlHandle);


		/*
		/*
+2 −2
Original line number Original line Diff line number Diff line
@@ -65,12 +65,12 @@ static void VmbusGetChannelOffers(void)
 */
 */
struct hv_device *VmbusChildDeviceCreate(struct hv_guid *DeviceType,
struct hv_device *VmbusChildDeviceCreate(struct hv_guid *DeviceType,
					 struct hv_guid *DeviceInstance,
					 struct hv_guid *DeviceInstance,
					 void *Context)
					 struct vmbus_channel *channel)
{
{
	struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
	struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;


	return vmbusDriver->OnChildDeviceCreate(DeviceType, DeviceInstance,
	return vmbusDriver->OnChildDeviceCreate(DeviceType, DeviceInstance,
						Context);
						channel);
}
}


/*
/*
+2 −2
Original line number Original line Diff line number Diff line
@@ -152,7 +152,7 @@ struct hv_device {
	/* the device instance id of this device */
	/* the device instance id of this device */
	struct hv_guid deviceInstance;
	struct hv_guid deviceInstance;


	struct vmbus_channel *context;
	struct vmbus_channel *channel;


	/* Device extension; */
	/* Device extension; */
	void *Extension;
	void *Extension;
@@ -167,7 +167,7 @@ struct vmbus_driver {
	/* Set by the caller */
	/* Set by the caller */
	struct hv_device * (*OnChildDeviceCreate)(struct hv_guid *DeviceType,
	struct hv_device * (*OnChildDeviceCreate)(struct hv_guid *DeviceType,
						struct hv_guid *DeviceInstance,
						struct hv_guid *DeviceInstance,
						void *Context);
						struct vmbus_channel *channel);
	void (*OnChildDeviceDestroy)(struct hv_device *device);
	void (*OnChildDeviceDestroy)(struct hv_device *device);
	int (*OnChildDeviceAdd)(struct hv_device *RootDevice,
	int (*OnChildDeviceAdd)(struct hv_device *RootDevice,
				struct hv_device *ChildDevice);
				struct hv_device *ChildDevice);
+5 −5
Original line number Original line Diff line number Diff line
@@ -71,7 +71,7 @@ static void vmbus_bus_release(struct device *device);


static struct hv_device *vmbus_child_device_create(struct hv_guid *type,
static struct hv_device *vmbus_child_device_create(struct hv_guid *type,
						   struct hv_guid *instance,
						   struct hv_guid *instance,
						   void *context);
						   struct vmbus_channel *channel);
static void vmbus_child_device_destroy(struct hv_device *device_obj);
static void vmbus_child_device_destroy(struct hv_device *device_obj);
static int vmbus_child_device_register(struct hv_device *root_device_obj,
static int vmbus_child_device_register(struct hv_device *root_device_obj,
				       struct hv_device *child_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;
	struct vmbus_channel_debug_info debug_info;


	if (!device->context)
	if (!device->channel)
		return;
		return;


	vmbus_get_debug_info(device->context, &debug_info);
	vmbus_get_debug_info(device->channel, &debug_info);


	info->ChannelId = debug_info.RelId;
	info->ChannelId = debug_info.RelId;
	info->ChannelState = debug_info.State;
	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,
static struct hv_device *vmbus_child_device_create(struct hv_guid *type,
						   struct hv_guid *instance,
						   struct hv_guid *instance,
						   void *context)
						   struct vmbus_channel *channel)
{
{
	struct vm_device *child_device_ctx;
	struct vm_device *child_device_ctx;
	struct hv_device *child_device_obj;
	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]);
		instance->data[14], instance->data[15]);


	child_device_obj = &child_device_ctx->device_obj;
	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->deviceType, type, sizeof(struct hv_guid));
	memcpy(&child_device_obj->deviceInstance, instance,
	memcpy(&child_device_obj->deviceInstance, instance,
	       sizeof(struct hv_guid));
	       sizeof(struct hv_guid));
Loading