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 Wed, 24 Jun 2009, Alek Du wrote:

> David,
> 
> Polished and tested the following patches. Use some macro like HW, QH
> for hw/sw/shadow conversion, hope you like this style ...
> 
> Alek

> 
> From b01d4f48a57060b1c4b971a8a8b5f2da304237ad Mon Sep 17 00:00:00 2001
> From: Alek Du <alek.du@xxxxxxxxx>
> Date: Wed, 24 Jun 2009 18:52:09 +0800
> Subject: [PATCH] EHCI: split ehci_qh - header file changes
> 
> Modified ehci.h, add ehci_qh_hw to hold hw part, also prepared some macros
> for sw/hw/shadow conversion.

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

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