diff mbox series

[RESEND,v2,05/11] usb: xhci: convert to TRB_TYPE()

Message ID 1598434161-10272-5-git-send-email-chunfeng.yun@mediatek.com
State Superseded
Delegated to: Marek Vasut
Headers show
Series [RESEND,v2,01/11] usb: xhci: add a member hci_version in xhci_ctrl struct | expand

Commit Message

Chunfeng Yun (云春峰) Aug. 26, 2020, 9:29 a.m. UTC
Use TRB_TYPE(p) instead of ((p) << TRB_TYPE_SHIFT)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: no changes
---
 drivers/usb/host/xhci-mem.c  |  3 +--
 drivers/usb/host/xhci-ring.c | 11 +++++------
 include/usb/xhci.h           |  1 -
 3 files changed, 6 insertions(+), 9 deletions(-)

Comments

Bin Meng Sept. 4, 2020, 6:54 a.m. UTC | #1
On Wed, Aug 26, 2020 at 5:31 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
>
> Use TRB_TYPE(p) instead of ((p) << TRB_TYPE_SHIFT)
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> v2: no changes
> ---
>  drivers/usb/host/xhci-mem.c  |  3 +--
>  drivers/usb/host/xhci-ring.c | 11 +++++------
>  include/usb/xhci.h           |  1 -
>  3 files changed, 6 insertions(+), 9 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Marek Vasut Sept. 4, 2020, 7:05 a.m. UTC | #2
On 9/4/20 8:54 AM, Bin Meng wrote:
> On Wed, Aug 26, 2020 at 5:31 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
>>
>> Use TRB_TYPE(p) instead of ((p) << TRB_TYPE_SHIFT)
>>
>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
>> ---
>> v2: no changes
>> ---
>>  drivers/usb/host/xhci-mem.c  |  3 +--
>>  drivers/usb/host/xhci-ring.c | 11 +++++------
>>  include/usb/xhci.h           |  1 -
>>  3 files changed, 6 insertions(+), 9 deletions(-)
>>
> 
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Can we please collect the RBs in one posting of the series, not two
postings ?

Thank you
Bin Meng Sept. 4, 2020, 7:19 a.m. UTC | #3
Hi Marek,

On Fri, Sep 4, 2020 at 3:05 PM Marek Vasut <marex@denx.de> wrote:
>
> On 9/4/20 8:54 AM, Bin Meng wrote:
> > On Wed, Aug 26, 2020 at 5:31 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
> >>
> >> Use TRB_TYPE(p) instead of ((p) << TRB_TYPE_SHIFT)
> >>
> >> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> >> ---
> >> v2: no changes
> >> ---
> >>  drivers/usb/host/xhci-mem.c  |  3 +--
> >>  drivers/usb/host/xhci-ring.c | 11 +++++------
> >>  include/usb/xhci.h           |  1 -
> >>  3 files changed, 6 insertions(+), 9 deletions(-)
> >>
> >
> > Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
>
> Can we please collect the RBs in one posting of the series, not two
> postings ?
>

Oops, it looks I replied the old version. Sorry. I will use the latest version.

Regards,
Bin
Chunfeng Yun (云春峰) Sept. 4, 2020, 7:46 a.m. UTC | #4
On Fri, 2020-09-04 at 09:05 +0200, Marek Vasut wrote:
> On 9/4/20 8:54 AM, Bin Meng wrote:
> > On Wed, Aug 26, 2020 at 5:31 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
> >>
> >> Use TRB_TYPE(p) instead of ((p) << TRB_TYPE_SHIFT)
> >>
> >> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> >> ---
> >> v2: no changes
> >> ---
> >>  drivers/usb/host/xhci-mem.c  |  3 +--
> >>  drivers/usb/host/xhci-ring.c | 11 +++++------
> >>  include/usb/xhci.h           |  1 -
> >>  3 files changed, 6 insertions(+), 9 deletions(-)
> >>
> > 
> > Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> 
> Can we please collect the RBs in one posting of the series, not two
> postings ?
You mean merge [05/11, 06/11, 07/11, 08/11] into one patch?

> 
> Thank you
Chunfeng Yun (云春峰) Sept. 7, 2020, 7:18 a.m. UTC | #5
Hi Bin,

On Fri, 2020-09-04 at 15:19 +0800, Bin Meng wrote:
> Hi Marek,
> 
> On Fri, Sep 4, 2020 at 3:05 PM Marek Vasut <marex@denx.de> wrote:
> >
> > On 9/4/20 8:54 AM, Bin Meng wrote:
> > > On Wed, Aug 26, 2020 at 5:31 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
> > >>
> > >> Use TRB_TYPE(p) instead of ((p) << TRB_TYPE_SHIFT)
> > >>
> > >> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > >> ---
> > >> v2: no changes
> > >> ---
> > >>  drivers/usb/host/xhci-mem.c  |  3 +--
> > >>  drivers/usb/host/xhci-ring.c | 11 +++++------
> > >>  include/usb/xhci.h           |  1 -
> > >>  3 files changed, 6 insertions(+), 9 deletions(-)
> > >>
> > >
> > > Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> >
> > Can we please collect the RBs in one posting of the series, not two
> > postings ?
> >
> 
> Oops, it looks I replied the old version. Sorry. I will use the latest version.
Due to Frank and I both resend v2, this may cause some confusion, so I
send out v3, and just merge some patch that you don't review, please
look at it. Thanks a lot

