> Greg:
> 
> This patch contains the changes to the ohci-sa1111 driver.
> 
> Alan Stern


This patch introduces several paths in the interrupt handler that return
IRQ_NONE.  In the original code, we took care (in usb_hcd_sa1111_hcim_irq)
to always return IRQ_HANDLED, no matter what.  I don't recall offhand why we
did this, but I'm mildly hesitant about this part of the patch given that
the SA-1111 is a quirky beast, especially re: interrupts.

The rest of the changes look good to me.

-ch




> -----Original Message-----
> From: Alan Stern [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, February 08, 2005 12:58 PM
> To: Greg KH
> Cc: USB development list; Christopher Hoover
> Subject: [PATCH as460 (8/10)] USBcore: implement usb_add_hcd 
> and usb_remove_hcd (SA1111)
> 
> Greg:
> 
> This patch contains the changes to the ohci-sa1111 driver.
> 
> Alan Stern
> 
> 
> 
> Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
> 
> ===== drivers/usb/host/ohci-sa1111.c 1.45 vs edited =====
> --- 1.45/drivers/usb/host/ohci-sa1111.c       2005-01-11 
> 12:14:58 -05:00
> +++ edited/drivers/usb/host/ohci-sa1111.c     2005-02-08 
> 12:20:18 -05:00
> @@ -105,34 +105,8 @@
>  }
>  #endif
>  
> -static irqreturn_t usb_hcd_sa1111_hcim_irq (int irq, void 
> *__hcd, struct pt_regs * r)
> -{
> -     struct usb_hcd *hcd = __hcd;
> -//   unsigned long status = sa1111_readl(hcd->regs + 
> SA1111_USB_STATUS);
> -
> -     //dump_hci_status(hcd, "irq");
> -
> -#if 0
> -     /* may work better this way -- need to investigate further */
> -     if (status & USB_STATUS_NIRQHCIM) {
> -             //dbg ("not normal HC interrupt; ignoring");
> -             return;
> -     }
> -#endif
> -
> -     usb_hcd_irq(irq, hcd, r);
> -
> -     /*
> -      * SA1111 seems to re-assert its interrupt immediately
> -      * after processing an interrupt.  Always return IRQ_HANDLED.
> -      */
> -     return IRQ_HANDLED;
> -}
> -
>  
> /*------------------------------------------------------------
> -------------*/
>  
> -void usb_hcd_sa1111_remove (struct usb_hcd *, struct sa1111_dev *);
> -
>  /* configure so an HC device and id are always provided */
>  /* always called with process context; sleeping is OK */
>  
> @@ -148,68 +122,35 @@
>   * Store this function in the HCD's struct pci_driver as probe().
>   */
>  int usb_hcd_sa1111_probe (const struct hc_driver *driver,
> -                       struct usb_hcd **hcd_out,
>                         struct sa1111_dev *dev)
>  {
> +     struct usb_hcd *hcd;
>       int retval;
> -     struct usb_hcd *hcd = 0;
>  
> -     if (!request_mem_region(dev->res.start, 
> -                             dev->res.end - dev->res.start + 
> 1, hcd_name)) {
> -             dbg("request_mem_region failed");
> -             return -EBUSY;
> -     }
> -
> -     sa1111_start_hc(dev);
> +     hcd = usb_create_hcd (driver, &dev->dev, "sa1111");
> +     if (!hcd)
> +             return -ENOMEM;
> +     hcd->rsrc_start = dev->res.start;
> +     hcd->rsrc_len = dev->res.end - dev->res.start + 1;
>  
> -     hcd = usb_create_hcd (driver);
> -     if (hcd == NULL){
> -             dbg ("hcd_alloc failed");
> -             retval = -ENOMEM;
> +     if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, 
> hcd_name)) {
> +             dbg("request_mem_region failed");
> +             retval = -EBUSY;
>               goto err1;
>       }
> -     ohci_hcd_init(hcd_to_ohci(hcd));
> -
> -     hcd->irq = dev->irq[1];
>       hcd->regs = dev->mapbase;
> -     hcd->self.controller = &dev->dev;
> -
> -     retval = hcd_buffer_create (hcd);
> -     if (retval != 0) {
> -             dbg ("pool alloc fail");
> -             goto err2;
> -     }
> -
> -     retval = request_irq (hcd->irq, 
> usb_hcd_sa1111_hcim_irq, SA_INTERRUPT,
> -                           hcd->driver->description, hcd);
> -     if (retval != 0) {
> -             dbg("request_irq failed");
> -             retval = -EBUSY;
> -             goto err3;
> -     }
>  
> -     info ("%s (SA-1111) at 0x%p, irq %d\n",
> -             hcd->driver->description, hcd->regs, hcd->irq);
> -
> -     hcd->self.bus_name = "sa1111";
> -     usb_register_bus (&hcd->self);
> +     sa1111_start_hc(dev);
> +     ohci_hcd_init(hcd_to_ohci(hcd));
>  
> -     if ((retval = driver->start (hcd)) < 0) 
> -     {
> -             usb_hcd_sa1111_remove(hcd, dev);
> +     retval = usb_add_hcd(hcd, dev->irq[1], SA_INTERRUPT);
> +     if (retval == 0)
>               return retval;
> -     }
>  
> -     *hcd_out = hcd;
> -     return 0;
> -
> - err3:
> -     hcd_buffer_destroy (hcd);
> - err2:
> -     usb_put_hcd(hcd);
> - err1:
>       sa1111_stop_hc(dev);
> -     release_mem_region(dev->res.start, dev->res.end - 
> dev->res.start + 1);
> +     release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
> + err1:
> +     usb_put_hcd(hcd);
>       return retval;
>  }
>  
> @@ -229,26 +170,10 @@
>   */
>  void usb_hcd_sa1111_remove (struct usb_hcd *hcd, struct 
> sa1111_dev *dev)
>  {
> -     info ("remove: %s, state %x", hcd->self.bus_name, hcd->state);
> -
> -     if (in_interrupt ())
> -             BUG ();
> -
> -     hcd->state = USB_STATE_QUIESCING;
> -
> -     dbg ("%s: roothub graceful disconnect", hcd->self.bus_name);
> -     usb_disconnect (&hcd->self.root_hub);
> -
> -     hcd->driver->stop (hcd);
> -     hcd->state = USB_STATE_HALT;
> -
> -     free_irq (hcd->irq, hcd);
> -     hcd_buffer_destroy (hcd);
> -
> -     usb_deregister_bus (&hcd->self);
> -
> +     usb_remove_hcd(hcd);
>       sa1111_stop_hc(dev);
> -     release_mem_region(dev->res.start, dev->res.end - 
> dev->res.start + 1);
> +     release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
> +     usb_put_hcd(hcd);
>  }
>  
>  
> /*------------------------------------------------------------
> -------------*/
> @@ -281,7 +206,7 @@
>        * generic hardware linkage
>        */
>       .irq =                  ohci_irq,
> -     .flags =                HCD_USB11,
> +     .flags =                HCD_USB11 | HCD_MEMORY,
>  
>       /*
>        * basic lifecycle operations
> @@ -294,11 +219,6 @@
>       .stop =                 ohci_stop,
>  
>       /*
> -      * memory lifecycle (except per-request)
> -      */
> -     .hcd_alloc =            ohci_hcd_alloc,
> -
> -     /*
>        * managing i/o requests and associated device resources
>        */
>       .urb_enqueue =          ohci_urb_enqueue,
> @@ -325,17 +245,12 @@
>  
>  static int ohci_hcd_sa1111_drv_probe(struct sa1111_dev *dev)
>  {
> -     struct usb_hcd *hcd = NULL;
>       int ret;
>  
>       if (usb_disabled())
>               return -ENODEV;
>  
> -     ret = usb_hcd_sa1111_probe(&ohci_sa1111_hc_driver, &hcd, dev);
> -
> -     if (ret == 0)
> -             sa1111_set_drvdata(dev, hcd);
> -
> +     ret = usb_hcd_sa1111_probe(&ohci_sa1111_hc_driver, dev);
>       return ret;
>  }
>  
> @@ -344,9 +259,6 @@
>       struct usb_hcd *hcd = sa1111_get_drvdata(dev);
>  
>       usb_hcd_sa1111_remove(hcd, dev);
> -
> -     sa1111_set_drvdata(dev, NULL);
> -
>       return 0;
>  }
>  
> 
> 



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to