fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / usb / gadget / goku_udc.c
index b0f3cd6..d0ef1d6 100644 (file)
@@ -24,7 +24,6 @@
 // #define     VERBOSE         /* extra debug messages (success too) */
 // #define     USB_TRACE       /* packet-level success messages */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -275,11 +274,10 @@ goku_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
 
        if (!_ep)
                return NULL;
-       req = kmalloc(sizeof *req, gfp_flags);
+       req = kzalloc(sizeof *req, gfp_flags);
        if (!req)
                return NULL;
 
-       memset(req, 0, sizeof *req);
        req->req.dma = DMA_ADDR_INVALID;
        INIT_LIST_HEAD(&req->queue);
        return &req->req;
@@ -1434,7 +1432,6 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
        if (!driver
                        || driver->speed != USB_SPEED_FULL
                        || !driver->bind
-                       || !driver->unbind
                        || !driver->disconnect
                        || !driver->setup)
                return -EINVAL;
@@ -1497,7 +1494,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
 
        if (!dev)
                return -ENODEV;
-       if (!driver || driver != dev->driver)
+       if (!driver || driver != dev->driver || !driver->unbind)
                return -EINVAL;
 
        spin_lock_irqsave(&dev->lock, flags);
@@ -1630,7 +1627,7 @@ stall:
                handled = 1; \
                }
 
-static irqreturn_t goku_irq(int irq, void *_dev, struct pt_regs *r)
+static irqreturn_t goku_irq(int irq, void *_dev)
 {
        struct goku_udc                 *dev = _dev;
        struct goku_udc_regs __iomem    *regs = dev->regs;
@@ -1810,13 +1807,8 @@ static void goku_remove(struct pci_dev *pdev)
        struct goku_udc         *dev = pci_get_drvdata(pdev);
 
        DBG(dev, "%s\n", __FUNCTION__);
-       /* start with the driver above us */
-       if (dev->driver) {
-               /* should have been done already by driver model core */
-               WARN(dev, "pci remove, driver '%s' is still registered\n",
-                               dev->driver->driver.name);
-               usb_gadget_unregister_driver(dev->driver);
-       }
+
+       BUG_ON(dev->driver);
 
 #ifdef CONFIG_USB_GADGET_DEBUG_FILES
        remove_proc_entry(proc_node_name, NULL);
@@ -1851,7 +1843,6 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        unsigned long           resource, len;
        void __iomem            *base = NULL;
        int                     retval;
-       char                    buf [8], *bufp;
 
        /* if you want to support more than one controller in a system,
         * usb_gadget_driver_{register,unregister}() must change.
@@ -1867,7 +1858,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        }
 
        /* alloc, and start init */
-       dev = kmalloc (sizeof *dev, SLAB_KERNEL);
+       dev = kmalloc (sizeof *dev, GFP_KERNEL);
        if (dev == NULL){
                pr_debug("enomem %s\n", pci_name(pdev));
                retval = -ENOMEM;
@@ -1914,20 +1905,14 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        pci_set_drvdata(pdev, dev);
        INFO(dev, "%s\n", driver_desc);
        INFO(dev, "version: " DRIVER_VERSION " %s\n", dmastr());
-#ifndef __sparc__
-       scnprintf(buf, sizeof buf, "%d", pdev->irq);
-       bufp = buf;
-#else
-       bufp = __irq_itoa(pdev->irq);
-#endif
-       INFO(dev, "irq %s, pci mem %p\n", bufp, base);
+       INFO(dev, "irq %d, pci mem %p\n", pdev->irq, base);
 
        /* init to known state, then setup irqs */
        udc_reset(dev);
        udc_reinit (dev);
-       if (request_irq(pdev->irq, goku_irq, SA_SHIRQ/*|SA_SAMPLE_RANDOM*/,
+       if (request_irq(pdev->irq, goku_irq, IRQF_SHARED/*|IRQF_SAMPLE_RANDOM*/,
                        driver_name, dev) != 0) {
-               DBG(dev, "request interrupt %s failed\n", bufp);
+               DBG(dev, "request interrupt %d failed\n", pdev->irq);
                retval = -EBUSY;
                goto done;
        }