> 
> Regards,
> Bin
Bin Meng Sept. 7, 2020, 10:12 a.m. UTC | #6
Hi Chunfeng,

On Mon, Sep 7, 2020 at 3:20 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
>
> Hi Bin,
>
> On Fri, 2020-09-04 at 15:19 +0800, Bin Meng wrote:
> > Hi Marek,
> >
> > On Fri, Sep 4, 2020 at 3:05 PM Marek Vasut <marex@denx.de> wrote:
> > >
> > > On 9/4/20 8:54 AM, Bin Meng wrote:
> > > > On Wed, Aug 26, 2020 at 5:31 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
> > > >>
> > > >> Use TRB_TYPE(p) instead of ((p) << TRB_TYPE_SHIFT)
> > > >>
> > > >> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > >> ---
> > > >> v2: no changes
> > > >> ---
> > > >>  drivers/usb/host/xhci-mem.c  |  3 +--
> > > >>  drivers/usb/host/xhci-ring.c | 11 +++++------
> > > >>  include/usb/xhci.h           |  1 -
> > > >>  3 files changed, 6 insertions(+), 9 deletions(-)
> > > >>
> > > >
> > > > Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> > >
> > > Can we please collect the RBs in one posting of the series, not two
> > > postings ?
> > >
> >
> > Oops, it looks I replied the old version. Sorry. I will use the latest version.
> Due to Frank and I both resend v2, this may cause some confusion, so I
> send out v3, and just merge some patch that you don't review, please
> look at it. Thanks a lot

Yes, I will take a look at the latest one.

Regards,
Bin
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 1da0524..d627aa5 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -236,8 +236,7 @@  static void xhci_link_segments(struct xhci_segment *prev,
 		 */
 		val = le32_to_cpu(prev->trbs[TRBS_PER_SEGMENT-1].link.control);
 		val &= ~TRB_TYPE_BITMASK;
-		val |= (TRB_LINK << TRB_TYPE_SHIFT);
-
+		val |= TRB_TYPE(TRB_LINK);
 		prev->trbs[TRBS_PER_SEGMENT-1].link.control = cpu_to_le32(val);
 	}
 }
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index cf8b9d2..87891fd 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -696,7 +696,7 @@  int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
 		trb_fields[0] = lower_32_bits(addr);
 		trb_fields[1] = upper_32_bits(addr);
 		trb_fields[2] = length_field;
-		trb_fields[3] = field | (TRB_NORMAL << TRB_TYPE_SHIFT);
+		trb_fields[3] = field | TRB_TYPE(TRB_NORMAL);
 
 		queue_trb(ctrl, ring, (num_trbs > 1), trb_fields);
 
@@ -823,7 +823,7 @@  int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
 	/* Queue setup TRB - see section 6.4.1.2.1 */
 	/* FIXME better way to translate setup_packet into two u32 fields? */
 	field = 0;
-	field |= TRB_IDT | (TRB_SETUP << TRB_TYPE_SHIFT);
+	field |= TRB_IDT | TRB_TYPE(TRB_SETUP);
 	if (start_cycle == 0)
 		field |= 0x1;
 
@@ -860,9 +860,9 @@  int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
 	/* If there's data, queue data TRBs */
 	/* Only set interrupt on short packet for IN endpoints */
 	if (usb_pipein(pipe))
-		field = TRB_ISP | (TRB_DATA << TRB_TYPE_SHIFT);
+		field = TRB_ISP | TRB_TYPE(TRB_DATA);
 	else
-		field = (TRB_DATA << TRB_TYPE_SHIFT);
+		field = TRB_TYPE(TRB_DATA);
 
 	remainder = xhci_td_remainder(ctrl, 0, length, length,
 				      usb_maxpacket(udev, pipe), 1);
@@ -904,8 +904,7 @@  int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
 	trb_fields[2] = ((0 & TRB_INTR_TARGET_MASK) << TRB_INTR_TARGET_SHIFT);
 		/* Event on completion */
 	trb_fields[3] = field | TRB_IOC |
-			(TRB_STATUS << TRB_TYPE_SHIFT) |
-			ep_ring->cycle_state;
+			TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state;
 
 	queue_trb(ctrl, ep_ring, false, trb_fields);
 
diff --git a/include/usb/xhci.h b/include/usb/xhci.h
index cf4c020..bdba51d 100644
--- a/include/usb/xhci.h
+++ b/include/usb/xhci.h
@@ -903,7 +903,6 @@  union xhci_trb {
 /* TRB bit mask */
 #define	TRB_TYPE_BITMASK	(0xfc00)
 #define TRB_TYPE(p)		((p) << 10)
-#define TRB_TYPE_SHIFT		(10)
 #define TRB_FIELD_TO_TYPE(p)	(((p) & TRB_TYPE_BITMASK) >> 10)
 
 /* TRB type IDs */