diff options
| author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-01-20 17:55:47 -0500 |
|---|---|---|
| committer | Felipe Balbi <balbi@ti.com> | 2015-01-27 10:38:33 -0500 |
| commit | f0bdbb0ec6be7465eecbdbea058c027485a0d966 (patch) | |
| tree | 05a7c99e0657bc46800c4ec10568b4312149c181 /drivers/usb/host | |
| parent | 57f068bedca8b92157d09f971f2fb3adb76f8f96 (diff) | |
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/host')
| -rw-r--r-- | drivers/usb/host/isp1760-hcd.c | 18 | ||||
| -rw-r--r-- | drivers/usb/host/isp1760-hcd.h | 10 | ||||
| -rw-r--r-- | drivers/usb/host/isp1760-if.c | 19 |
3 files changed, 19 insertions, 28 deletions
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index 19fbd6965630..4d6e50b13d81 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
| @@ -60,6 +60,9 @@ struct isp1760_hcd { | |||
| 60 | struct gpio_desc *rst_gpio; | 60 | struct gpio_desc *rst_gpio; |
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | typedef void (packet_enqueue)(struct usb_hcd *hcd, struct isp1760_qh *qh, | ||
| 64 | struct isp1760_qtd *qtd); | ||
| 65 | |||
| 63 | static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd) | 66 | static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd) |
| 64 | { | 67 | { |
| 65 | return (struct isp1760_hcd *) (hcd->hcd_priv); | 68 | return (struct isp1760_hcd *) (hcd->hcd_priv); |
| @@ -2208,24 +2211,23 @@ void deinit_kmem_cache(void) | |||
| 2208 | kmem_cache_destroy(urb_listitem_cachep); | 2211 | kmem_cache_destroy(urb_listitem_cachep); |
| 2209 | } | 2212 | } |
| 2210 | 2213 | ||
| 2211 | struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, | 2214 | int isp1760_register(phys_addr_t res_start, resource_size_t res_len, int irq, |
| 2212 | int irq, unsigned long irqflags, | 2215 | unsigned long irqflags, struct device *dev, |
| 2213 | struct device *dev, const char *busname, | 2216 | const char *busname, unsigned int devflags) |
| 2214 | unsigned int devflags) | ||
| 2215 | { | 2217 | { |
| 2216 | struct usb_hcd *hcd; | 2218 | struct usb_hcd *hcd; |
| 2217 | struct isp1760_hcd *priv; | 2219 | struct isp1760_hcd *priv; |
| 2218 | int ret; | 2220 | int ret; |
| 2219 | 2221 | ||
| 2220 | if (usb_disabled()) | 2222 | if (usb_disabled()) |
| 2221 | return ERR_PTR(-ENODEV); | 2223 | return -ENODEV; |
| 2222 | 2224 | ||
| 2223 | /* prevent usb-core allocating DMA pages */ | 2225 | /* prevent usb-core allocating DMA pages */ |
| 2224 | dev->dma_mask = NULL; | 2226 | dev->dma_mask = NULL; |
| 2225 | 2227 | ||
| 2226 | hcd = usb_create_hcd(&isp1760_hc_driver, dev, dev_name(dev)); | 2228 | hcd = usb_create_hcd(&isp1760_hc_driver, dev, dev_name(dev)); |
| 2227 | if (!hcd) | 2229 | if (!hcd) |
| 2228 | return ERR_PTR(-ENOMEM); | 2230 | return -ENOMEM; |
| 2229 | 2231 | ||
| 2230 | priv = hcd_to_priv(hcd); | 2232 | priv = hcd_to_priv(hcd); |
| 2231 | priv->devflags = devflags; | 2233 | priv->devflags = devflags; |
| @@ -2254,7 +2256,7 @@ struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, | |||
| 2254 | 2256 | ||
| 2255 | dev_set_drvdata(dev, hcd); | 2257 | dev_set_drvdata(dev, hcd); |
| 2256 | 2258 | ||
| 2257 | return hcd; | 2259 | return 0; |
| 2258 | 2260 | ||
| 2259 | err_unmap: | 2261 | err_unmap: |
| 2260 | iounmap(hcd->regs); | 2262 | iounmap(hcd->regs); |
| @@ -2262,7 +2264,7 @@ err_unmap: | |||
| 2262 | err_put: | 2264 | err_put: |
| 2263 | usb_put_hcd(hcd); | 2265 | usb_put_hcd(hcd); |
| 2264 | 2266 | ||
| 2265 | return ERR_PTR(ret); | 2267 | return ret; |
| 2266 | } | 2268 | } |
| 2267 | 2269 | ||
| 2268 | void isp1760_unregister(struct device *dev) | 2270 | void isp1760_unregister(struct device *dev) |
diff --git a/drivers/usb/host/isp1760-hcd.h b/drivers/usb/host/isp1760-hcd.h index ea13a58d44f8..372d2e5f1210 100644 --- a/drivers/usb/host/isp1760-hcd.h +++ b/drivers/usb/host/isp1760-hcd.h | |||
| @@ -2,10 +2,9 @@ | |||
| 2 | #define _ISP1760_HCD_H_ | 2 | #define _ISP1760_HCD_H_ |
| 3 | 3 | ||
| 4 | /* exports for if */ | 4 | /* exports for if */ |
| 5 | struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, | 5 | int isp1760_register(phys_addr_t res_start, resource_size_t res_len, int irq, |
| 6 | int irq, unsigned long irqflags, | 6 | unsigned long irqflags, struct device *dev, |
| 7 | struct device *dev, const char *busname, | 7 | const char *busname, unsigned int devflags); |
| 8 | unsigned int devflags); | ||
| 9 | void isp1760_unregister(struct device *dev); | 8 | void isp1760_unregister(struct device *dev); |
| 10 | 9 | ||
| 11 | int init_kmem_once(void); | 10 | int init_kmem_once(void); |
| @@ -112,9 +111,6 @@ struct slotinfo { | |||
| 112 | }; | 111 | }; |
| 113 | 112 | ||
| 114 | 113 | ||
| 115 | typedef void (packet_enqueue)(struct usb_hcd *hcd, struct isp1760_qh *qh, | ||
| 116 | struct isp1760_qtd *qtd); | ||
| 117 | |||
| 118 | /* | 114 | /* |
| 119 | * Device flags that can vary from board to board. All of these | 115 | * Device flags that can vary from board to board. All of these |
| 120 | * indicate the most "atypical" case, so that a devflags of 0 is | 116 | * 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 64eaf5d0157e..03243b0dbe09 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
| @@ -31,7 +31,6 @@ static int isp1761_pci_probe(struct pci_dev *dev, | |||
| 31 | u8 latency, limit; | 31 | u8 latency, limit; |
| 32 | __u32 reg_data; | 32 | __u32 reg_data; |
| 33 | int retry_count; | 33 | int retry_count; |
| 34 | struct usb_hcd *hcd; | ||
| 35 | unsigned int devflags = 0; | 34 | unsigned int devflags = 0; |
| 36 | int ret_status = 0; | 35 | int ret_status = 0; |
| 37 | 36 | ||
| @@ -134,13 +133,11 @@ static int isp1761_pci_probe(struct pci_dev *dev, | |||
| 134 | writel(reg_data, iobase + PLX_INT_CSR_REG); | 133 | writel(reg_data, iobase + PLX_INT_CSR_REG); |
| 135 | 134 | ||
| 136 | dev->dev.dma_mask = NULL; | 135 | dev->dev.dma_mask = NULL; |
| 137 | hcd = isp1760_register(pci_mem_phy0, memlength, dev->irq, | 136 | ret_status = isp1760_register(pci_mem_phy0, memlength, dev->irq, |
| 138 | IRQF_SHARED, &dev->dev, dev_name(&dev->dev), | 137 | IRQF_SHARED, &dev->dev, |
| 139 | devflags); | 138 | dev_name(&dev->dev), devflags); |
| 140 | if (IS_ERR(hcd)) { | 139 | if (ret_status < 0) |
| 141 | ret_status = -ENODEV; | ||
| 142 | goto cleanup3; | 140 | goto cleanup3; |
| 143 | } | ||
| 144 | 141 | ||
| 145 | /* done with PLX IO access */ | 142 | /* done with PLX IO access */ |
| 146 | iounmap(iobase); | 143 | iounmap(iobase); |
| @@ -198,7 +195,6 @@ static int isp1760_plat_probe(struct platform_device *pdev) | |||
| 198 | struct resource *mem_res; | 195 | struct resource *mem_res; |
| 199 | struct resource *irq_res; | 196 | struct resource *irq_res; |
| 200 | resource_size_t mem_size; | 197 | resource_size_t mem_size; |
| 201 | struct usb_hcd *hcd; | ||
| 202 | int ret; | 198 | int ret; |
| 203 | 199 | ||
| 204 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 200 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| @@ -262,14 +258,11 @@ static int isp1760_plat_probe(struct platform_device *pdev) | |||
| 262 | devflags |= ISP1760_FLAG_DREQ_POL_HIGH; | 258 | devflags |= ISP1760_FLAG_DREQ_POL_HIGH; |
| 263 | } | 259 | } |
| 264 | 260 | ||
| 265 | hcd = isp1760_register(mem_res->start, mem_size, irq_res->start, | 261 | ret = isp1760_register(mem_res->start, mem_size, irq_res->start, |
| 266 | irqflags, &pdev->dev, dev_name(&pdev->dev), | 262 | irqflags, &pdev->dev, dev_name(&pdev->dev), |
| 267 | devflags); | 263 | devflags); |
| 268 | if (IS_ERR(hcd)) { | 264 | if (ret < 0) |
| 269 | pr_warning("isp1760: Failed to register the HCD device\n"); | ||
| 270 | ret = PTR_ERR(hcd); | ||
| 271 | goto cleanup; | 265 | goto cleanup; |
| 272 | } | ||
| 273 | 266 | ||
| 274 | pr_info("ISP1760 USB device initialised\n"); | 267 | pr_info("ISP1760 USB device initialised\n"); |
| 275 | return 0; | 268 | return 0; |
