From ed7b3ef205fc2a6684050310029f29eb5683ccdd Mon Sep 17 00:00:00 2001 From: INSUN PYO Date: Mon, 30 Mar 2020 08:45:11 +0900 Subject: Remove unused usb_client Change-Id: If2d574da915233d2849017892d64a7ea75191970 (cherry picked from commit 66aa88ba4c649532bef7c512eebdb24d9481568b) --- hw/usb_cfs_client_common.c | 12 +++++++----- hw/usb_client_common.c | 20 +++++++++++--------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/hw/usb_cfs_client_common.c b/hw/usb_cfs_client_common.c index e9d4135..fb599df 100644 --- a/hw/usb_cfs_client_common.c +++ b/hw/usb_cfs_client_common.c @@ -94,8 +94,7 @@ static struct usb_function *cfs_find_usb_function(usbg_function *function) return find_usb_function_by_name_instance(name, instance); } -static bool cfs_is_function_supported(struct usb_client *usb, - struct usb_function *func) +static bool cfs_is_function_supported(struct usb_function *func) { bool res; int ret; @@ -111,7 +110,7 @@ static bool cfs_is_function_supported(struct usb_client *usb, return res; } -static bool cfs_is_gadget_supported(struct usb_client *usb, struct usb_gadget *gadget) +static bool cfs_is_gadget_supported(struct usb_gadget *gadget) { int i, j; @@ -132,7 +131,7 @@ static bool cfs_is_gadget_supported(struct usb_client *usb, struct usb_gadget *g return false; for (i = 0; config->funcs[i]; ++i) - if (!cfs_is_function_supported(usb, config->funcs[i])) + if (!cfs_is_function_supported(config->funcs[i])) return false; } @@ -456,9 +455,12 @@ static int cfs_reconfigure_gadget(struct usb_client *usb, struct usb_gadget *gad int ret; struct cfs_client *cfs_client; - if (!usb || !gadget || !cfs_is_gadget_supported(usb, gadget)) + if (!usb || !gadget) return -EINVAL; + if (!cfs_is_gadget_supported(gadget)) + return -ENOTSUP; + cfs_client = container_of(usb, struct cfs_client, client); ret = cfs_set_gadget_attrs(cfs_client, &gadget->attrs); diff --git a/hw/usb_client_common.c b/hw/usb_client_common.c index 3020cda..709d7c0 100644 --- a/hw/usb_client_common.c +++ b/hw/usb_client_common.c @@ -59,8 +59,7 @@ #define EXPORT __attribute__ ((visibility("default"))) #endif -static bool legacy_is_function_supported(struct usb_client *usb, - struct usb_function *func) +static bool legacy_is_function_supported(struct usb_function *func) { /* * TODO @@ -74,8 +73,7 @@ static bool legacy_is_function_supported(struct usb_client *usb, return false; } -static bool legacy_is_gadget_supported(struct usb_client *usb, - struct usb_gadget *gadget) +static bool legacy_is_gadget_supported(struct usb_gadget *gadget) { int i, j; @@ -96,7 +94,7 @@ static bool legacy_is_gadget_supported(struct usb_client *usb, return false; for (i = 0; config->funcs[i]; ++i) - if (!legacy_is_function_supported(usb, config->funcs[i])) + if (!legacy_is_function_supported(config->funcs[i])) return false; } @@ -206,14 +204,16 @@ empty_config: return sys_set_str(cpath, buf); } -static int legacy_reconfigure_gadget(struct usb_client *usb, - struct usb_gadget *gadget) +static int legacy_reconfigure_gadget(struct usb_client *usb, struct usb_gadget *gadget) { int ret; - if (!usb || !gadget || !legacy_is_gadget_supported(usb, gadget)) + if (!usb || !gadget) return -EINVAL; + if (!legacy_is_gadget_supported(gadget)) + return -ENOTSUP; + ret = legacy_set_gadget_attrs(&gadget->attrs); if (ret) return ret; @@ -227,8 +227,10 @@ static int legacy_reconfigure_gadget(struct usb_client *usb, return ret; ret = legacy_set_gadget_config(LEGACY_CONFIG_2_PATH, gadget->configs[1]); + if (ret) + return ret; - return ret; + return 0; } static void legacy_start_stop_service_and_handler(bool start) -- cgit v1.2.3