usb: core: hcd: make hcd->irq unsigned
authorFelipe Balbi <balbi@ti.com>
Wed, 29 Feb 2012 14:46:23 +0000 (16:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Mar 2012 17:31:22 +0000 (09:31 -0800)
There's really no point in having hcd->irq as a
signed integer when we consider the fact that
IRQ 0 means NO_IRQ. In order to avoid confusion,
make hcd->irq unsigned and fix users who were
passing -1 as the IRQ number to usb_add_hcd.

Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hcd.c
drivers/usb/host/ohci-hcd.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.c
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_gadget.c
include/linux/usb/hcd.h

index e1282328fc27f1ef17228ff4ad57747c79e2c927..9d7fc9a399338854426bb2a23c6990e4077b3525 100644 (file)
@@ -2352,7 +2352,7 @@ static int usb_hcd_request_irqs(struct usb_hcd *hcd,
                                        "io mem" : "io base",
                                        (unsigned long long)hcd->rsrc_start);
        } else {
-               hcd->irq = -1;
+               hcd->irq = 0;
                if (hcd->rsrc_start)
                        dev_info(hcd->self.controller, "%s 0x%08llx\n",
                                        (hcd->driver->flags & HCD_MEMORY) ?
@@ -2508,7 +2508,7 @@ err_register_root_hub:
        clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
        del_timer_sync(&hcd->rh_timer);
 err_hcd_driver_start:
-       if (usb_hcd_is_primary_hcd(hcd) && hcd->irq >= 0)
+       if (usb_hcd_is_primary_hcd(hcd) && hcd->irq > 0)
                free_irq(irqnum, hcd);
 err_request_irq:
 err_hcd_driver_setup:
@@ -2573,7 +2573,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
        del_timer_sync(&hcd->rh_timer);
 
        if (usb_hcd_is_primary_hcd(hcd)) {
-               if (hcd->irq >= 0)
+               if (hcd->irq > 0)
                        free_irq(hcd->irq, hcd);
        }
 
index 34b9edd866513fe93577444cc82e9327d33e0b06..831fa40c609af6d092f517015985ac5954027671 100644 (file)
@@ -899,7 +899,7 @@ static void ohci_stop (struct usb_hcd *hcd)
        ohci_usb_reset (ohci);
        ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
        free_irq(hcd->irq, hcd);
-       hcd->irq = -1;
+       hcd->irq = 0;
 
        if (quirk_zfmicro(ohci))
                del_timer(&ohci->unlink_watchdog);
index 3a033240ec64625f81ecc422d5e7a6b3afe9ea37..9e71f7c46a85d54bcbd564f5cdff1fb3dba80afc 100644 (file)
@@ -2396,7 +2396,7 @@ hw_died:
        /* FIXME when MSI-X is supported and there are multiple vectors */
        /* Clear the MSI-X event interrupt status */
 
-       if (hcd->irq != -1) {
+       if (hcd->irq) {
                u32 irq_pending;
                /* Acknowledge the PCI interrupt */
                irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending);
index c939f5fdef9e2414f61f63cd07776041d5411cf9..a629ad860329f19b3d1f7e8ca8777e034c6942bb 100644 (file)
@@ -224,13 +224,13 @@ static void xhci_free_irq(struct xhci_hcd *xhci)
        int ret;
 
        /* return if using legacy interrupt */
-       if (xhci_to_hcd(xhci)->irq >= 0)
+       if (xhci_to_hcd(xhci)->irq > 0)
                return;
 
        ret = xhci_free_msi(xhci);
        if (!ret)
                return;
-       if (pdev->irq >= 0)
+       if (pdev->irq > 0)
                free_irq(pdev->irq, xhci_to_hcd(xhci));
 
        return;
@@ -341,7 +341,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
        /* unregister the legacy interrupt */
        if (hcd->irq)
                free_irq(hcd->irq, hcd);
-       hcd->irq = -1;
+       hcd->irq = 0;
 
        ret = xhci_setup_msix(xhci);
        if (ret)
@@ -349,7 +349,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
                ret = xhci_setup_msi(xhci);
 
        if (!ret)
-               /* hcd->irq is -1, we have MSI */
+               /* hcd->irq is 0, we have MSI */
                return 0;
 
        if (!pdev->irq) {
index b527e9e6dbac7a45fcb572afdedfd298790c3722..0f8b82918a40f8038d5c75567b18e2b62d454829 100644 (file)
@@ -1987,7 +1987,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
                musb->xceiv->otg->default_a = 1;
                musb->xceiv->state = OTG_STATE_A_IDLE;
 
-               status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
+               status = usb_add_hcd(musb_to_hcd(musb), 0, 0);
 
                hcd->self.uses_pio_for_control = 1;
                dev_dbg(musb->controller, "%s mode, status %d, devctl %02x %c\n",
index a495a3079c078f4c1031b23a61ece23a78e56ad9..f42c29b11f713ddbb95f7a6115e27e2921325dd8 100644 (file)
@@ -1957,7 +1957,7 @@ static int musb_gadget_start(struct usb_gadget *g,
                 * handles power budgeting ... this way also
                 * ensures HdrcStart is indirectly called.
                 */
-               retval = usb_add_hcd(musb_to_hcd(musb), -1, 0);
+               retval = usb_add_hcd(musb_to_hcd(musb), 0, 0);
                if (retval < 0) {
                        dev_dbg(musb->controller, "add_hcd failed, %d\n", retval);
                        goto err2;
index 2e6071efbfb7657540fe3734a062a27d52f9919b..5de415707c234f0e54939195062b5dc39f0a1c06 100644 (file)
@@ -127,7 +127,7 @@ struct usb_hcd {
        unsigned                authorized_default:1;
        unsigned                has_tt:1;       /* Integrated TT in root hub */
 
-       int                     irq;            /* irq allocated */
+       unsigned int            irq;            /* irq allocated */
        void __iomem            *regs;          /* device memory/io */
        u64                     rsrc_start;     /* memory/io resource start */
        u64                     rsrc_len;       /* memory/io resource length */