All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Cc: John Youn <John.Youn@synopsys.com>
Subject: Re: [PATCH v6 09/11] usb: dwc3: gadget: Implement setting of SSP rate
Date: Fri, 15 Jan 2021 13:13:21 +0200	[thread overview]
Message-ID: <87v9by1mi6.fsf@kernel.org> (raw)
In-Reply-To: <13fad6ff-f056-f6ab-713b-68794113e03c@synopsys.com>

[-- Attachment #1: Type: text/plain, Size: 1438 bytes --]


Hi,

Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> Felipe Balbi wrote:
>> Hi,
>>
>> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>>> @@ -2476,6 +2506,17 @@ static void dwc3_gadget_set_speed(struct usb_gadget *g,
>>>  	spin_unlock_irqrestore(&dwc->lock, flags);
>>>  }
>>>  
>>> +static void dwc3_gadget_set_ssp_rate(struct usb_gadget *g,
>>> +				     enum usb_ssp_rate rate)
>>> +{
>>> +	struct dwc3		*dwc = gadget_to_dwc(g);
>>> +	unsigned long		flags;
>>> +
>>> +	spin_lock_irqsave(&dwc->lock, flags);
>>> +	dwc->gadget_ssp_rate = rate;
>>> +	spin_unlock_irqrestore(&dwc->lock, flags);
>>> +}
>> it would be best to make this return a value. If udc_set_ssp_rate() is
>> called with invalid rate, UDC can notify core.
>>
>
> The core should know what ssp rate the gadget supports via the
> gadget->max_ssp_rate capability field. Any rate beyond that is invalid.
> Is it necessary to have a return value here? This uses the same logic as
> udc_set_speed()

Yeah, I don't know what I had in mind when I made ->udc_set_speed()
void. Then again, we know exactly who's calling it and we can guarantee
that no invalid values will be passed. There's no way for, for example,
userspace (via ffs) to call it with a bogus value.

Perhaps it's okay, but something to keep an eye for both
->udc_set_ssp_rate() and ->udc_set_speed().

Thanks for pointing me back at ->udc_set_speed().

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

  reply	other threads:[~2021-01-15 11:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14  2:52 [PATCH v6 00/11] usb: Support USB 3.2 multi-lanes Thinh Nguyen
2021-01-14  2:52 ` [PATCH v6 01/11] usb: ch9: Add USB 3.2 SSP attributes Thinh Nguyen
2021-01-14  9:58   ` Felipe Balbi
2021-01-14 18:58     ` Thinh Nguyen
2021-01-15 11:08       ` Felipe Balbi
2021-01-16  4:03         ` Thinh Nguyen
2021-01-18 11:32           ` Felipe Balbi
2021-01-14  2:52 ` [PATCH v6 02/11] usb: gadget: composite: Use SSP sublink speed macros Thinh Nguyen
2021-01-14  2:53 ` [PATCH v6 03/11] usb: gadget: Introduce SSP rates and lanes Thinh Nguyen
2021-01-14  2:53 ` [PATCH v6 04/11] usb: gadget: Introduce udc_set_ssp_rate() for SSP Thinh Nguyen
2021-01-14  2:53 ` [PATCH v6 05/11] usb: gadget: composite: Report various SSP sublink speeds Thinh Nguyen
2021-01-14  5:47   ` Peter Chen
2021-01-14  6:16     ` Thinh Nguyen
2021-01-15  0:51       ` Peter Chen
2021-01-15  2:40         ` Thinh Nguyen
2021-01-15  2:56           ` Thinh Nguyen
2021-01-16 13:37             ` Peter Chen
2021-01-14  2:53 ` [PATCH v6 06/11] dt-binding: usb: Include USB SSP rates in GenXxY Thinh Nguyen
2021-01-14  2:53 ` [PATCH v6 07/11] usb: common: Parse for USB SSP genXxY Thinh Nguyen
2021-01-14  2:53 ` [PATCH v6 08/11] usb: dwc3: core: Check maximum_speed " Thinh Nguyen
2021-01-14  2:53 ` [PATCH v6 09/11] usb: dwc3: gadget: Implement setting of SSP rate Thinh Nguyen
2021-01-14 10:02   ` Felipe Balbi
2021-01-14 18:17     ` Thinh Nguyen
2021-01-15 11:13       ` Felipe Balbi [this message]
2021-01-14  2:53 ` [PATCH v6 10/11] usb: dwc3: gadget: Track connected SSP rate and lane count Thinh Nguyen
2021-01-14  2:53 ` [PATCH v6 11/11] usb: dwc3: gadget: Set speed only up to the max supported Thinh Nguyen
2021-01-18 17:42 ` [PATCH v6 00/11] usb: Support USB 3.2 multi-lanes Greg Kroah-Hartman
2021-01-20  1:38   ` Thinh Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9by1mi6.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=John.Youn@synopsys.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.