The glue code probe functions don't need to access the hcd structure anymore. Modify isp1760_register to return an integer error code instead of the hcd pointer.
Signed-off-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com> --- drivers/usb/host/isp1760-hcd.c | 19 ++++++++++--------- drivers/usb/host/isp1760-hcd.h | 11 +++-------- drivers/usb/host/isp1760-if.c | 20 ++++++-------------- 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index 7bf6517..c153097 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c @@ -60,6 +60,9 @@ struct isp1760_hcd { int rst_gpio; }; +typedef void (packet_enqueue)(struct usb_hcd *hcd, struct isp1760_qh *qh, + struct isp1760_qtd *qtd); + static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd) { return (struct isp1760_hcd *) (hcd->hcd_priv); @@ -2213,25 +2216,23 @@ void deinit_kmem_cache(void) kmem_cache_destroy(urb_listitem_cachep); } -struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, - int irq, unsigned long irqflags, - int rst_gpio, - struct device *dev, const char *busname, - unsigned int devflags) +int isp1760_register(phys_addr_t res_start, resource_size_t res_len, int irq, + unsigned long irqflags, int rst_gpio, struct device *dev, + const char *busname, unsigned int devflags) { struct usb_hcd *hcd; struct isp1760_hcd *priv; int ret; if (usb_disabled()) - return ERR_PTR(-ENODEV); + return -ENODEV; /* prevent usb-core allocating DMA pages */ dev->dma_mask = NULL; hcd = usb_create_hcd(&isp1760_hc_driver, dev, dev_name(dev)); if (!hcd) - return ERR_PTR(-ENOMEM); + return -ENOMEM; priv = hcd_to_priv(hcd); priv->devflags = devflags; @@ -2254,7 +2255,7 @@ struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, dev_set_drvdata(dev, hcd); - return hcd; + return 0; err_unmap: iounmap(hcd->regs); @@ -2262,7 +2263,7 @@ err_unmap: err_put: usb_put_hcd(hcd); - return ERR_PTR(ret); + return ret; } void isp1760_unregister(struct device *dev) diff --git a/drivers/usb/host/isp1760-hcd.h b/drivers/usb/host/isp1760-hcd.h index 3538b27..50a7bdd 100644 --- a/drivers/usb/host/isp1760-hcd.h +++ b/drivers/usb/host/isp1760-hcd.h @@ -2,11 +2,9 @@ #define _ISP1760_HCD_H_ /* exports for if */ -struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, - int irq, unsigned long irqflags, - int rst_gpio, - struct device *dev, const char *busname, - unsigned int devflags); +int isp1760_register(phys_addr_t res_start, resource_size_t res_len, int irq, + unsigned long irqflags, int rst_gpio, struct device *dev, + const char *busname, unsigned int devflags); void isp1760_unregister(struct device *dev); int init_kmem_once(void); @@ -113,9 +111,6 @@ struct slotinfo { }; -typedef void (packet_enqueue)(struct usb_hcd *hcd, struct isp1760_qh *qh, - struct isp1760_qtd *qtd); - /* * Device flags that can vary from board to board. All of these * indicate the most "atypical" case, so that a devflags of 0 is diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index 025930f..686aaba 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c @@ -34,7 +34,6 @@ #if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) static int of_isp1760_probe(struct platform_device *dev) { - struct usb_hcd *hcd; struct device_node *dp = dev->dev.of_node; struct resource *res; struct resource memory; @@ -97,14 +96,12 @@ static int of_isp1760_probe(struct platform_device *dev) } } - hcd = isp1760_register(memory.start, res_len, virq, + ret = isp1760_register(memory.start, res_len, virq, IRQF_SHARED, rst_gpio, &dev->dev, dev_name(&dev->dev), devflags); - if (IS_ERR(hcd)) { - ret = PTR_ERR(hcd); + if (ret < 0) goto free_gpio; - } return ret; @@ -152,7 +149,6 @@ static int isp1761_pci_probe(struct pci_dev *dev, u8 latency, limit; __u32 reg_data; int retry_count; - struct usb_hcd *hcd; unsigned int devflags = 0; int ret_status = 0; @@ -255,13 +251,11 @@ static int isp1761_pci_probe(struct pci_dev *dev, writel(reg_data, iobase + PLX_INT_CSR_REG); dev->dev.dma_mask = NULL; - hcd = isp1760_register(pci_mem_phy0, memlength, dev->irq, + ret_status = isp1760_register(pci_mem_phy0, memlength, dev->irq, IRQF_SHARED, -ENOENT, &dev->dev, dev_name(&dev->dev), devflags); - if (IS_ERR(hcd)) { - ret_status = -ENODEV; + if (ret_status < 0) goto cleanup3; - } /* done with PLX IO access */ iounmap(iobase); @@ -315,7 +309,6 @@ static struct pci_driver isp1761_pci_driver = { static int isp1760_plat_probe(struct platform_device *pdev) { int ret = 0; - struct usb_hcd *hcd; struct resource *mem_res; struct resource *irq_res; resource_size_t mem_size; @@ -360,13 +353,12 @@ static int isp1760_plat_probe(struct platform_device *pdev) devflags |= ISP1760_FLAG_DREQ_POL_HIGH; } - hcd = isp1760_register(mem_res->start, mem_size, irq_res->start, + ret = isp1760_register(mem_res->start, mem_size, irq_res->start, irqflags, -ENOENT, &pdev->dev, dev_name(&pdev->dev), devflags); - if (IS_ERR(hcd)) { + if (ret < 0) { pr_warning("isp1760: Failed to register the HCD device\n"); - ret = -ENODEV; goto cleanup; } -- 2.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html