Skip to contentSkip to conversation

USB: drop irq-flags initialisations

PATCH In review Johan Hovold 2 participants 7 messages May 19, 2021 – Jun 3, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover USB: drop irq-flags initialisations

This series drops the remaining redundant irq-flags initialisations from the USB subsystem, which all happened to be in gadget-related code.

Johan

Johan Hovold (3):
USB: cdnsp: drop irq-flags initialisations
USB: dwc2: drop irq-flags initialisations
USB: gadget: drop irq-flags initialisations

 drivers/usb/cdns3/cdnsp-gadget.c      |  4 ++--
 drivers/usb/dwc2/gadget.c             | 12 ++++++------
 drivers/usb/gadget/udc/fsl_udc_core.c |  8 ++++----
 drivers/usb/gadget/udc/mv_u3d_core.c  |  2 +-
 drivers/usb/gadget/udc/mv_udc_core.c  |  2 +-
 5 files changed, 14 insertions(+), 14 deletions(-)
Signature · 1 line
2.26.3
#1 lore raw

PATCH 1/3 USB: cdnsp: drop irq-flags initialisations

There's no need to initialise irq-flags variables before saving the interrupt state.

Cc Pawel Laszczak <[email protected]>
---
 drivers/usb/cdns3/cdnsp-gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/cdns3/cdnsp-gadget.c +2 -2
index 56707b6b0f57..4fddc78f732f 100644
@@ -1151,7 +1151,7 @@ static int cdnsp_gadget_ep_set_halt(struct usb_ep *ep, int value)
 	struct cdnsp_ep *pep = to_cdnsp_ep(ep);
 	struct cdnsp_device *pdev = pep->pdev;
 	struct cdnsp_request *preq;
-	unsigned long flags = 0;
+	unsigned long flags;
 	int ret;
 
 	spin_lock_irqsave(&pdev->lock, flags);
