From 536277ec5558feb39ff5a8a29c4c59bada3ee4a1 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Thu, 9 Nov 2023 08:45:58 +0100 Subject: [PATCH] lx_emul: prevent compiler warnings in usb.c --- repos/dde_linux/src/lib/lx_emul/usb.c | 30 ++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/repos/dde_linux/src/lib/lx_emul/usb.c b/repos/dde_linux/src/lib/lx_emul/usb.c index ee7f184c43..b17ee6bc56 100644 --- a/repos/dde_linux/src/lib/lx_emul/usb.c +++ b/repos/dde_linux/src/lib/lx_emul/usb.c @@ -345,6 +345,12 @@ static int claim(genode_usb_bus_num_t bus, struct usb_device * udev = find_usb_device(bus, dev); struct usb_per_dev_data * data = udev ? dev_get_drvdata(&udev->dev) : NULL; + struct usb_rpc_call_args rpc = { + .ret = 1, + .call = CLAIM, + .iface_num = iface_num + }; + /* * As long as 'claim' is a rpc-call, and the usb device wasn't opened yet, * we cannot open the device here, this has to be done from a Linux task. @@ -354,12 +360,6 @@ static int claim(genode_usb_bus_num_t bus, if (!data) return 0; - struct usb_rpc_call_args rpc = { - .ret = 1, - .call = CLAIM, - .iface_num = iface_num - }; - data->rpc = &rpc; lx_emul_task_unblock(data->task); lx_emul_execute_kernel_until(&usb_rpc_finished, &rpc); @@ -374,15 +374,15 @@ static int release(genode_usb_bus_num_t bus, struct usb_device * udev = find_usb_device(bus, dev); struct usb_per_dev_data * data = udev ? dev_get_drvdata(&udev->dev) : NULL; - if (!data) - return -1; - struct usb_rpc_call_args rpc = { .ret = 1, .call = RELEASE_IF, .iface_num = iface_num }; + if (!data) + return -1; + data->rpc = &rpc; lx_emul_task_unblock(data->task); lx_emul_execute_kernel_until(&usb_rpc_finished, &rpc); @@ -396,15 +396,14 @@ static void release_all(genode_usb_bus_num_t bus, struct usb_device * udev = find_usb_device(bus, dev); struct usb_per_dev_data * data = udev ? dev_get_drvdata(&udev->dev) : NULL; - if (!data) - return; - - struct usb_rpc_call_args rpc = { .ret = 1, .call = RELEASE_ALL, }; + if (!data) + return; + data->rpc = &rpc; lx_emul_task_unblock(data->task); lx_emul_execute_kernel_until(&usb_rpc_finished, &rpc); @@ -633,7 +632,10 @@ handle_urb_request(struct genode_usb_request_urb req, (unsigned long)&u->urb); break; } - case NONE: ; + case NONE: + case ALT_SETTING: + case CONFIG: + break; }; }