From patchwork Thu Aug 3 09:10:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13339568 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CD58C04A6A for ; Thu, 3 Aug 2023 09:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235040AbjHCJLq (ORCPT ); Thu, 3 Aug 2023 05:11:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234574AbjHCJLY (ORCPT ); Thu, 3 Aug 2023 05:11:24 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4996F3594 for ; Thu, 3 Aug 2023 02:11:09 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3736Do5R018497; Thu, 3 Aug 2023 09:11:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=lnGeKLe76VUqUnyUtHqFpR/yLZB38wSsdkeHjlUbwrE=; b=H+UY9mLu5Zn//q6J+r8/HAXtUHVzPj8/opaeaKAAtUKCNwtn3Hb40M0U7aVdLO7g+x/V R30IL1DGktEMkffwTelmNxYBeGL9/IPolrK3CZ3j+Nw0+P/gLyymcmYKDPiwQGkMLdOH c7/ZtaaoYh8h8efMgFwUUXLKZTGIzT55NBMBXkFugTBC4XSmZdK4H3Vl++e8a3vDmBPy 4xiruR0X0o57or33vDalIfJnwaD5LJAH+ocaig+GtLGyqNkAHX+k4M2OwUvkoVzCstHv xcDN0C4PtP5vQezHDKVR+n5kshbTVJzwUEtGOOmwNp0k2kGA/ONEKbB3FI/n2bYVkY7S Eg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s83q0gkwk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Aug 2023 09:11:07 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3739B6JZ020657 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 09:11:06 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Thu, 3 Aug 2023 02:11:05 -0700 From: Linyu Yuan To: Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH v2 1/7] usb: gadget: use working speed to calcaulate network bitrate and qlen Date: Thu, 3 Aug 2023 17:10:47 +0800 Message-ID: <20230803091053.9714-2-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230803091053.9714-1-quic_linyyuan@quicinc.com> References: <20230803091053.9714-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 7dYFCliqOH78h8ixOKchUHFyO6-O5uZ_ X-Proofpoint-GUID: 7dYFCliqOH78h8ixOKchUHFyO6-O5uZ_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-03_07,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=2 lowpriorityscore=0 bulkscore=0 clxscore=1015 impostorscore=0 malwarescore=0 suspectscore=0 mlxlogscore=181 priorityscore=1501 mlxscore=2 spamscore=2 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308030080 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Take ecm_bitrate() as example, it will be called after gadget device link speed negotiation, consider code if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER), if a gadget device link speed is USB_SPEED_SUPER, gadget_is_superspeed(g) must be true, or not it is a wrong configuration of gadget max support speed. Remove gadget_is_superspeed(g) checking should be safe, and remove other similar operation in ncm, rndis, u_ether. Signed-off-by: Linyu Yuan --- v2: move this as first patch to fix comment from Oliver Neukum drivers/usb/gadget/function/f_ecm.c | 4 ++-- drivers/usb/gadget/function/f_ncm.c | 6 +++--- drivers/usb/gadget/function/f_rndis.c | 6 +++--- drivers/usb/gadget/function/u_ether.c | 5 ++--- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c index c6e63ad77a40..cbe05da94bde 100644 --- a/drivers/usb/gadget/function/f_ecm.c +++ b/drivers/usb/gadget/function/f_ecm.c @@ -68,9 +68,9 @@ static inline struct f_ecm *func_to_ecm(struct usb_function *f) /* peak (theoretical) bulk transfer rate in bits-per-second */ static inline unsigned ecm_bitrate(struct usb_gadget *g) { - if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER) + if (g->speed == USB_SPEED_SUPER) return 13 * 1024 * 8 * 1000 * 8; - else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) + else if (g->speed == USB_SPEED_HIGH) return 13 * 512 * 8 * 1000 * 8; else return 19 * 64 * 1 * 1000 * 8; diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c index 424bb3b666db..e6dac5510540 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c @@ -85,11 +85,11 @@ static inline unsigned ncm_bitrate(struct usb_gadget *g) { if (!g) return 0; - else if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER_PLUS) + else if (g->speed >= USB_SPEED_SUPER_PLUS) return 4250000000U; - else if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER) + else if (g->speed == USB_SPEED_SUPER) return 3750000000U; - else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) + else if (g->speed == USB_SPEED_HIGH) return 13 * 512 * 8 * 1000 * 8; else return 19 * 64 * 1 * 1000 * 8; diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index ee95e8f5f9d4..eff5d7cbce00 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c @@ -87,11 +87,11 @@ static inline struct f_rndis *func_to_rndis(struct usb_function *f) /* peak (theoretical) bulk transfer rate in bits-per-second */ static unsigned int bitrate(struct usb_gadget *g) { - if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER_PLUS) + if (g->speed >= USB_SPEED_SUPER_PLUS) return 4250000000U; - if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER) + if (g->speed == USB_SPEED_SUPER) return 3750000000U; - else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) + else if (g->speed == USB_SPEED_HIGH) return 13 * 512 * 8 * 1000 * 8; else return 19 * 64 * 1 * 1000 * 8; diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index a366abb45623..4bb0553da658 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -93,11 +93,10 @@ struct eth_dev { #define DEFAULT_QLEN 2 /* double buffering by default */ -/* for dual-speed hardware, use deeper queues at high/super speed */ +/* use deeper queues at high/super speed */ static inline int qlen(struct usb_gadget *gadget, unsigned qmult) { - if (gadget_is_dualspeed(gadget) && (gadget->speed == USB_SPEED_HIGH || - gadget->speed >= USB_SPEED_SUPER)) + if (gadget->speed == USB_SPEED_HIGH || gadget->speed >= USB_SPEED_SUPER) return qmult * DEFAULT_QLEN; else return DEFAULT_QLEN; From patchwork Thu Aug 3 09:10:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13339569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 715A9C001DF for ; Thu, 3 Aug 2023 09:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235043AbjHCJLt (ORCPT ); Thu, 3 Aug 2023 05:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234640AbjHCJLZ (ORCPT ); Thu, 3 Aug 2023 05:11:25 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B38135B5 for ; Thu, 3 Aug 2023 02:11:10 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3736LfbU003599; Thu, 3 Aug 2023 09:11:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=SxNXJZBhGOhSoRgtoq2N8H2t1MFrvgbFsEDbdtNaPAU=; b=GfbHzKuGCxzhPgzuqwrrCj4wCqZZUzudNckaSILXo3Dpf4dWT0GqvvH1snma9pisADsA HjEkVrbYQpA1y7b1KqJ3PN2KODE9XNugjsOa67+AJWm3WX9LSf7Y5AGWPf+iuGi2nLNr 4wU43RiL24Bge73bkfhmj5uVog93OKkm4SbPUTsOFP0g/3VmtWoh5FEGvaaQyCCe1ORs 7hXbia9BV5C5R9hTaahTZVuh+hfnQmzxP2esN/zvSxG237uRWLROaC0qiSBlRL+XtLy6 /9LP/VjGHufO0XL0HBGhWsub19xE1zdcaJjDj3JLd57Ogl3yCW2AIzrSBmbdD8445BzH tw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s83q0gkwp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Aug 2023 09:11:09 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3739B8hx009988 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 09:11:08 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Thu, 3 Aug 2023 02:11:06 -0700 From: Linyu Yuan To: Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH v2 2/7] usb: gadget: add a inline function gether_bitrate() Date: Thu, 3 Aug 2023 17:10:48 +0800 Message-ID: <20230803091053.9714-3-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230803091053.9714-1-quic_linyyuan@quicinc.com> References: <20230803091053.9714-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: wDa2caWubYUfW9E2W23a109U-oFhZocS X-Proofpoint-GUID: wDa2caWubYUfW9E2W23a109U-oFhZocS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-03_07,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 impostorscore=0 malwarescore=0 suspectscore=0 mlxlogscore=365 priorityscore=1501 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308030080 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org In function ecm_bitrate(), it is not support report bit rate for super speed plus mode, but it can use same bit rate value defined in ncm and rndis. Add a common inline function gether_bitrate() which report different for all possible speeds, it can be used by ecm, ncm and rndis, also remove old function from them. Signed-off-by: Linyu Yuan --- v2: fix comment from Oliver Neukum drivers/usb/gadget/function/f_ecm.c | 15 ++------------- drivers/usb/gadget/function/f_ncm.c | 19 ++----------------- drivers/usb/gadget/function/f_rndis.c | 15 +-------------- drivers/usb/gadget/function/u_ether.h | 13 +++++++++++++ 4 files changed, 18 insertions(+), 44 deletions(-) diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c index cbe05da94bde..7e943b562348 100644 --- a/drivers/usb/gadget/function/f_ecm.c +++ b/drivers/usb/gadget/function/f_ecm.c @@ -65,17 +65,6 @@ static inline struct f_ecm *func_to_ecm(struct usb_function *f) return container_of(f, struct f_ecm, port.func); } -/* peak (theoretical) bulk transfer rate in bits-per-second */ -static inline unsigned ecm_bitrate(struct usb_gadget *g) -{ - if (g->speed == USB_SPEED_SUPER) - return 13 * 1024 * 8 * 1000 * 8; - else if (g->speed == USB_SPEED_HIGH) - return 13 * 512 * 8 * 1000 * 8; - else - return 19 * 64 * 1 * 1000 * 8; -} - /*-------------------------------------------------------------------------*/ /* @@ -411,10 +400,10 @@ static void ecm_do_notify(struct f_ecm *ecm) /* SPEED_CHANGE data is up/down speeds in bits/sec */ data = req->buf + sizeof *event; - data[0] = cpu_to_le32(ecm_bitrate(cdev->gadget)); + data[0] = cpu_to_le32(gether_bitrate(cdev->gadget)); data[1] = data[0]; - DBG(cdev, "notify speed %d\n", ecm_bitrate(cdev->gadget)); + DBG(cdev, "notify speed %d\n", gether_bitrate(cdev->gadget)); ecm->notify_state = ECM_NOTIFY_NONE; break; } diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c index e6dac5510540..0feadf686a31 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c @@ -80,21 +80,6 @@ static inline struct f_ncm *func_to_ncm(struct usb_function *f) return container_of(f, struct f_ncm, port.func); } -/* peak (theoretical) bulk transfer rate in bits-per-second */ -static inline unsigned ncm_bitrate(struct usb_gadget *g) -{ - if (!g) - return 0; - else if (g->speed >= USB_SPEED_SUPER_PLUS) - return 4250000000U; - else if (g->speed == USB_SPEED_SUPER) - return 3750000000U; - else if (g->speed == USB_SPEED_HIGH) - return 13 * 512 * 8 * 1000 * 8; - else - return 19 * 64 * 1 * 1000 * 8; -} - /*-------------------------------------------------------------------------*/ /* @@ -576,10 +561,10 @@ static void ncm_do_notify(struct f_ncm *ncm) /* SPEED_CHANGE data is up/down speeds in bits/sec */ data = req->buf + sizeof *event; - data[0] = cpu_to_le32(ncm_bitrate(cdev->gadget)); + data[0] = cpu_to_le32(gether_bitrate(cdev->gadget)); data[1] = data[0]; - DBG(cdev, "notify speed %u\n", ncm_bitrate(cdev->gadget)); + DBG(cdev, "notify speed %u\n", gether_bitrate(cdev->gadget)); ncm->notify_state = NCM_NOTIFY_CONNECT; break; } diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index eff5d7cbce00..ed1c3eb91d3b 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c @@ -84,19 +84,6 @@ static inline struct f_rndis *func_to_rndis(struct usb_function *f) return container_of(f, struct f_rndis, port.func); } -/* peak (theoretical) bulk transfer rate in bits-per-second */ -static unsigned int bitrate(struct usb_gadget *g) -{ - if (g->speed >= USB_SPEED_SUPER_PLUS) - return 4250000000U; - if (g->speed == USB_SPEED_SUPER) - return 3750000000U; - else if (g->speed == USB_SPEED_HIGH) - return 13 * 512 * 8 * 1000 * 8; - else - return 19 * 64 * 1 * 1000 * 8; -} - /*-------------------------------------------------------------------------*/ /* @@ -640,7 +627,7 @@ static void rndis_open(struct gether *geth) DBG(cdev, "%s\n", __func__); rndis_set_param_medium(rndis->params, RNDIS_MEDIUM_802_3, - bitrate(cdev->gadget) / 100); + gether_bitrate(cdev->gadget) / 100); rndis_signal_connect(rndis->params); } diff --git a/drivers/usb/gadget/function/u_ether.h b/drivers/usb/gadget/function/u_ether.h index 851ee10d6e63..34be220cef77 100644 --- a/drivers/usb/gadget/function/u_ether.h +++ b/drivers/usb/gadget/function/u_ether.h @@ -279,4 +279,17 @@ static inline bool can_support_ecm(struct usb_gadget *gadget) return true; } +/* peak (theoretical) bulk transfer rate in bits-per-second */ +static inline unsigned int gether_bitrate(struct usb_gadget *g) +{ + if (g->speed >= USB_SPEED_SUPER_PLUS) + return 4250000000U; + if (g->speed == USB_SPEED_SUPER) + return 3750000000U; + else if (g->speed == USB_SPEED_HIGH) + return 13 * 512 * 8 * 1000 * 8; + else + return 19 * 64 * 1 * 1000 * 8; +} + #endif /* __U_ETHER_H */ From patchwork Thu Aug 3 09:10:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13339573 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A6F8C001DF for ; Thu, 3 Aug 2023 09:12:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235012AbjHCJMc (ORCPT ); Thu, 3 Aug 2023 05:12:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233952AbjHCJL6 (ORCPT ); Thu, 3 Aug 2023 05:11:58 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFDC330DA for ; Thu, 3 Aug 2023 02:11:32 -0700 (PDT) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3735fc3Y026987; Thu, 3 Aug 2023 09:11:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=IQxjvLgVthzmQ8/fLKIdp1JYcq8j6pbTZCtO9fGlrC8=; b=Te6lmRiUJuDv/YVO22kEX3Qj1ucd2KsRMT+UI45KJojQP1rIlfZRDtJy4xk2RPRtgPHt x2F/uJYtZ3GsfelP6Tn7yZFajMM6R34LNNKaEeAhA4e+4OTFiVs+A278jRzpLQz/jUgN Mw15XewcTZ+ZK9jxaXBniJqBLJBxyfKfvCycfPpYDU2xbXOONqmZNqB8NPuRZFDIEVXm rz5HMWCSD4IcwE+tNkGoB/e+1MeHu77heFih0gnMzzmpdEUPr9PzBuY4XA5xWwgzn1zE wFoOJqHs+l5PZV+OyYl6oGlXGhmbs1fhkb7flnpO5Afcg290Hz9sqzdJAz9Pwz+aC8Sm aQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s7upp1g4y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Aug 2023 09:11:31 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3739B9Kv021141 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 09:11:09 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Thu, 3 Aug 2023 02:11:07 -0700 From: Linyu Yuan To: Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH v2 3/7] usb: gadget: f_uvc: change endpoint allocation in uvc_function_bind() Date: Thu, 3 Aug 2023 17:10:49 +0800 Message-ID: <20230803091053.9714-4-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230803091053.9714-1-quic_linyyuan@quicinc.com> References: <20230803091053.9714-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: HD1-2wnOPo2pOrcAPghrq361ky1najJ4 X-Proofpoint-ORIG-GUID: HD1-2wnOPo2pOrcAPghrq361ky1najJ4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-03_06,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 malwarescore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=297 bulkscore=0 impostorscore=0 priorityscore=1501 adultscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308030081 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org when call uvc_function_bind(), gadget still have no connection speed, just follow other gadget function, use fs endpoint descriptor to allocate a video endpoint, remove gadget_is_{super|dual}speed() API call. Signed-off-by: Linyu Yuan --- v2: no change drivers/usb/gadget/function/f_uvc.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index 5e919fb65833..c8e149f8315f 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -719,21 +719,13 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) } uvc->enable_interrupt_ep = opts->enable_interrupt_ep; - if (gadget_is_superspeed(c->cdev->gadget)) - ep = usb_ep_autoconfig_ss(cdev->gadget, &uvc_ss_streaming_ep, - &uvc_ss_streaming_comp); - else if (gadget_is_dualspeed(cdev->gadget)) - ep = usb_ep_autoconfig(cdev->gadget, &uvc_hs_streaming_ep); - else - ep = usb_ep_autoconfig(cdev->gadget, &uvc_fs_streaming_ep); - + ep = usb_ep_autoconfig(cdev->gadget, &uvc_fs_streaming_ep); if (!ep) { uvcg_info(f, "Unable to allocate streaming EP\n"); goto error; } uvc->video.ep = ep; - uvc_fs_streaming_ep.bEndpointAddress = uvc->video.ep->address; uvc_hs_streaming_ep.bEndpointAddress = uvc->video.ep->address; uvc_ss_streaming_ep.bEndpointAddress = uvc->video.ep->address; From patchwork Thu Aug 3 09:10:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13339570 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC6E6C001DF for ; Thu, 3 Aug 2023 09:12:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235034AbjHCJMO (ORCPT ); Thu, 3 Aug 2023 05:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235037AbjHCJLn (ORCPT ); Thu, 3 Aug 2023 05:11:43 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E91DC4200 for ; Thu, 3 Aug 2023 02:11:20 -0700 (PDT) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3737qiCP014019; Thu, 3 Aug 2023 09:11:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=WoVQz2c2nX7hkkPLCE2Mo0vmVTBlcD1TW/x9HXnvEW4=; b=DFrR8eEU+fww/iZnvaPEYqeKdgo0XyVWTmuXgVy0OaMAomkHPLLtTDbzoFVepNvUkUkU 76gSCm9pRNSaXyfaN6axTckr8de16IRtb22dVMbM90WTm9s6g9T3/9EDTka6eoTMKs3k KeFmo3si7rHDKhUi8M1pcN4ovAZU63sH2lvt9ZLReopxKhwO3RqaHgGC9NwNHVrPUvCh DQBX12IwQxB1pxEjjuSRoHYE951/UKyAlXrS49NF8y+86aGWMIyxNmtrPgYf8oJ/9MFx B33OVtMWNqbVk4JWzPtKCTQg7CCDrvOo0QJtmhivd6KFhuWu0QXAHQ+OPzv0w+7ZL9s4 9g== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s7vtv9a8y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Aug 2023 09:11:19 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3739BBeg024612 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 09:11:11 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Thu, 3 Aug 2023 02:11:09 -0700 From: Linyu Yuan To: Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH v2 4/7] usb: gadget: unconditionally allocate hs/ss descriptor in bind operation Date: Thu, 3 Aug 2023 17:10:50 +0800 Message-ID: <20230803091053.9714-5-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230803091053.9714-1-quic_linyyuan@quicinc.com> References: <20230803091053.9714-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: GU2Qmr4suzjPjF3RDfdPBfQY4IS-Y5lm X-Proofpoint-ORIG-GUID: GU2Qmr4suzjPjF3RDfdPBfQY4IS-Y5lm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-03_07,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 suspectscore=0 phishscore=0 adultscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=271 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308030081 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Take f_midi_bind() for example, when composite layer call it, it will allocate hs descriptor by calling gadget_is_dualspeed() API to check gadget max support speed capability, but most other gadget function didn't do like this. To follow other function drivers, it is safe to remove the check which mean support all possible link speed by default in function driver. Similar change apply to midi2 and uvc. Also in midi and midi2, as there is no descriptor difference between super speed and super speed plus, follow other gadget function drivers, do not allocate descriptor for super speed plus, composite layer will handle it properly. Signed-off-by: Linyu Yuan --- v2: no change drivers/usb/gadget/function/f_midi.c | 56 +++++++++++---------------- drivers/usb/gadget/function/f_midi2.c | 44 ++++++++------------- drivers/usb/gadget/function/f_uvc.c | 26 ++++++------- 3 files changed, 51 insertions(+), 75 deletions(-) diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index fddf539008a9..2d02f25f9597 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c @@ -1023,40 +1023,30 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f) if (!f->fs_descriptors) goto fail_f_midi; - if (gadget_is_dualspeed(c->cdev->gadget)) { - bulk_in_desc.wMaxPacketSize = cpu_to_le16(512); - bulk_out_desc.wMaxPacketSize = cpu_to_le16(512); - f->hs_descriptors = usb_copy_descriptors(midi_function); - if (!f->hs_descriptors) - goto fail_f_midi; - } + bulk_in_desc.wMaxPacketSize = cpu_to_le16(512); + bulk_out_desc.wMaxPacketSize = cpu_to_le16(512); + f->hs_descriptors = usb_copy_descriptors(midi_function); + if (!f->hs_descriptors) + goto fail_f_midi; - if (gadget_is_superspeed(c->cdev->gadget)) { - bulk_in_desc.wMaxPacketSize = cpu_to_le16(1024); - bulk_out_desc.wMaxPacketSize = cpu_to_le16(1024); - i = endpoint_descriptor_index; - midi_function[i++] = (struct usb_descriptor_header *) - &bulk_out_desc; - midi_function[i++] = (struct usb_descriptor_header *) - &bulk_out_ss_comp_desc; - midi_function[i++] = (struct usb_descriptor_header *) - &ms_out_desc; - midi_function[i++] = (struct usb_descriptor_header *) - &bulk_in_desc; - midi_function[i++] = (struct usb_descriptor_header *) - &bulk_in_ss_comp_desc; - midi_function[i++] = (struct usb_descriptor_header *) - &ms_in_desc; - f->ss_descriptors = usb_copy_descriptors(midi_function); - if (!f->ss_descriptors) - goto fail_f_midi; - - if (gadget_is_superspeed_plus(c->cdev->gadget)) { - f->ssp_descriptors = usb_copy_descriptors(midi_function); - if (!f->ssp_descriptors) - goto fail_f_midi; - } - } + bulk_in_desc.wMaxPacketSize = cpu_to_le16(1024); + bulk_out_desc.wMaxPacketSize = cpu_to_le16(1024); + i = endpoint_descriptor_index; + midi_function[i++] = (struct usb_descriptor_header *) + &bulk_out_desc; + midi_function[i++] = (struct usb_descriptor_header *) + &bulk_out_ss_comp_desc; + midi_function[i++] = (struct usb_descriptor_header *) + &ms_out_desc; + midi_function[i++] = (struct usb_descriptor_header *) + &bulk_in_desc; + midi_function[i++] = (struct usb_descriptor_header *) + &bulk_in_ss_comp_desc; + midi_function[i++] = (struct usb_descriptor_header *) + &ms_in_desc; + f->ss_descriptors = usb_copy_descriptors(midi_function); + if (!f->ss_descriptors) + goto fail_f_midi; kfree(midi_function); diff --git a/drivers/usb/gadget/function/f_midi2.c b/drivers/usb/gadget/function/f_midi2.c index 5a971ba600fe..ec8cd7c7bbfc 100644 --- a/drivers/usb/gadget/function/f_midi2.c +++ b/drivers/usb/gadget/function/f_midi2.c @@ -1731,7 +1731,6 @@ static int f_midi2_create_usb_configs(struct f_midi2 *midi2, midi1_out_eps = midi2_midi1_ep_out_descs; break; case USB_SPEED_SUPER: - case USB_SPEED_SUPER_PLUS: midi2_midi1_ep_out_desc.wMaxPacketSize = cpu_to_le16(1024); midi2_midi1_ep_in_desc.wMaxPacketSize = cpu_to_le16(1024); for (i = 0; i < midi2->num_eps; i++) @@ -2001,36 +2000,25 @@ static int f_midi2_bind(struct usb_configuration *c, struct usb_function *f) } f_midi2_free_usb_configs(&config); - if (gadget_is_dualspeed(midi2->gadget)) { - status = f_midi2_create_usb_configs(midi2, &config, USB_SPEED_HIGH); - if (status < 0) - goto fail; - f->hs_descriptors = usb_copy_descriptors(config.list); - if (!f->hs_descriptors) { - status = -ENOMEM; - goto fail; - } - f_midi2_free_usb_configs(&config); + status = f_midi2_create_usb_configs(midi2, &config, USB_SPEED_HIGH); + if (status < 0) + goto fail; + f->hs_descriptors = usb_copy_descriptors(config.list); + if (!f->hs_descriptors) { + status = -ENOMEM; + goto fail; } + f_midi2_free_usb_configs(&config); - if (gadget_is_superspeed(midi2->gadget)) { - status = f_midi2_create_usb_configs(midi2, &config, USB_SPEED_SUPER); - if (status < 0) - goto fail; - f->ss_descriptors = usb_copy_descriptors(config.list); - if (!f->ss_descriptors) { - status = -ENOMEM; - goto fail; - } - if (gadget_is_superspeed_plus(midi2->gadget)) { - f->ssp_descriptors = usb_copy_descriptors(config.list); - if (!f->ssp_descriptors) { - status = -ENOMEM; - goto fail; - } - } - f_midi2_free_usb_configs(&config); + status = f_midi2_create_usb_configs(midi2, &config, USB_SPEED_SUPER); + if (status < 0) + goto fail; + f->ss_descriptors = usb_copy_descriptors(config.list); + if (!f->ss_descriptors) { + status = -ENOMEM; + goto fail; } + f_midi2_free_usb_configs(&config); mutex_unlock(&f_midi2_desc_mutex); return 0; diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index c8e149f8315f..faa398109431 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -780,21 +780,19 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) f->fs_descriptors = NULL; goto error; } - if (gadget_is_dualspeed(cdev->gadget)) { - f->hs_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_HIGH); - if (IS_ERR(f->hs_descriptors)) { - ret = PTR_ERR(f->hs_descriptors); - f->hs_descriptors = NULL; - goto error; - } + + f->hs_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_HIGH); + if (IS_ERR(f->hs_descriptors)) { + ret = PTR_ERR(f->hs_descriptors); + f->hs_descriptors = NULL; + goto error; } - if (gadget_is_superspeed(c->cdev->gadget)) { - f->ss_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER); - if (IS_ERR(f->ss_descriptors)) { - ret = PTR_ERR(f->ss_descriptors); - f->ss_descriptors = NULL; - goto error; - } + + f->ss_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER); + if (IS_ERR(f->ss_descriptors)) { + ret = PTR_ERR(f->ss_descriptors); + f->ss_descriptors = NULL; + goto error; } /* Preallocate control endpoint request. */ From patchwork Thu Aug 3 09:10:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13339571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CF6CC001DF for ; Thu, 3 Aug 2023 09:12:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235039AbjHCJMS (ORCPT ); Thu, 3 Aug 2023 05:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235041AbjHCJLq (ORCPT ); Thu, 3 Aug 2023 05:11:46 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 288D8420F for ; Thu, 3 Aug 2023 02:11:21 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 373892W7028600; Thu, 3 Aug 2023 09:11:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=CZw+ki70ytr/Aed74lUxdyPi1Wqv5M4TMrhoNS00LUg=; b=GN3X5uDOx5Dd5JLF1HAyEUdhmFpbGlY9WPj+/Y2GO6vyk/ZPBI8T3iusF+4+SalVDlVC 78wIWvlRYy/n0ub1EJpRCm3AHi+ekF2guFT5PfOFfDJi/p/gW+NSeXvQbkNQTvKNVTPT O+HsnnDuQlmX1NC9ZL4NQwJBh9nUccLBFPZ6t09OpK2b9KtYeU8S5rWoJxmFLThk6g9H oaTWpCY/nJp1TITow16azLbKNZNtfIokN1vX4i8FT21A7dHaz5zIZ7WW6e96bgZu4ZIo UbNl55OCo4ehYDqUpD6aKsUivK0ju9QInJ6RcknQLzBKC5OoKZWVyai26eBxJh3jbf4b 7A== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s82wx8pds-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Aug 2023 09:11:20 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3739BC5s018414 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 09:11:12 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Thu, 3 Aug 2023 02:11:10 -0700 From: Linyu Yuan To: Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH v2 5/7] usb: gadget: config: remove max speed check in usb_assign_descriptors() Date: Thu, 3 Aug 2023 17:10:51 +0800 Message-ID: <20230803091053.9714-6-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230803091053.9714-1-quic_linyyuan@quicinc.com> References: <20230803091053.9714-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 4ZaalPNpXcsFx6pH_ReJjOycrvMT65Fa X-Proofpoint-GUID: 4ZaalPNpXcsFx6pH_ReJjOycrvMT65Fa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-03_07,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=609 phishscore=0 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308030081 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org usb_assign_descriptors() usally called inside function bind operation, and gadget still have no working connection speed, let's support all speed at this point, it may possible allocate extra memory to store descriptors, but it is small and acceptable. Remove gadget_is_{*}speed() API checking to allow support all speed. Signed-off-by: Linyu Yuan --- v2: no change drivers/usb/gadget/config.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c index 05507606b2b4..b1f625245713 100644 --- a/drivers/usb/gadget/config.c +++ b/drivers/usb/gadget/config.c @@ -162,8 +162,6 @@ int usb_assign_descriptors(struct usb_function *f, struct usb_descriptor_header **ss, struct usb_descriptor_header **ssp) { - struct usb_gadget *g = f->config->cdev->gadget; - /* super-speed-plus descriptor falls back to super-speed one, * if such a descriptor was provided, thus avoiding a NULL * pointer dereference if a 5gbps capable gadget is used with @@ -177,17 +175,17 @@ int usb_assign_descriptors(struct usb_function *f, if (!f->fs_descriptors) goto err; } - if (hs && gadget_is_dualspeed(g)) { + if (hs) { f->hs_descriptors = usb_copy_descriptors(hs); if (!f->hs_descriptors) goto err; } - if (ss && gadget_is_superspeed(g)) { + if (ss) { f->ss_descriptors = usb_copy_descriptors(ss); if (!f->ss_descriptors) goto err; } - if (ssp && gadget_is_superspeed_plus(g)) { + if (ssp) { f->ssp_descriptors = usb_copy_descriptors(ssp); if (!f->ssp_descriptors) goto err; From patchwork Thu Aug 3 09:10:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13339572 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C2C2C00528 for ; Thu, 3 Aug 2023 09:12:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233647AbjHCJMa (ORCPT ); Thu, 3 Aug 2023 05:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234999AbjHCJL4 (ORCPT ); Thu, 3 Aug 2023 05:11:56 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D040C30DB for ; Thu, 3 Aug 2023 02:11:32 -0700 (PDT) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3737H43F019696; Thu, 3 Aug 2023 09:11:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=Uq+VxVLUXgQpBbn2rTm9pyXsHvy6qJlIdWzuexQwcM8=; b=hjmVFEx4OlrIK0jFi8eQXzTT4A8oWZw4e2VPhTeQpHuEmcRcc4IfPAc0D+XYAv9N0L+0 Kfd4XvF1QIhzdgo8auQXmUIgj2SMyViMW0zBea+B0Hr4uouczRk3BLO4X9619rQ91Hji w8rbdP7WeudUb+OoOq5FGhFAgC7EbB6wXTGvHvpFUDC9lw3dS+rWTTpyzpgvlBCu/Grl /ENDdMD2czBKz1CPvLxrDNClJ4uUvRJlTKqN6OVlQWfSC+GTrL8Tz2dAfElWceHp07a6 ayu3p97Rowkpxqrenw3XsJKSoBpsJFw8jBFrU/k6iQNlMQ13d/QhDkIf1Io6xBE5oj1q uA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s7upp1g53-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Aug 2023 09:11:31 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3739BEFd021204 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 09:11:14 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Thu, 3 Aug 2023 02:11:12 -0700 From: Linyu Yuan To: Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH v2 6/7] usb: gadget: composite: cleanup function config_ep_by_speed_and_alt() Date: Thu, 3 Aug 2023 17:10:52 +0800 Message-ID: <20230803091053.9714-7-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230803091053.9714-1-quic_linyyuan@quicinc.com> References: <20230803091053.9714-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: sKxXCQlHMgja1tlU0n-4wsRlmibVeGE0 X-Proofpoint-ORIG-GUID: sKxXCQlHMgja1tlU0n-4wsRlmibVeGE0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-03_06,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 malwarescore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=687 bulkscore=0 impostorscore=0 priorityscore=1501 adultscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308030081 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org When call this function, gadget already have working speed, if it is USB_SPEED_SUPER_PLUS, in theroy gadget_is_superspeed_plus() checking should be true, so there is no need to call it. it is same for other working speed. Remove all gadget_is_{*}speed_plus() API call to clean it up. Signed-off-by: Linyu Yuan --- v2: no change drivers/usb/gadget/composite.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index dd9b90481b4c..0ace45b66a31 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -170,33 +170,27 @@ int config_ep_by_speed_and_alt(struct usb_gadget *g, /* select desired speed */ switch (g->speed) { case USB_SPEED_SUPER_PLUS: - if (gadget_is_superspeed_plus(g)) { - if (f->ssp_descriptors) { - speed_desc = f->ssp_descriptors; - want_comp_desc = 1; - break; - } - incomplete_desc = true; + if (f->ssp_descriptors) { + speed_desc = f->ssp_descriptors; + want_comp_desc = 1; + break; } + incomplete_desc = true; fallthrough; case USB_SPEED_SUPER: - if (gadget_is_superspeed(g)) { - if (f->ss_descriptors) { - speed_desc = f->ss_descriptors; - want_comp_desc = 1; - break; - } - incomplete_desc = true; + if (f->ss_descriptors) { + speed_desc = f->ss_descriptors; + want_comp_desc = 1; + break; } + incomplete_desc = true; fallthrough; case USB_SPEED_HIGH: - if (gadget_is_dualspeed(g)) { - if (f->hs_descriptors) { - speed_desc = f->hs_descriptors; - break; - } - incomplete_desc = true; + if (f->hs_descriptors) { + speed_desc = f->hs_descriptors; + break; } + incomplete_desc = true; fallthrough; default: speed_desc = f->fs_descriptors; From patchwork Thu Aug 3 09:10:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13339574 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A557C001DF for ; Thu, 3 Aug 2023 09:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235029AbjHCJMl (ORCPT ); Thu, 3 Aug 2023 05:12:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232258AbjHCJMM (ORCPT ); Thu, 3 Aug 2023 05:12:12 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B12763582 for ; Thu, 3 Aug 2023 02:11:48 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3735XwiZ007757; Thu, 3 Aug 2023 09:11:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=KyHLKSfybuM7d6uV/lxIOhUHC4OLn8T1tnlI7a/JCrA=; b=NJfKd1D4jgOl2Z966qC321jx69hmwnQ2SISA53+3IlQZaFA/DzmNVue4XYUxhR4VQqM6 wrA9+RnkbmipYH3uy2qI83iV4A6DPDcj/WVjExs8bB1KCNXXRc8KHPzj2sumpR/clSmu sQHaIkjq5qAX3B/Fz7RT28VHhGW8j2wySd6LiOVDL7DiSRlNMK78qYGHt0M5d0IPvwMS vZZC2ieILMyPWh8hTYuNzAHIRf7p4xlG7oSapeuLDSkDv6ZiCfxE6xMs5wSldk9+CtEo eh2dW10aCMxwVe3LRuy0HIvuxquqqIYmk9gh9Poy8OhPSPJBF4lEKQbCiyV3/TUFW+Og +g== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s83q0gkx1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Aug 2023 09:11:47 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3739BFPu000398 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 3 Aug 2023 09:11:15 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Thu, 3 Aug 2023 02:11:13 -0700 From: Linyu Yuan To: Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH v2 7/7] usb: gadget: remove max support speed info in bind operation Date: Thu, 3 Aug 2023 17:10:53 +0800 Message-ID: <20230803091053.9714-8-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230803091053.9714-1-quic_linyyuan@quicinc.com> References: <20230803091053.9714-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 3UwNbfBwryZXjxkBdnHaFnZDqEvZIAVG X-Proofpoint-GUID: 3UwNbfBwryZXjxkBdnHaFnZDqEvZIAVG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-03_07,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 impostorscore=0 malwarescore=0 suspectscore=0 mlxlogscore=712 priorityscore=1501 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308030081 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Take ecm_bind() for example, it call gadget_is_{*}speed() API to show gadget max support speed, it is not much help, remove the API usage here is safe. Similar change apply to acm,eem,loopback,ncm,obex,rndis,serial, sourcesink,subset functions. Signed-off-by: Linyu Yuan --- v2: no change drivers/usb/gadget/function/f_acm.c | 4 +--- drivers/usb/gadget/function/f_ecm.c | 4 +--- drivers/usb/gadget/function/f_eem.c | 4 +--- drivers/usb/gadget/function/f_loopback.c | 4 +--- drivers/usb/gadget/function/f_ncm.c | 4 +--- drivers/usb/gadget/function/f_obex.c | 3 +-- drivers/usb/gadget/function/f_rndis.c | 4 +--- drivers/usb/gadget/function/f_serial.c | 4 +--- drivers/usb/gadget/function/f_sourcesink.c | 4 +--- drivers/usb/gadget/function/f_subset.c | 4 +--- 10 files changed, 10 insertions(+), 29 deletions(-) diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c index cb523f118f04..f616059c5e1e 100644 --- a/drivers/usb/gadget/function/f_acm.c +++ b/drivers/usb/gadget/function/f_acm.c @@ -691,10 +691,8 @@ acm_bind(struct usb_configuration *c, struct usb_function *f) goto fail; dev_dbg(&cdev->gadget->dev, - "acm ttyGS%d: %s speed IN/%s OUT/%s NOTIFY/%s\n", + "acm ttyGS%d: IN/%s OUT/%s NOTIFY/%s\n", acm->port_num, - gadget_is_superspeed(c->cdev->gadget) ? "super" : - gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", acm->port.in->name, acm->port.out->name, acm->notify->name); return 0; diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c index 7e943b562348..f55f60639e42 100644 --- a/drivers/usb/gadget/function/f_ecm.c +++ b/drivers/usb/gadget/function/f_ecm.c @@ -788,9 +788,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f) ecm->port.open = ecm_open; ecm->port.close = ecm_close; - DBG(cdev, "CDC Ethernet: %s speed IN/%s OUT/%s NOTIFY/%s\n", - gadget_is_superspeed(c->cdev->gadget) ? "super" : - gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", + DBG(cdev, "CDC Ethernet: IN/%s OUT/%s NOTIFY/%s\n", ecm->port.in_ep->name, ecm->port.out_ep->name, ecm->notify->name); return 0; diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c index 5d38f29bda72..3b445bd88498 100644 --- a/drivers/usb/gadget/function/f_eem.c +++ b/drivers/usb/gadget/function/f_eem.c @@ -311,9 +311,7 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f) if (status) goto fail; - DBG(cdev, "CDC Ethernet (EEM): %s speed IN/%s OUT/%s\n", - gadget_is_superspeed(c->cdev->gadget) ? "super" : - gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", + DBG(cdev, "CDC Ethernet (EEM): IN/%s OUT/%s\n", eem->port.in_ep->name, eem->port.out_ep->name); return 0; diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c index ae41f556eb75..17ac6ace0cff 100644 --- a/drivers/usb/gadget/function/f_loopback.c +++ b/drivers/usb/gadget/function/f_loopback.c @@ -211,9 +211,7 @@ static int loopback_bind(struct usb_configuration *c, struct usb_function *f) if (ret) return ret; - DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n", - (gadget_is_superspeed(c->cdev->gadget) ? "super" : - (gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full")), + DBG(cdev, "%s: IN/%s, OUT/%s\n", f->name, loop->in_ep->name, loop->out_ep->name); return 0; } diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c index 0feadf686a31..feccf4c8cc4f 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c @@ -1529,9 +1529,7 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f) hrtimer_init(&ncm->task_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT); ncm->task_timer.function = ncm_tx_timeout; - DBG(cdev, "CDC Network: %s speed IN/%s OUT/%s NOTIFY/%s\n", - gadget_is_superspeed(c->cdev->gadget) ? "super" : - gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", + DBG(cdev, "CDC Network: IN/%s OUT/%s NOTIFY/%s\n", ncm->port.in_ep->name, ncm->port.out_ep->name, ncm->notify->name); return 0; diff --git a/drivers/usb/gadget/function/f_obex.c b/drivers/usb/gadget/function/f_obex.c index ab26d84ed95e..dcb093210305 100644 --- a/drivers/usb/gadget/function/f_obex.c +++ b/drivers/usb/gadget/function/f_obex.c @@ -365,9 +365,8 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f) if (status) goto fail; - dev_dbg(&cdev->gadget->dev, "obex ttyGS%d: %s speed IN/%s OUT/%s\n", + dev_dbg(&cdev->gadget->dev, "obex ttyGS%d: IN/%s OUT/%s\n", obex->port_num, - gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", obex->port.in->name, obex->port.out->name); return 0; diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index ed1c3eb91d3b..b47f99d17ee9 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c @@ -798,9 +798,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) * until we're activated via set_alt(). */ - DBG(cdev, "RNDIS: %s speed IN/%s OUT/%s NOTIFY/%s\n", - gadget_is_superspeed(c->cdev->gadget) ? "super" : - gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", + DBG(cdev, "RNDIS: IN/%s OUT/%s NOTIFY/%s\n", rndis->port.in_ep->name, rndis->port.out_ep->name, rndis->notify->name); return 0; diff --git a/drivers/usb/gadget/function/f_serial.c b/drivers/usb/gadget/function/f_serial.c index a9480b9e312e..65c50092aea2 100644 --- a/drivers/usb/gadget/function/f_serial.c +++ b/drivers/usb/gadget/function/f_serial.c @@ -236,10 +236,8 @@ static int gser_bind(struct usb_configuration *c, struct usb_function *f) gser_ss_function, gser_ss_function); if (status) goto fail; - dev_dbg(&cdev->gadget->dev, "generic ttyGS%d: %s speed IN/%s OUT/%s\n", + dev_dbg(&cdev->gadget->dev, "generic ttyGS%d: IN/%s OUT/%s\n", gser->port_num, - gadget_is_superspeed(c->cdev->gadget) ? "super" : - gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", gser->port.in->name, gser->port.out->name); return 0; diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c index 6803cd60cc6d..2edbd9b510d6 100644 --- a/drivers/usb/gadget/function/f_sourcesink.c +++ b/drivers/usb/gadget/function/f_sourcesink.c @@ -436,9 +436,7 @@ sourcesink_bind(struct usb_configuration *c, struct usb_function *f) if (ret) return ret; - DBG(cdev, "%s speed %s: IN/%s, OUT/%s, ISO-IN/%s, ISO-OUT/%s\n", - (gadget_is_superspeed(c->cdev->gadget) ? "super" : - (gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full")), + DBG(cdev, "%s: IN/%s, OUT/%s, ISO-IN/%s, ISO-OUT/%s\n", f->name, ss->in_ep->name, ss->out_ep->name, ss->iso_in_ep ? ss->iso_in_ep->name : "", ss->iso_out_ep ? ss->iso_out_ep->name : ""); diff --git a/drivers/usb/gadget/function/f_subset.c b/drivers/usb/gadget/function/f_subset.c index 51c1cae162d9..8ae9689ef2a0 100644 --- a/drivers/usb/gadget/function/f_subset.c +++ b/drivers/usb/gadget/function/f_subset.c @@ -367,9 +367,7 @@ geth_bind(struct usb_configuration *c, struct usb_function *f) * until we're activated via set_alt(). */ - DBG(cdev, "CDC Subset: %s speed IN/%s OUT/%s\n", - gadget_is_superspeed(c->cdev->gadget) ? "super" : - gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", + DBG(cdev, "CDC Subset: IN/%s OUT/%s\n", geth->port.in_ep->name, geth->port.out_ep->name); return 0;