[PATCH] drivers: usb: musb: musb_gadget: fixed coding style issues and removed unneeded code

From: Neel Chakraborty
Date: Tue Jun 06 2023 - 02:59:41 EST


Fixed a few coding style issues
Removed the static int musb_gadget_vbus_session function as it was
doing nothing.

Signed-off-by: Neel Chakraborty <neelchakrabortykernelwork@xxxxxxxxx>
---
drivers/usb/musb/musb_gadget.c | 38 +++++++++++-----------------------
1 file changed, 12 insertions(+), 26 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 31c44325e828..ac5f9d325f71 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -521,7 +521,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
struct usb_request *request = &req->request;
struct musb_ep *musb_ep;
void __iomem *epio = musb->endpoints[epnum].regs;
- unsigned len = 0;
+ unsigned int len = 0;
u16 fifo_count;
u16 csr = musb_readw(epio, MUSB_RXCSR);
struct musb_hw_ep *hw_ep = &musb->endpoints[epnum];
@@ -657,7 +657,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
musb_writew(epio, MUSB_RXCSR, csr);

transfer_size = min(request->length - request->actual,
- (unsigned)fifo_count);
+ (unsigned int)fifo_count);
musb_ep->dma->desired_mode = 0;
}

@@ -695,7 +695,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
transfer_size = min_t(unsigned int,
request->length -
request->actual,
- (unsigned)fifo_count);
+ (unsigned int)fifo_count);

csr &= ~MUSB_RXCSR_DMAMODE;
csr |= (MUSB_RXCSR_DMAENAB |
@@ -728,7 +728,7 @@ static void rxstate(struct musb *musb, struct musb_request *req)
fifo_count, len,
musb_ep->packet_sz);

- fifo_count = min_t(unsigned, len, fifo_count);
+ fifo_count = min_t(unsigned int, len, fifo_count);

if (tusb_dma_omap(musb)) {
struct dma_controller *c = musb->dma_controller;
@@ -870,9 +870,8 @@ void musb_g_rx(struct musb *musb, u8 epnum)
if ((request->actual < request->length)
&& (musb_ep->dma->actual_len
== musb_ep->packet_sz)) {
- /* In double buffer case, continue to unload fifo if
- * there is Rx packet in FIFO.
- **/
+ // In double buffer case, continue to unload fifo if
+ // there is Rx packet in FIFO.
csr = musb_readw(epio, MUSB_RXCSR);
if ((csr & MUSB_RXCSR_RXPKTRDY) &&
hw_ep->rx_double_buffered)
@@ -916,7 +915,7 @@ static int musb_gadget_enable(struct usb_ep *ep,
void __iomem *mbase;
u8 epnum;
u16 csr;
- unsigned tmp;
+ unsigned int tmp;
int status = -EINVAL;

if (!ep || !desc)
@@ -1132,7 +1131,7 @@ struct usb_request *musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
struct musb_ep *musb_ep = to_musb_ep(ep);
struct musb_request *request = NULL;

- request = kzalloc(sizeof *request, gfp_flags);
+ request = kzalloc(sizeof(*request), gfp_flags);
if (!request)
return NULL;

@@ -1161,7 +1160,7 @@ static LIST_HEAD(buffers);
struct free_record {
struct list_head list;
struct device *dev;
- unsigned bytes;
+ unsigned int bytes;
dma_addr_t dma;
};

@@ -1343,7 +1342,7 @@ static int musb_gadget_set_halt(struct usb_ep *ep, int value)

spin_lock_irqsave(&musb->lock, flags);

- if ((USB_ENDPOINT_XFER_ISOC == musb_ep->type)) {
+ if (USB_ENDPOINT_XFER_ISOC == musb_ep->type) {
status = -EINVAL;
goto done;
}
@@ -1612,21 +1611,8 @@ static void musb_pullup(struct musb *musb, int is_on)
musb_writeb(musb->mregs, MUSB_POWER, power);
}

-#if 0
-static int musb_gadget_vbus_session(struct usb_gadget *gadget, int is_active)
-{
- musb_dbg(musb, "<= %s =>\n", __func__);
-
- /*
- * FIXME iff driver's softconnect flag is set (as it is during probe,
- * though that can clear it), just musb_pullup().
- */
-
- return -EINVAL;
-}
-#endif

-static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
+static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned int mA)
{
struct musb *musb = gadget_to_musb(gadget);

@@ -1744,7 +1730,7 @@ static inline void musb_g_init_endpoints(struct musb *musb)
{
u8 epnum;
struct musb_hw_ep *hw_ep;
- unsigned count = 0;
+ unsigned int count = 0;

/* initialize endpoint list just once */
INIT_LIST_HEAD(&(musb->g.ep_list));
--
2.40.1