From: Michal Simek <michal.simek@xilinx.com>
To: Saurav Girepunje <saurav.girepunje@gmail.com>,
balbi@kernel.org, gregkh@linuxfoundation.org,
michal.simek@xilinx.com, swboyd@chromium.org,
linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: saurav.girepunje@hotmail.com
Subject: Re: [PATCH] usb: gadget: udc: Fix assignment of 0/1 to bool variables
Date: Tue, 8 Oct 2019 08:34:16 +0200 [thread overview]
Message-ID: <cfb871aa-332c-2256-d194-15f8b87de6f8@xilinx.com> (raw)
In-Reply-To: <20191007181527.GA6816@saurav>
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
next parent reply other threads:[~2019-10-08 6:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191007181527.GA6816@saurav>
2019-10-08 6:34 ` Michal Simek [this message]
2019-10-22 6:11 ` Felipe Balbi
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=cfb871aa-332c-2256-d194-15f8b87de6f8@xilinx.com \
--to=michal.simek@xilinx.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=saurav.girepunje@gmail.com \
--cc=saurav.girepunje@hotmail.com \
--cc=swboyd@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®