Re: [PATCH 1/4 v3] EHCI: split ehci_qh - header file changes

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

 



On Thu, 25 Jun 2009 00:26:54 +0800
Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:

> On Wed, 24 Jun 2009, Alek Du wrote:
> > 
> > No, Alan,
> > 
> > union ehci_shadow {
> >         struct ehci_qh_hw       *qh_hw;         /* Q_TYPE_QH */
> >         struct ehci_itd         *itd;           /* Q_TYPE_ITD */
> >         struct ehci_sitd        *sitd;          /* Q_TYPE_SITD */
> >         struct ehci_fstn        *fstn;          /* Q_TYPE_FSTN */
> >         __hc32                  *hw_next;       /* (all types) */
> >         void                    *ptr;
> > };
> > 
> > the *hw_next requires all hardware structure here. There a lot codes that compare this with hw_next in HCD.
> 
> Can you give any examples where this would matter?
> 
> > The hw_next is the first item for the 4 kinds of descriptors.
> 
> I know.  That doesn't mean the shadow pointer has to point to the 
> hw_next field when it points to a QH.
> 

Here is the example, the here.hw_next must be a __hc32 in EHCI HW periodic list.

static void periodic_unlink (struct ehci_hcd *ehci, unsigned frame, void *ptr)
{
        union ehci_shadow       *prev_p = &ehci->pshadow[frame];
        __hc32                  *hw_p = &ehci->periodic[frame];
        union ehci_shadow       here = *prev_p;

        /* find predecessor of "ptr"; hw and shadow lists are in sync */
        while (here.ptr && here.ptr != ptr) {
                prev_p = periodic_next_shadow(ehci, prev_p,
                                Q_NEXT_TYPE(ehci, *hw_p));
                hw_p = here.hw_next;
                here = *prev_p;
        }

static union ehci_shadow *
periodic_next_shadow(struct ehci_hcd *ehci, union ehci_shadow *periodic,
                __hc32 tag)
{
        switch (hc32_to_cpu(ehci, tag)) {
        case Q_TYPE_QH:
                return &periodic->qh->qh_next;
        case Q_TYPE_FSTN:
                return &periodic->fstn->fstn_next;
        case Q_TYPE_ITD:
                return &periodic->itd->itd_next;
        // case Q_TYPE_SITD:
        default:
                return &periodic->sitd->sitd_next;
        }
}



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

  Powered by Linux