Commit a0ef2bdf authored by Corentin Labbe's avatar Corentin Labbe Committed by Greg Kroah-Hartman

usb: host: Replace empty define with do while

It's dangerous to use empty code define.
Furthermore it lead to the following warning:
"suggest braces around empty body in an « else » statement"

So let's replace emptyness by "do {} while(0)"

Furthermore, as suggested by Joe Perches, rename the macro to INCR.
Signed-off-by: default avatarCorentin Labbe <clabbe@baylibre.com>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1906f64f
...@@ -730,9 +730,9 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) ...@@ -730,9 +730,9 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
/* normal [4.15.1.2] or error [4.15.1.1] completion */ /* normal [4.15.1.2] or error [4.15.1.1] completion */
if (likely ((status & (STS_INT|STS_ERR)) != 0)) { if (likely ((status & (STS_INT|STS_ERR)) != 0)) {
if (likely ((status & STS_ERR) == 0)) if (likely ((status & STS_ERR) == 0))
COUNT (ehci->stats.normal); INCR(ehci->stats.normal);
else else
COUNT (ehci->stats.error); INCR(ehci->stats.error);
bh = 1; bh = 1;
} }
...@@ -756,7 +756,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) ...@@ -756,7 +756,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
if (cmd & CMD_IAAD) if (cmd & CMD_IAAD)
ehci_dbg(ehci, "IAA with IAAD still set?\n"); ehci_dbg(ehci, "IAA with IAAD still set?\n");
if (ehci->iaa_in_progress) if (ehci->iaa_in_progress)
COUNT(ehci->stats.iaa); INCR(ehci->stats.iaa);
end_iaa_cycle(ehci); end_iaa_cycle(ehci);
} }
......
...@@ -245,12 +245,12 @@ ehci_urb_done(struct ehci_hcd *ehci, struct urb *urb, int status) ...@@ -245,12 +245,12 @@ ehci_urb_done(struct ehci_hcd *ehci, struct urb *urb, int status)
} }
if (unlikely(urb->unlinked)) { if (unlikely(urb->unlinked)) {
COUNT(ehci->stats.unlink); INCR(ehci->stats.unlink);
} else { } else {
/* report non-error and short read status as zero */ /* report non-error and short read status as zero */
if (status == -EINPROGRESS || status == -EREMOTEIO) if (status == -EINPROGRESS || status == -EREMOTEIO)
status = 0; status = 0;
COUNT(ehci->stats.complete); INCR(ehci->stats.complete);
} }
#ifdef EHCI_URB_TRACE #ifdef EHCI_URB_TRACE
......
...@@ -347,7 +347,7 @@ static void ehci_iaa_watchdog(struct ehci_hcd *ehci) ...@@ -347,7 +347,7 @@ static void ehci_iaa_watchdog(struct ehci_hcd *ehci)
*/ */
status = ehci_readl(ehci, &ehci->regs->status); status = ehci_readl(ehci, &ehci->regs->status);
if ((status & STS_IAA) || !(cmd & CMD_IAAD)) { if ((status & STS_IAA) || !(cmd & CMD_IAAD)) {
COUNT(ehci->stats.lost_iaa); INCR(ehci->stats.lost_iaa);
ehci_writel(ehci, STS_IAA, &ehci->regs->status); ehci_writel(ehci, STS_IAA, &ehci->regs->status);
} }
......
...@@ -235,9 +235,9 @@ struct ehci_hcd { /* one per controller */ ...@@ -235,9 +235,9 @@ struct ehci_hcd { /* one per controller */
/* irq statistics */ /* irq statistics */
#ifdef EHCI_STATS #ifdef EHCI_STATS
struct ehci_stats stats; struct ehci_stats stats;
# define COUNT(x) ((x)++) # define INCR(x) ((x)++)
#else #else
# define COUNT(x) # define INCR(x) do {} while (0)
#endif #endif
/* debug files */ /* debug files */
......
...@@ -1286,7 +1286,7 @@ static void fotg210_iaa_watchdog(struct fotg210_hcd *fotg210) ...@@ -1286,7 +1286,7 @@ static void fotg210_iaa_watchdog(struct fotg210_hcd *fotg210)
*/ */
status = fotg210_readl(fotg210, &fotg210->regs->status); status = fotg210_readl(fotg210, &fotg210->regs->status);
if ((status & STS_IAA) || !(cmd & CMD_IAAD)) { if ((status & STS_IAA) || !(cmd & CMD_IAAD)) {
COUNT(fotg210->stats.lost_iaa); INCR(fotg210->stats.lost_iaa);
fotg210_writel(fotg210, STS_IAA, fotg210_writel(fotg210, STS_IAA,
&fotg210->regs->status); &fotg210->regs->status);
} }
...@@ -2205,12 +2205,12 @@ __acquires(fotg210->lock) ...@@ -2205,12 +2205,12 @@ __acquires(fotg210->lock)
} }
if (unlikely(urb->unlinked)) { if (unlikely(urb->unlinked)) {
COUNT(fotg210->stats.unlink); INCR(fotg210->stats.unlink);
} else { } else {
/* report non-error and short read status as zero */ /* report non-error and short read status as zero */
if (status == -EINPROGRESS || status == -EREMOTEIO) if (status == -EINPROGRESS || status == -EREMOTEIO)
status = 0; status = 0;
COUNT(fotg210->stats.complete); INCR(fotg210->stats.complete);
} }
#ifdef FOTG210_URB_TRACE #ifdef FOTG210_URB_TRACE
...@@ -5154,9 +5154,9 @@ static irqreturn_t fotg210_irq(struct usb_hcd *hcd) ...@@ -5154,9 +5154,9 @@ static irqreturn_t fotg210_irq(struct usb_hcd *hcd)
/* normal [4.15.1.2] or error [4.15.1.1] completion */ /* normal [4.15.1.2] or error [4.15.1.1] completion */
if (likely((status & (STS_INT|STS_ERR)) != 0)) { if (likely((status & (STS_INT|STS_ERR)) != 0)) {
if (likely((status & STS_ERR) == 0)) if (likely((status & STS_ERR) == 0))
COUNT(fotg210->stats.normal); INCR(fotg210->stats.normal);
else else
COUNT(fotg210->stats.error); INCR(fotg210->stats.error);
bh = 1; bh = 1;
} }
...@@ -5181,7 +5181,7 @@ static irqreturn_t fotg210_irq(struct usb_hcd *hcd) ...@@ -5181,7 +5181,7 @@ static irqreturn_t fotg210_irq(struct usb_hcd *hcd)
if (cmd & CMD_IAAD) if (cmd & CMD_IAAD)
fotg210_dbg(fotg210, "IAA with IAAD still set?\n"); fotg210_dbg(fotg210, "IAA with IAAD still set?\n");
if (fotg210->async_iaa) { if (fotg210->async_iaa) {
COUNT(fotg210->stats.iaa); INCR(fotg210->stats.iaa);
end_unlink_async(fotg210); end_unlink_async(fotg210);
} else } else
fotg210_dbg(fotg210, "IAA with nothing unlinked?\n"); fotg210_dbg(fotg210, "IAA with nothing unlinked?\n");
......
...@@ -177,9 +177,9 @@ struct fotg210_hcd { /* one per controller */ ...@@ -177,9 +177,9 @@ struct fotg210_hcd { /* one per controller */
/* irq statistics */ /* irq statistics */
#ifdef FOTG210_STATS #ifdef FOTG210_STATS
struct fotg210_stats stats; struct fotg210_stats stats;
# define COUNT(x) ((x)++) # define INCR(x) ((x)++)
#else #else
# define COUNT(x) # define INCR(x) do {} while (0)
#endif #endif
/* silicon clock */ /* silicon clock */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment