linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alex,Shi" <alex.shi@intel.com>
To: balbi@ti.com
Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>,
	gregkh@linuxfoundation.org, stern@rowland.harvard.edu,
	linux-usb@vger.kernel.org, andiry.xu@amd.com, clemens@ladisch.de,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] usb: enable pci MSI/MSIX in usb core
Date: Fri, 24 Feb 2012 09:47:08 +0800	[thread overview]
Message-ID: <1330048028.21053.1176.camel@debian> (raw)
In-Reply-To: <20120223124147.GL18463@legolas.emea.dhcp.ti.com>


> > 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 *)’

> > > +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 */
 
 /* 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!


  reply	other threads:[~2012-02-24  1:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20  9:05 [PATCH v2 0/3] enable pci MSI/MSIX in usb core Alex Shi
2012-02-20  9:05 ` [PATCH 1/3] USB: Try MSI first before line IRQ for Intel PCIe USB3 HCD Alex Shi
2012-02-20  9:05   ` [PATCH 2/3] usb: enable pci MSI/MSIX in usb core Alex Shi
2012-02-20  9:05     ` [PATCH 3/3] usb: export usb_hcd_request_irqs Alex Shi
2012-02-23  3:41     ` [PATCH 2/3] usb: enable pci MSI/MSIX in usb core Sarah Sharp
2012-02-23  8:39       ` Alex,Shi
2012-02-23  9:11         ` Alex,Shi
2012-02-23 12:41       ` Felipe Balbi
2012-02-24  1:47         ` Alex,Shi [this message]
2012-02-24 10:00           ` Felipe Balbi
2012-02-24 15:59             ` Alan Stern
2012-02-28  1:43               ` Alex,Shi
2012-02-26 10:16             ` Alex Shi
2012-03-06 17:55   ` [PATCH 1/3] USB: Try MSI first before line IRQ for Intel PCIe USB3 HCD Tom Goetz
     [not found] <1329728040-28664-1-git-send-email-alex.shi@intel.com>
2012-02-20  8:53 ` [PATCH 2/3] usb: enable pci MSI/MSIX in usb core Alex Shi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330048028.21053.1176.camel@debian \
    --to=alex.shi@intel.com \
    --cc=andiry.xu@amd.com \
    --cc=balbi@ti.com \
    --cc=clemens@ladisch.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).