@@ -1176,7 +1176,7 @@ static int cdnsp_gadget_ep_set_wedge(struct usb_ep *ep)
 {
 	struct cdnsp_ep *pep = to_cdnsp_ep(ep);
 	struct cdnsp_device *pdev = pep->pdev;
-	unsigned long flags = 0;
+	unsigned long flags;
 	int ret;
 
 	spin_lock_irqsave(&pdev->lock, flags);
Signature · 1 line
2.26.3
#3 lore raw

PATCH 2/3 USB: dwc2: drop irq-flags initialisations

In reply to Johan Hovold

There's no need to initialise irq-flags variables before saving the interrupt state.

While at it drop two redundant return-value initialisations from two of the functions that got it wrong.

Cc Minas Harutyunyan <[email protected]>
---
 drivers/usb/dwc2/gadget.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/usb/dwc2/gadget.c +6 -6
index 184964174dc0..b16fb3611a86 100644
@@ -1496,8 +1496,8 @@ static int dwc2_hsotg_ep_queue_lock(struct usb_ep *ep, struct usb_request *req,
 {
 	struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
 	struct dwc2_hsotg *hs = hs_ep->parent;
-	unsigned long flags = 0;
-	int ret = 0;
+	unsigned long flags;
+	int ret;
 
 	spin_lock_irqsave(&hs->lock, flags);
 	ret = dwc2_hsotg_ep_queue(ep, req, gfp_flags);
@@ -4374,8 +4374,8 @@ static int dwc2_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value)
 {
 	struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
 	struct dwc2_hsotg *hs = hs_ep->parent;
-	unsigned long flags = 0;
-	int ret = 0;
+	unsigned long flags;
+	int ret;
 
 	spin_lock_irqsave(&hs->lock, flags);
 	ret = dwc2_hsotg_ep_sethalt(ep, value, false);
@@ -4505,7 +4505,7 @@ static int dwc2_hsotg_udc_start(struct usb_gadget *gadget,
 static int dwc2_hsotg_udc_stop(struct usb_gadget *gadget)
 {
 	struct dwc2_hsotg *hsotg = to_hsotg(gadget);
-	unsigned long flags = 0;
+	unsigned long flags;
 	int ep;
 
 	if (!hsotg)
@@ -4577,7 +4577,7 @@ static int dwc2_hsotg_set_selfpowered(struct usb_gadget *gadget,
 static int dwc2_hsotg_pullup(struct usb_gadget *gadget, int is_on)
 {
 	struct dwc2_hsotg *hsotg = to_hsotg(gadget);
-	unsigned long flags = 0;
+	unsigned long flags;
 
 	dev_dbg(hsotg->dev, "%s: is_on: %d op_state: %d\n", __func__, is_on,
 		hsotg->op_state);
Signature · 1 line
2.26.3
#5 lore raw

PATCH 3/3 USB: gadget: drop irq-flags initialisations

In reply to Johan Hovold

There's no need to initialise irq-flags variables before saving the interrupt state.

Drop the redundant initialisations from drivers that got this wrong.

---
 drivers/usb/gadget/udc/fsl_udc_core.c | 8 ++++----
 drivers/usb/gadget/udc/mv_u3d_core.c  | 2 +-
 drivers/usb/gadget/udc/mv_udc_core.c  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/usb/gadget/udc/fsl_udc_core.c +4 -4
index ad6ff9c4188e..2b357b3f64c0 100644
@@ -547,7 +547,7 @@ static int fsl_ep_enable(struct usb_ep *_ep,
 	unsigned short max = 0;
 	unsigned char mult = 0, zlt;
 	int retval = -EINVAL;
-	unsigned long flags = 0;
+	unsigned long flags;
 
 	ep = container_of(_ep, struct fsl_ep, ep);
 
@@ -631,7 +631,7 @@ static int fsl_ep_disable(struct usb_ep *_ep)
 {
 	struct fsl_udc *udc = NULL;
 	struct fsl_ep *ep = NULL;
-	unsigned long flags = 0;
+	unsigned long flags;
 	u32 epctrl;
 	int ep_num;
 
@@ -1001,7 +1001,7 @@ out:	epctrl = fsl_readl(&dr_regs->endptctrl[ep_num]);
 static int fsl_ep_set_halt(struct usb_ep *_ep, int value)
 {
 	struct fsl_ep *ep = NULL;
-	unsigned long flags = 0;
+	unsigned long flags;
 	int status = -EOPNOTSUPP;	/* operation not supported */
 	unsigned char ep_dir = 0, ep_num = 0;
 	struct fsl_udc *udc = NULL;
@@ -1938,7 +1938,7 @@ static int fsl_udc_start(struct usb_gadget *g,
 		struct usb_gadget_driver *driver)
 {
 	int retval = 0;
-	unsigned long flags = 0;
+	unsigned long flags;
 
 	/* lock is needed but whether should use this lock or another */
 	spin_lock_irqsave(&udc_controller->lock, flags);
drivers/usb/gadget/udc/mv_u3d_core.c +1 -1
index 5486f5a70868..ce3d7a3eb7e3 100644
@@ -941,7 +941,7 @@ mv_u3d_ep_set_stall(struct mv_u3d *u3d, u8 ep_num, u8 direction, int stall)
 static int mv_u3d_ep_set_halt_wedge(struct usb_ep *_ep, int halt, int wedge)
 {
 	struct mv_u3d_ep *ep;
-	unsigned long flags = 0;
+	unsigned long flags;
 	int status = 0;
 	struct mv_u3d *u3d;
 
drivers/usb/gadget/udc/mv_udc_core.c +1 -1
index 0fb4ef464321..7f24ce400b59 100644
@@ -888,7 +888,7 @@ static int ep_is_stall(struct mv_udc *udc, u8 ep_num, u8 direction)
 static int mv_ep_set_halt_wedge(struct usb_ep *_ep, int halt, int wedge)
 {
 	struct mv_ep *ep;
-	unsigned long flags = 0;
+	unsigned long flags;
 	int status = 0;
 	struct mv_udc *udc;
 
Signature · 1 line
2.26.3