2021-05-19 19:25:28

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 0/3] 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(-)

--
2.26.3



2021-05-19 19:25:29

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 2/3] USB: dwc2: drop irq-flags initialisations

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]>
Signed-off-by: Johan Hovold <[email protected]>
---
drivers/usb/dwc2/gadget.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 184964174dc0..b16fb3611a86 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -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);
--
2.26.3


2021-05-19 19:26:01

by Johan Hovold

[permalink] [raw]
Subject: [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]>
Signed-off-by: Johan Hovold <[email protected]>
---
drivers/usb/cdns3/cdnsp-gadget.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c
index 56707b6b0f57..4fddc78f732f 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.c
+++ b/drivers/usb/cdns3/cdnsp-gadget.c
@@ -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);
--
2.26.3


2021-05-19 19:28:10

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 3/3] USB: gadget: drop irq-flags initialisations

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

Drop the redundant initialisations from drivers that got this wrong.

Cc: Li Yang <[email protected]>
Cc: Felipe Balbi <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
---
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(-)

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index ad6ff9c4188e..2b357b3f64c0 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -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);
diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c
index 5486f5a70868..ce3d7a3eb7e3 100644
--- a/drivers/usb/gadget/udc/mv_u3d_core.c
+++ b/drivers/usb/gadget/udc/mv_u3d_core.c
@@ -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;

diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c
index 0fb4ef464321..7f24ce400b59 100644
--- a/drivers/usb/gadget/udc/mv_udc_core.c
+++ b/drivers/usb/gadget/udc/mv_udc_core.c
@@ -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;

--
2.26.3


2021-06-03 06:19:55

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH 1/3] USB: cdnsp: drop irq-flags initialisations


Hi,

Johan Hovold <[email protected]> writes:
> There's no need to initialise irq-flags variables before saving the
> interrupt state.
>
> Cc: Pawel Laszczak <[email protected]>
> Signed-off-by: Johan Hovold <[email protected]>

Acked-by: Felipe Balbi <[email protected]>

--
balbi


Attachments:
signature.asc (521.00 B)

2021-06-03 06:22:33

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH 3/3] USB: gadget: drop irq-flags initialisations

Johan Hovold <[email protected]> writes:

> There's no need to initialise irq-flags variables before saving the
> interrupt state.
>
> Drop the redundant initialisations from drivers that got this wrong.
>
> Cc: Li Yang <[email protected]>
> Cc: Felipe Balbi <[email protected]>
> Signed-off-by: Johan Hovold <[email protected]>

Acked-by: Felipe Balbi <[email protected]>

--
balbi


Attachments:
signature.asc (521.00 B)

2021-06-03 06:22:38

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH 2/3] USB: dwc2: drop irq-flags initialisations

Johan Hovold <[email protected]> writes:

> 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]>
> Signed-off-by: Johan Hovold <[email protected]>

Acked-by: Felipe Balbi <[email protected]>

--
balbi


Attachments:
signature.asc (521.00 B)