Commit 5a6c2f3f authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Sarah Sharp

USB: xhci - fix unsafe macro definitions

Macro arguments used in expressions need to be enclosed in parenthesis
to avoid unpleasant surprises.

This should be queued for kernels back to 2.6.31
Signed-off-by: default avatarDmitry Torokhov <dtor@vmware.com>
Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@kernel.org
parent 2868a2b1
...@@ -232,7 +232,7 @@ struct xhci_op_regs { ...@@ -232,7 +232,7 @@ struct xhci_op_regs {
* notification type that matches a bit set in this bit field. * notification type that matches a bit set in this bit field.
*/ */
#define DEV_NOTE_MASK (0xffff) #define DEV_NOTE_MASK (0xffff)
#define ENABLE_DEV_NOTE(x) (1 << x) #define ENABLE_DEV_NOTE(x) (1 << (x))
/* Most of the device notification types should only be used for debug. /* Most of the device notification types should only be used for debug.
* SW does need to pay attention to function wake notifications. * SW does need to pay attention to function wake notifications.
*/ */
...@@ -601,11 +601,11 @@ struct xhci_ep_ctx { ...@@ -601,11 +601,11 @@ struct xhci_ep_ctx {
#define EP_STATE_STOPPED 3 #define EP_STATE_STOPPED 3
#define EP_STATE_ERROR 4 #define EP_STATE_ERROR 4
/* Mult - Max number of burtst within an interval, in EP companion desc. */ /* Mult - Max number of burtst within an interval, in EP companion desc. */
#define EP_MULT(p) ((p & 0x3) << 8) #define EP_MULT(p) (((p) & 0x3) << 8)
/* bits 10:14 are Max Primary Streams */ /* bits 10:14 are Max Primary Streams */
/* bit 15 is Linear Stream Array */ /* bit 15 is Linear Stream Array */
/* Interval - period between requests to an endpoint - 125u increments. */ /* Interval - period between requests to an endpoint - 125u increments. */
#define EP_INTERVAL(p) ((p & 0xff) << 16) #define EP_INTERVAL(p) (((p) & 0xff) << 16)
#define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff)) #define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff))
#define EP_MAXPSTREAMS_MASK (0x1f << 10) #define EP_MAXPSTREAMS_MASK (0x1f << 10)
#define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK) #define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK)
......
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