lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 24 Feb 2012 12:00:53 +0200
From:	Felipe Balbi <balbi@...com>
To:	"Alex,Shi" <alex.shi@...el.com>
Cc:	balbi@...com, Sarah Sharp <sarah.a.sharp@...ux.intel.com>,
	gregkh@...uxfoundation.org, stern@...land.harvard.edu,
	linux-usb@...r.kernel.org, andiry.xu@....com, clemens@...isch.de,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] usb: enable pci MSI/MSIX in usb core

On Fri, Feb 24, 2012 at 09:47:08AM +0800, Alex,Shi wrote:
> 
> > > Felipe, can you please review this patch for the effects on non-PCI
> > > hosts?  I think nothing will change, since this patchset just modifies
> > > the USB core PCI initialization flow, but I need your eyes on this. :)
> > 
> > Sure thing :-)
> 
> Thanks a lot!
> 
> > > > +/* Check for buggy HCD devices, and driver's expectation for MSI.
> > 
> > please use the preferred multi-line comment style.
> 
> See and thanks!
> 
> > > > +			retval = request_irq(hcd->msix_entries[i].vector,
> > > > +					(irq_handler_t)hcd->driver->msix_irq,
> > 
> > do you really need this cast here ?
> 
> Yes, otherwise the complain like here:
> drivers/usb/core/hcd-pci.c:330: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
> include/linux/interrupt.h:134: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (* const)(int,  struct usb_hcd *)’

Alan, Sarah, is the definition of the IRQ handler wrong on the hc_driver
structure ?

Alex, I think you should fix your definition for the msix_irq handler.

> > > > +int usb_hcd_request_irqs(struct usb_hcd *hcd, unsigned int irqnum,
> > > > +		unsigned long irqflags)
> > > > +{
> > > > +	int retval = 1;
> > > > +
> > > > +#ifdef CONFIG_PCI
> > > > +	retval = usb_hcd_request_msi_msix_irqs(hcd, irqnum, irqflags);
> > > > +#endif
> > 
> > I would like it better if the #ifdef is in the function body, something
> > like:
> > 
> > int usb_hcd_request_msi_msix_irqs(struct hcd *hcd, int irqnum, int irqflags)
> > {
> > #ifdef CONFIG_PCI
> > 	/* blablabla */
> > #else
> > 	return -ENODEV;
> > #endif
> > }
> 
> The function usb_hcd_request_msi_msix_irqs() is defined in hcd-pci.c. If
> you don't like to see '#ifdef CONFIG_PCI' in hcd.c, maybe we can add a
> same name function usb_hcd_request_msi_msix_irqs() in hcd.h for non-pci
> environment.  Is that ok of the following? 
> ------
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index 579cbd3..9bc6568 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -2365,12 +2365,9 @@ static int usb_hcd_request_default_irqs(struct usb_hcd *hcd,
>  int usb_hcd_request_irqs(struct usb_hcd *hcd, unsigned int irqnum,
>                 unsigned long irqflags)
>  {
> -       int retval = 1;
> +       int retval = 0;
>  
> -#ifdef CONFIG_PCI
> -       retval = usb_hcd_request_msi_msix_irqs(hcd, irqnum, irqflags);
> -#endif
> -       if (retval)
> +       if (usb_hcd_request_msi_msix_irqs(hcd, irqnum, irqflags))
>                 retval = usb_hcd_request_default_irqs(hcd, irqnum, irqflags);
>  
>         return retval;
> diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
> index 5253c02..6743ed8 100644
> --- a/include/linux/usb/hcd.h
> +++ b/include/linux/usb/hcd.h
> @@ -413,6 +413,13 @@ extern int usb_hcd_register_msi_msix_irqs(struct usb_hcd *hcd);
>  #ifdef CONFIG_PM_SLEEP
>  extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
>  #endif
> +
> +#else
> +extern int usb_hcd_request_msi_msix_irqs(struct usb_hcd *hcd,
> +               unsigned int irqnum, unsigned long irqflags)
> +{
> +       return -ENODEV;
> +}
>  #endif /* CONFIG_PCI */

sure, makes sense, but that should be static inline I guess.

>  /* pci-ish (pdev null is ok) buffer alloc/mapping support */
> 
> > Yeah, I don't think this will break anything for my non-PCI stuff, but
> > the very fact that usbcore knows so much about PCI is quite a bummer. I
> > think usbcore should know about USB Devices and HCDs, no matter if it's
> > PCI or platform BUS or whatever else, but that's just me and changing
> > that would be quite a big re-work.
> > 
> 
> Thanks again for all comments!

np.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