linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] usb: gadget: udc: Fix assignment of 0/1 to bool variables
       [not found] <20191007181527.GA6816@saurav>
@ 2019-10-08  6:34 ` Michal Simek
  2019-10-22  6:11   ` Felipe Balbi
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2019-10-08  6:34 UTC (permalink / raw)
  To: Saurav Girepunje, balbi, gregkh, michal.simek, swboyd, linux-usb,
	linux-arm-kernel, linux-kernel
  Cc: saurav.girepunje

On 07. 10. 19 20:15, Saurav Girepunje wrote:
> Use true/false assignment for below bool variables in udc-xilinx.c:
> 
> bool buffer0ready;
> bool buffer1ready;
> bool is_in;
> bool is_iso;
> 
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
>  drivers/usb/gadget/udc/udc-xilinx.c | 36 ++++++++++++++---------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
> index 29d8e5f8bb58..b077c5bfd9ae 100644
> --- a/drivers/usb/gadget/udc/udc-xilinx.c
> +++ b/drivers/usb/gadget/udc/udc-xilinx.c
> @@ -392,7 +392,7 @@ static int xudc_dma_send(struct xusb_ep *ep, struct xusb_req *req,
>  			      XUSB_EP_BUF0COUNT_OFFSET, length);
>  		udc->write_fn(udc->addr, XUSB_DMA_CONTROL_OFFSET,
>  			      XUSB_DMA_BRR_CTRL | (1 << ep->epnumber));
> -		ep->buffer0ready = 1;
> +		ep->buffer0ready = true;
>  		ep->curbufnum = 1;
>  	} else if (ep->curbufnum && !ep->buffer1ready) {
>  		/* Get the Buffer address and copy the transmit data.*/
> @@ -404,7 +404,7 @@ static int xudc_dma_send(struct xusb_ep *ep, struct xusb_req *req,
>  		udc->write_fn(udc->addr, XUSB_DMA_CONTROL_OFFSET,
>  			      XUSB_DMA_BRR_CTRL | (1 << (ep->epnumber +
>  			      XUSB_STATUS_EP_BUFF2_SHIFT)));
> -		ep->buffer1ready = 1;
> +		ep->buffer1ready = true;
>  		ep->curbufnum = 0;
>  	} else {
>  		/* None of ping pong buffers are ready currently .*/
> @@ -442,7 +442,7 @@ static int xudc_dma_receive(struct xusb_ep *ep, struct xusb_req *req,
>  		udc->write_fn(udc->addr, XUSB_DMA_CONTROL_OFFSET,
>  			      XUSB_DMA_BRR_CTRL | XUSB_DMA_READ_FROM_DPRAM |
>  			      (1 << ep->epnumber));
> -		ep->buffer0ready = 1;
> +		ep->buffer0ready = true;
>  		ep->curbufnum = 1;
>  	} else if (ep->curbufnum && !ep->buffer1ready) {
>  		/* Get the Buffer address and copy the transmit data */
> @@ -453,7 +453,7 @@ static int xudc_dma_receive(struct xusb_ep *ep, struct xusb_req *req,
>  			      XUSB_DMA_BRR_CTRL | XUSB_DMA_READ_FROM_DPRAM |
>  			      (1 << (ep->epnumber +
>  			      XUSB_STATUS_EP_BUFF2_SHIFT)));
> -		ep->buffer1ready = 1;
> +		ep->buffer1ready = true;
>  		ep->curbufnum = 0;
>  	} else {
>  		/* None of the ping-pong buffers are ready currently */
> @@ -507,7 +507,7 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xusb_req *req,
>  		 */
>  		udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET,
>  			      1 << ep->epnumber);
> -		ep->buffer0ready = 1;
> +		ep->buffer0ready = true;
>  		ep->curbufnum = 1;
>  	} else if (ep->curbufnum && !ep->buffer1ready) {
>  		/* Get the Buffer address and copy the transmit data.*/
> @@ -525,7 +525,7 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xusb_req *req,
>  		 */
>  		udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET,
>  			      1 << (ep->epnumber + XUSB_STATUS_EP_BUFF2_SHIFT));
> -		ep->buffer1ready = 1;
> +		ep->buffer1ready = true;
>  		ep->curbufnum = 0;
>  	} else {
>  		/* None of the ping-pong buffers are ready currently */
> @@ -818,11 +818,11 @@ static int __xudc_ep_enable(struct xusb_ep *ep,
>  	case USB_ENDPOINT_XFER_CONTROL:
>  		dev_dbg(udc->dev, "only one control endpoint\n");
>  		/* NON- ISO */
> -		ep->is_iso = 0;
> +		ep->is_iso = false;
>  		return -EINVAL;
>  	case USB_ENDPOINT_XFER_INT:
>  		/* NON- ISO */
> -		ep->is_iso = 0;
> +		ep->is_iso = false;
>  		if (maxpacket > 64) {
>  			dev_dbg(udc->dev, "bogus maxpacket %d\n", maxpacket);
>  			return -EINVAL;
> @@ -830,7 +830,7 @@ static int __xudc_ep_enable(struct xusb_ep *ep,
>  		break;
>  	case USB_ENDPOINT_XFER_BULK:
>  		/* NON- ISO */
> -		ep->is_iso = 0;
> +		ep->is_iso = false;
>  		if (!(is_power_of_2(maxpacket) && maxpacket >= 8 &&
>  				maxpacket <= 512)) {
>  			dev_dbg(udc->dev, "bogus maxpacket %d\n", maxpacket);
> @@ -839,12 +839,12 @@ static int __xudc_ep_enable(struct xusb_ep *ep,
>  		break;
>  	case USB_ENDPOINT_XFER_ISOC:
>  		/* ISO */
> -		ep->is_iso = 1;
> +		ep->is_iso = true;
>  		break;
>  	}
>  
> -	ep->buffer0ready = 0;
> -	ep->buffer1ready = 0;
> +	ep->buffer0ready = false;
> +	ep->buffer1ready = false;
>  	ep->curbufnum = 0;
>  	ep->rambase = rambase[ep->epnumber];
>  	xudc_epconfig(ep, udc);
> @@ -868,11 +868,11 @@ static int __xudc_ep_enable(struct xusb_ep *ep,
>  	if (ep->epnumber && !ep->is_in) {
>  		udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET,
>  			      1 << ep->epnumber);
> -		ep->buffer0ready = 1;
> +		ep->buffer0ready = true;
>  		udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET,
>  			     (1 << (ep->epnumber +
>  			      XUSB_STATUS_EP_BUFF2_SHIFT)));
> -		ep->buffer1ready = 1;
> +		ep->buffer1ready = true;
>  	}
>  
>  	return 0;
> @@ -1331,8 +1331,8 @@ static void xudc_eps_init(struct xusb_udc *udc)
>  		 * each endpoint is 0x10.
>  		 */
>  		ep->offset = XUSB_EP0_CONFIG_OFFSET + (ep_number * 0x10);
> -		ep->is_in = 0;
> -		ep->is_iso = 0;
> +		ep->is_in = false;
> +		ep->is_iso = false;
>  		ep->maxpacket = 0;
>  		xudc_epconfig(ep, udc);
>  
> @@ -1952,9 +1952,9 @@ static void xudc_nonctrl_ep_handler(struct xusb_udc *udc, u8 epnum,
>  	ep = &udc->ep[epnum];
>  	/* Process the End point interrupts.*/
>  	if (intrstatus & (XUSB_STATUS_EP0_BUFF1_COMP_MASK << epnum))
> -		ep->buffer0ready = 0;
> +		ep->buffer0ready = false;
>  	if (intrstatus & (XUSB_STATUS_EP0_BUFF2_COMP_MASK << epnum))
> -		ep->buffer1ready = 0;
> +		ep->buffer1ready = false;
>  
>  	if (list_empty(&ep->queue))
>  		return;
> 

Acked-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: gadget: udc: Fix assignment of 0/1 to bool variables
  2019-10-08  6:34 ` [PATCH] usb: gadget: udc: Fix assignment of 0/1 to bool variables Michal Simek
@ 2019-10-22  6:11   ` Felipe Balbi
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2019-10-22  6:11 UTC (permalink / raw)
  To: Michal Simek, Saurav Girepunje, gregkh, michal.simek, swboyd,
	linux-usb, linux-arm-kernel, linux-kernel
  Cc: saurav.girepunje


Hi,

Michal Simek <michal.simek@xilinx.com> writes:
>> @@ -1952,9 +1952,9 @@ static void xudc_nonctrl_ep_handler(struct xusb_udc *udc, u8 epnum,
>>  	ep = &udc->ep[epnum];
>>  	/* Process the End point interrupts.*/
>>  	if (intrstatus & (XUSB_STATUS_EP0_BUFF1_COMP_MASK << epnum))
>> -		ep->buffer0ready = 0;
>> +		ep->buffer0ready = false;
>>  	if (intrstatus & (XUSB_STATUS_EP0_BUFF2_COMP_MASK << epnum))
>> -		ep->buffer1ready = 0;
>> +		ep->buffer1ready = false;
>>  
>>  	if (list_empty(&ep->queue))
>>  		return;
>> 
>
> Acked-by: Michal Simek <michal.simek@xilinx.com>

I don't have the original patch, sorry. Care to resend with Acks?

-- 
balbi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-22  6:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191007181527.GA6816@saurav>
2019-10-08  6:34 ` [PATCH] usb: gadget: udc: Fix assignment of 0/1 to bool variables Michal Simek
2019-10-22  6:11   ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).