On Wed, 24 Jun 2009 23:21:04 +0800 Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > On Wed, 24 Jun 2009, Alek Du wrote: > > > David, > > > union ehci_shadow { > > - struct ehci_qh *qh; /* Q_TYPE_QH */ > > + 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 */ > > > +/* get ehci_qh_hw from shadow */ > > +#define SH_HW(x) ((x)->qh_hw) > > +/* get ehci_qh from ehci_shadow */ > > +#define SH_QH(x) (SH_HW(x) ? SH_HW(x)->sw : NULL) > > You really have two choices for the shadow pointers. You can keep the > pointer to the hardware structure (as you did here), or you could store > the pointer to the software structure instead. > > It seems likely that the patch would be simpler if you took the second > choice. (You might even find that you never need to use the > backpointer from ehci_qh_hw to ehci_qh!) Have you considered doing it > this way? 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. The hw_next is the first item for the 4 kinds of descriptors. Alek -- 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