Commit 56c642e2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux

Pull Hyper-V fixes from Sasha Levin:
 "Two fixes from Dexuan Cui:

   - Fix a (harmless) warning when building vmbus without
     CONFIG_PM_SLEEP

   - Fix for a memory leak (and optimization) in the hyperv mouse code"

* tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
  Drivers: hv: vmbus: Fix harmless building warnings without CONFIG_PM_SLEEP
  HID: hyperv: Use in-place iterator API in the channel callback
parents b9918bdc 83b50f83
...@@ -314,60 +314,24 @@ static void mousevsc_on_receive(struct hv_device *device, ...@@ -314,60 +314,24 @@ static void mousevsc_on_receive(struct hv_device *device,
static void mousevsc_on_channel_callback(void *context) static void mousevsc_on_channel_callback(void *context)
{ {
const int packet_size = 0x100;
int ret;
struct hv_device *device = context; struct hv_device *device = context;
u32 bytes_recvd;
u64 req_id;
struct vmpacket_descriptor *desc; struct vmpacket_descriptor *desc;
unsigned char *buffer;
int bufferlen = packet_size;
buffer = kmalloc(bufferlen, GFP_ATOMIC);
if (!buffer)
return;
do {
ret = vmbus_recvpacket_raw(device->channel, buffer,
bufferlen, &bytes_recvd, &req_id);
switch (ret) {
case 0:
if (bytes_recvd <= 0) {
kfree(buffer);
return;
}
desc = (struct vmpacket_descriptor *)buffer;
switch (desc->type) {
case VM_PKT_COMP:
break;
case VM_PKT_DATA_INBAND:
mousevsc_on_receive(device, desc);
break;
default:
pr_err("unhandled packet type %d, tid %llx len %d\n",
desc->type, req_id, bytes_recvd);
break;
}
foreach_vmbus_pkt(desc, device->channel) {
switch (desc->type) {
case VM_PKT_COMP:
break; break;
case -ENOBUFS: case VM_PKT_DATA_INBAND:
kfree(buffer); mousevsc_on_receive(device, desc);
/* Handle large packet */ break;
bufferlen = bytes_recvd;
buffer = kmalloc(bytes_recvd, GFP_ATOMIC);
if (!buffer)
return;
default:
pr_err("Unhandled packet type %d, tid %llx len %d\n",
desc->type, desc->trans_id, desc->len8 * 8);
break; break;
} }
} while (1); }
} }
static int mousevsc_connect_to_vsp(struct hv_device *device) static int mousevsc_connect_to_vsp(struct hv_device *device)
......
...@@ -912,6 +912,7 @@ static void vmbus_shutdown(struct device *child_device) ...@@ -912,6 +912,7 @@ static void vmbus_shutdown(struct device *child_device)
drv->shutdown(dev); drv->shutdown(dev);
} }
#ifdef CONFIG_PM_SLEEP
/* /*
* vmbus_suspend - Suspend a vmbus device * vmbus_suspend - Suspend a vmbus device
*/ */
...@@ -949,6 +950,7 @@ static int vmbus_resume(struct device *child_device) ...@@ -949,6 +950,7 @@ static int vmbus_resume(struct device *child_device)
return drv->resume(dev); return drv->resume(dev);
} }
#endif /* CONFIG_PM_SLEEP */
/* /*
* vmbus_device_release - Final callback release of the vmbus child device * vmbus_device_release - Final callback release of the vmbus child device
...@@ -1070,6 +1072,7 @@ void vmbus_on_msg_dpc(unsigned long data) ...@@ -1070,6 +1072,7 @@ void vmbus_on_msg_dpc(unsigned long data)
vmbus_signal_eom(msg, message_type); vmbus_signal_eom(msg, message_type);
} }
#ifdef CONFIG_PM_SLEEP
/* /*
* Fake RESCIND_CHANNEL messages to clean up hv_sock channels by force for * Fake RESCIND_CHANNEL messages to clean up hv_sock channels by force for
* hibernation, because hv_sock connections can not persist across hibernation. * hibernation, because hv_sock connections can not persist across hibernation.
...@@ -1105,6 +1108,7 @@ static void vmbus_force_channel_rescinded(struct vmbus_channel *channel) ...@@ -1105,6 +1108,7 @@ static void vmbus_force_channel_rescinded(struct vmbus_channel *channel)
vmbus_connection.work_queue, vmbus_connection.work_queue,
&ctx->work); &ctx->work);
} }
#endif /* CONFIG_PM_SLEEP */
/* /*
* Direct callback for channels using other deferred processing * Direct callback for channels using other deferred processing
...@@ -2125,6 +2129,7 @@ static int vmbus_acpi_add(struct acpi_device *device) ...@@ -2125,6 +2129,7 @@ static int vmbus_acpi_add(struct acpi_device *device)
return ret_val; return ret_val;
} }
#ifdef CONFIG_PM_SLEEP
static int vmbus_bus_suspend(struct device *dev) static int vmbus_bus_suspend(struct device *dev)
{ {
struct vmbus_channel *channel, *sc; struct vmbus_channel *channel, *sc;
...@@ -2247,6 +2252,7 @@ static int vmbus_bus_resume(struct device *dev) ...@@ -2247,6 +2252,7 @@ static int vmbus_bus_resume(struct device *dev)
return 0; return 0;
} }
#endif /* CONFIG_PM_SLEEP */
static const struct acpi_device_id vmbus_acpi_device_ids[] = { static const struct acpi_device_id vmbus_acpi_device_ids[] = {
{"VMBUS", 0}, {"VMBUS", 0},
......
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