summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2012-01-27 16:19:15 +0200
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2012-03-12 09:31:24 -0700
commit8d3709f3dd41769338cc383bec23673fd1ce34e7 (patch)
tree414259a3c273deaf166cdc2747f1ed8b170821fd /drivers/usb
parentf99298bfa7c42da8d27c2b42050941471c0866ab (diff)
downloadop-kernel-dev-8d3709f3dd41769338cc383bec23673fd1ce34e7.zip
op-kernel-dev-8d3709f3dd41769338cc383bec23673fd1ce34e7.tar.gz
usb: host: xhci: use __ffs() instead of hardcoding shift
__ffs() can tell us which is the SEGMENT_SHIFT value to be used. This will prevent problems when users are too fast and don't pay attention to the need of fixing the Shift after changing TRBS_PER_SEGMENT. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/xhci.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 0f49369..9a7138c 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1223,10 +1223,7 @@ union xhci_trb {
/* Allow two commands + a link TRB, along with any reserved command TRBs */
#define MAX_RSVD_CMD_TRBS (TRBS_PER_SEGMENT - 3)
#define SEGMENT_SIZE (TRBS_PER_SEGMENT*16)
-/* SEGMENT_SHIFT should be log2(SEGMENT_SIZE).
- * Change this if you change TRBS_PER_SEGMENT!
- */
-#define SEGMENT_SHIFT 10
+#define SEGMENT_SHIFT (__ffs(SEGMENT_SIZE))
/* TRB buffer pointers can't cross 64KB boundaries */
#define TRB_MAX_BUFF_SHIFT 16
#define TRB_MAX_BUFF_SIZE (1 << TRB_MAX_BUFF_SHIFT)
OpenPOWER on IntegriCloud