提交 8d3709f3 编写于 作者: F Felipe Balbi 提交者: Sarah Sharp

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: NFelipe Balbi <balbi@ti.com>
Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
上级 f99298bf
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册