mbox series

[0/7] remove some usage of gadget_is_{*}speed() API

Message ID 20230803051810.2974-1-quic_linyyuan@quicinc.com
Headers show
Series remove some usage of gadget_is_{*}speed() API | expand

Message

Linyu Yuan Aug. 3, 2023, 5:18 a.m. UTC
This series try to remove some usage of gadget_is_dualspeed(),
gadget_is_superspeed() and gadget_is_superspeed_plus().

please check each change for details.

Linyu Yuan (7):
  usb: gadget: f_ecm: fix ecm_bitrate() for SuperSpeed and above
  usb: gaget: use working speed to calcaulate network bitrate and qlen
  usb: gadget: f_uvc: change endpoint allocation in uvc_function_bind()
  usb: gadget: unconditionally allocate hs/ss descriptor in bind
    operation
  usb: gadget: config: remove max speed check in
    usb_assign_descriptors()
  usb: gadget: composite: cleanup function config_ep_by_speed_and_alt()
  usb: gadget: remove max support speed info in bind operation

 drivers/usb/gadget/composite.c             | 34 ++++++-------
 drivers/usb/gadget/config.c                |  8 ++--
 drivers/usb/gadget/function/f_acm.c        |  4 +-
 drivers/usb/gadget/function/f_ecm.c        | 12 ++---
 drivers/usb/gadget/function/f_eem.c        |  4 +-
 drivers/usb/gadget/function/f_loopback.c   |  4 +-
 drivers/usb/gadget/function/f_midi.c       | 56 +++++++++-------------
 drivers/usb/gadget/function/f_midi2.c      | 44 +++++++----------
 drivers/usb/gadget/function/f_ncm.c        | 10 ++--
 drivers/usb/gadget/function/f_obex.c       |  3 +-
 drivers/usb/gadget/function/f_rndis.c      | 10 ++--
 drivers/usb/gadget/function/f_serial.c     |  4 +-
 drivers/usb/gadget/function/f_sourcesink.c |  4 +-
 drivers/usb/gadget/function/f_subset.c     |  4 +-
 drivers/usb/gadget/function/f_uvc.c        | 36 +++++---------
 drivers/usb/gadget/function/u_ether.c      |  5 +-
 16 files changed, 92 insertions(+), 150 deletions(-)

Comments

Oliver Neukum Aug. 3, 2023, 6:56 a.m. UTC | #1
Hi,

On 03.08.23 07:18, Linyu Yuan wrote:
> In function ecm_bitrate(), it is not good to report same speed as
> super speed when gadget work at super speed plus.
> 
> Change report speed same as commit 986499b1569a ("usb: gadget: f_ncm:
> fix ncm_bitrate for SuperSpeed and above.").

this is very well, but it raises two questions.

1. What is the relation to decreasing the usage of gadget_is_*
This patch increases it. And why? Why not use raw speed?

2. Code like this is used in multiple gadget drivers.
Couldn't this be unified into a macro or something?

	Regards
		Oliver