Re: [PATCH v2] EHCI: split ehci_qh structure into hw and sw parts

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

 



On Wed, 17 Jun 2009, Alek Du wrote:

> On Wed, 17 Jun 2009 22:34:40 +0800
> Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> 
> > On Wed, 17 Jun 2009, Alek Du wrote:
> > 
> > > It is not simple just let ehci_qh contain the soft part, since the ehci_shadow requires
> > > the hardware part to be the first part...
> > > 
> 
> > 
> > I don't see any problem.  Just do this:
> > 
> > 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;
> > };
> > 
> > Alan Stern
> > 
> 
> That won't work, for example, some place use ehci_shadow to access qh software part...
> Please see the q->qh->usecs, after the above change, the ehci_shadow won't contain the software part...
> 
> static unsigned short
> periodic_usecs (struct ehci_hcd *ehci, unsigned frame, unsigned uframe)
> {
>         __hc32                  *hw_p = &ehci->periodic [frame];
>         union ehci_shadow       *q = &ehci->pshadow [frame];
>         unsigned                usecs = 0;
> 
>         while (q->ptr) {
>                 switch (hc32_to_cpu(ehci, Q_NEXT_TYPE(ehci, *hw_p))) {
>                 case Q_TYPE_QH:
>                         /* is it in the S-mask? */
>                         if (q->qh->hw_info2 & cpu_to_hc32(ehci, 1 << uframe))
>                                 usecs += q->qh->usecs;

So change this line to

				usecs += q->qh_hw->sw->usecs;

Isn't that more or less what your ealier patch did anyway?  Although it 
would be better to change the code as follows:

{
	__hc32			*hw_p = &ehci->periodic [frame];
	union ehci_shadow	*q = &ehci->pshadow [frame];
	unsigned		usecs = 0;
	struct ehci_qh		*qh;

	while (q->ptr) {
		switch (hc32_to_cpu(ehci, Q_NEXT_TYPE(ehci, *hw_p))) {
		case Q_TYPE_QH:
			qh = q->qh_hw->sw;
			/* is it in the S-mask? */
			if (q->qh_hw->hw_info2 & cpu_to_hc32(ehci, 1 << uframe))
				usecs += qh->usecs;
			/* ... or C-mask? */
			if (q->qh_hw->hw_info2 & cpu_to_hc32(ehci,
					1 << (8 + uframe)))
				usecs += qh->c_usecs;
			hw_p = &q->qh_hw->hw_next;
			q = &qh->qh_next;
			break;

Alan Stern

--
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