Commit f0bdbb0e authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Felipe Balbi

usb: isp1760: Don't expose hcd to glue code from isp1760_register

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 57f068be
...@@ -60,6 +60,9 @@ struct isp1760_hcd { ...@@ -60,6 +60,9 @@ struct isp1760_hcd {
struct gpio_desc *rst_gpio; struct gpio_desc *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) static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd)
{ {
return (struct isp1760_hcd *) (hcd->hcd_priv); return (struct isp1760_hcd *) (hcd->hcd_priv);
...@@ -2208,24 +2211,23 @@ void deinit_kmem_cache(void) ...@@ -2208,24 +2211,23 @@ void deinit_kmem_cache(void)
kmem_cache_destroy(urb_listitem_cachep); kmem_cache_destroy(urb_listitem_cachep);
} }
struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, int isp1760_register(phys_addr_t res_start, resource_size_t res_len, int irq,
int irq, unsigned long irqflags, unsigned long irqflags, struct device *dev,
struct device *dev, const char *busname, const char *busname, unsigned int devflags)
unsigned int devflags)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
struct isp1760_hcd *priv; struct isp1760_hcd *priv;
int ret; int ret;
if (usb_disabled()) if (usb_disabled())
return ERR_PTR(-ENODEV); return -ENODEV;
/* prevent usb-core allocating DMA pages */ /* prevent usb-core allocating DMA pages */
dev->dma_mask = NULL; dev->dma_mask = NULL;
hcd = usb_create_hcd(&isp1760_hc_driver, dev, dev_name(dev)); hcd = usb_create_hcd(&isp1760_hc_driver, dev, dev_name(dev));
if (!hcd) if (!hcd)
return ERR_PTR(-ENOMEM); return -ENOMEM;
priv = hcd_to_priv(hcd); priv = hcd_to_priv(hcd);
priv->devflags = devflags; priv->devflags = devflags;
...@@ -2254,7 +2256,7 @@ struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, ...@@ -2254,7 +2256,7 @@ struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len,
dev_set_drvdata(dev, hcd); dev_set_drvdata(dev, hcd);
return hcd; return 0;
err_unmap: err_unmap:
iounmap(hcd->regs); iounmap(hcd->regs);
...@@ -2262,7 +2264,7 @@ struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, ...@@ -2262,7 +2264,7 @@ struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len,
err_put: err_put:
usb_put_hcd(hcd); usb_put_hcd(hcd);
return ERR_PTR(ret); return ret;
} }
void isp1760_unregister(struct device *dev) void isp1760_unregister(struct device *dev)
......
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
#define _ISP1760_HCD_H_ #define _ISP1760_HCD_H_
/* exports for if */ /* exports for if */
struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, int isp1760_register(phys_addr_t res_start, resource_size_t res_len, int irq,
int irq, unsigned long irqflags, unsigned long irqflags, struct device *dev,
struct device *dev, const char *busname, const char *busname, unsigned int devflags);
unsigned int devflags);
void isp1760_unregister(struct device *dev); void isp1760_unregister(struct device *dev);
int init_kmem_once(void); int init_kmem_once(void);
...@@ -112,9 +111,6 @@ struct slotinfo { ...@@ -112,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 * Device flags that can vary from board to board. All of these
* indicate the most "atypical" case, so that a devflags of 0 is * indicate the most "atypical" case, so that a devflags of 0 is
......
...@@ -31,7 +31,6 @@ static int isp1761_pci_probe(struct pci_dev *dev, ...@@ -31,7 +31,6 @@ static int isp1761_pci_probe(struct pci_dev *dev,
u8 latency, limit; u8 latency, limit;
__u32 reg_data; __u32 reg_data;
int retry_count; int retry_count;
struct usb_hcd *hcd;
unsigned int devflags = 0; unsigned int devflags = 0;
int ret_status = 0; int ret_status = 0;
...@@ -134,13 +133,11 @@ static int isp1761_pci_probe(struct pci_dev *dev, ...@@ -134,13 +133,11 @@ static int isp1761_pci_probe(struct pci_dev *dev,
writel(reg_data, iobase + PLX_INT_CSR_REG); writel(reg_data, iobase + PLX_INT_CSR_REG);
dev->dev.dma_mask = NULL; 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, &dev->dev, dev_name(&dev->dev), IRQF_SHARED, &dev->dev,
devflags); dev_name(&dev->dev), devflags);
if (IS_ERR(hcd)) { if (ret_status < 0)
ret_status = -ENODEV;
goto cleanup3; goto cleanup3;
}
/* done with PLX IO access */ /* done with PLX IO access */
iounmap(iobase); iounmap(iobase);
...@@ -198,7 +195,6 @@ static int isp1760_plat_probe(struct platform_device *pdev) ...@@ -198,7 +195,6 @@ static int isp1760_plat_probe(struct platform_device *pdev)
struct resource *mem_res; struct resource *mem_res;
struct resource *irq_res; struct resource *irq_res;
resource_size_t mem_size; resource_size_t mem_size;
struct usb_hcd *hcd;
int ret; int ret;
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
...@@ -262,14 +258,11 @@ static int isp1760_plat_probe(struct platform_device *pdev) ...@@ -262,14 +258,11 @@ static int isp1760_plat_probe(struct platform_device *pdev)
devflags |= ISP1760_FLAG_DREQ_POL_HIGH; 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, &pdev->dev, dev_name(&pdev->dev), irqflags, &pdev->dev, dev_name(&pdev->dev),
devflags); devflags);
if (IS_ERR(hcd)) { if (ret < 0)
pr_warning("isp1760: Failed to register the HCD device\n");
ret = PTR_ERR(hcd);
goto cleanup; goto cleanup;
}
pr_info("ISP1760 USB device initialised\n"); pr_info("ISP1760 USB device initialised\n");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment