Re: [PATCH] usb: dwc3: convert TRBs into bitshifts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Feb 06, 2012 at 01:42:48PM +0100, Sebastian Andrzej Siewior wrote:
> * Felipe Balbi | 2012-02-06 13:02:01 [+0200]:
> 
> >diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> >index 71d958a..a0806e3 100644
> >--- a/drivers/usb/dwc3/core.h
> >+++ b/drivers/usb/dwc3/core.h
> >-struct dwc3_trb_hw {
> >-	__le32		bpl;
> >-	__le32		bph;
> >-	__le32		size;
> >-	__le32		ctrl;
> >+struct dwc3_trb {
> >+	u32		bpl;
> >+	u32		bph;
> >+	u32		size;
> >+	u32		ctrl;
> > } __packed;
> > 
> >-static inline void dwc3_trb_to_hw(struct dwc3_trb *nat, struct dwc3_trb_hw *hw)
> >-{
> >-	hw->bpl = cpu_to_le32(lower_32_bits(nat->bplh));
> >-	hw->bph = cpu_to_le32(upper_32_bits(nat->bplh));
> >-	hw->size = cpu_to_le32p(&nat->len_pcm);
> >-	/* HWO is written last */
> >-	hw->ctrl = cpu_to_le32p(&nat->control);
> >-}
> >-
> >-static inline void dwc3_trb_to_nat(struct dwc3_trb_hw *hw, struct dwc3_trb *nat)
> >-{
> >-	u64 bplh;
> >-
> >-	bplh = le32_to_cpup(&hw->bpl);
> >-	bplh |= (u64) le32_to_cpup(&hw->bph) << 32;
> >-	nat->bplh = bplh;
> >-
> >-	nat->len_pcm = le32_to_cpup(&hw->size);
> >-	nat->control = le32_to_cpup(&hw->ctrl);
> >-}
> 
> you getting rid of the __lew32 in the trb_hw structure together convert
> function here as well and I don't see a replacement. I haven't looked at

there's no need for a replacement anymore. There's only dwc3_trb_hw
(which I renamed to dwc3_trb).

> it in detail but does dwc3_trb point directly into memory which accessed
> by dwc3? If so it has to be __l32 and not u32 and you have to use proper
> le32_to_cpu() macros and those for the other way around.

Is it really needed now that I'm using play bitshifts ? The IP will be
running at the same endianness as the cpu, no ?

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux