Re: [PATCH 1/7] xHCI: synchronize irq in xhci_suspend()

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

 



On Thu, 23 Dec 2010, Sarah Sharp wrote:

> > Then instead of guessing about whether or not pdev->irq should be the
> > same as hcd->irq, and what it might mean if they are different, just
> > add a new "don't synchronize irqs" flag to the usb_hcd structure.
> 
> Like so?
> 
> diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
> index 3799573..da9d96d 100644
> --- a/drivers/usb/core/hcd-pci.c
> +++ b/drivers/usb/core/hcd-pci.c
> @@ -406,7 +406,12 @@ static int suspend_common(struct device *dev, bool do_wakeup)
>  			return retval;
>  	}
>  
> -	synchronize_irq(pci_dev->irq);
> +	/* If MSI-X is enabled, the driver will have synchronized all vectors in
> +	 * pci_suspend().  If MSI or legacy PCI is enabled, that will be
> +	 * synchronized here.
> +	 */
> +	if (!HCD_MSIX_ENABLED(hcd))
> +		synchronize_irq(pci_dev->irq);

> diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
> index 0b6e751..d9a8983 100644
> --- a/include/linux/usb/hcd.h
> +++ b/include/linux/usb/hcd.h
> @@ -99,6 +99,7 @@ struct usb_hcd {
>  #define HCD_FLAG_POLL_RH		2	/* poll for rh status? */
>  #define HCD_FLAG_POLL_PENDING		3	/* status has changed? */
>  #define HCD_FLAG_WAKEUP_PENDING		4	/* root hub is resuming? */
> +#define HCD_FLAG_MSIX			5	/* driver has MSI-X enabled? */
>  
>  	/* The flags can be tested using these macros; they are likely to
>  	 * be slightly faster than test_bit().
> @@ -108,6 +109,7 @@ struct usb_hcd {
>  #define HCD_POLL_RH(hcd)	((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
>  #define HCD_POLL_PENDING(hcd)	((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
>  #define HCD_WAKEUP_PENDING(hcd)	((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
> +#define HCD_MSIX_ENABLED(hcd)	((hcd)->flags & (1U << HCD_FLAG_MSIX))
>  
>  	/* Flags that get set only during HCD registration or removal. */
>  	unsigned		rh_registered:1;/* is root hub registered? */

Exactly.  Except that since this flag gets set only when the driver is 
probed, you can use a regular bitflag (like rh_registered above) 
instead of an atomic bitflag.  Right?  I assume you don't turn MSI-X 
on and off dynamically while things are running.

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