Re: [PATCH v1] usb: dwc3: gadget: increase readability of dwc3_gadget_init_endpoints()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> writes:
> The commit 47d3946ea220
> 	usb: dwc3: refactor gadget endpoint count calculation
> refactored dwc3_gadget_init_endpoints() and in particular changed in our
> out endpoint numbering to be through. It's not always convenient and
> makes code a slightly harder to read.
>
> Introduce temporary variable to make it easier to understand what is
> going on inside function.
>
> Replace implicit direction check via epnum with explicit use of direction
> variable.
>
> While here, replace %d to %u when compounding endpoint name since we are
> using unsigned type.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/usb/dwc3/gadget.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index aea9a5b948b4..9b5ce474f641 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1992,6 +1992,7 @@ static int dwc3_gadget_init_endpoints(struct dwc3 *dwc, u8 num)
>  
>  	for (epnum = 0; epnum < num; epnum++) {
>  		bool			direction = epnum & 1;
> +		u8			inout = epnum >> 1;

inout is not really intuitive at all. I would rather rename u8 num to u8
total and rename inout to num. Care to do that and resend?

Thanks

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux