Commit 8a8b96f4 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Felipe Balbi

usb: isp1760: Remove isp1760 glue structure

The structure is allocated for the sole purpose of holding a pointer to
the HCD and being stored in platform device driver data. Store the HCD
pointer directly instead.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 7eb42c6e
...@@ -31,13 +31,9 @@ ...@@ -31,13 +31,9 @@
#endif #endif
#if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) #if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ)
struct isp1760 {
struct usb_hcd *hcd;
};
static int of_isp1760_probe(struct platform_device *dev) static int of_isp1760_probe(struct platform_device *dev)
{ {
struct isp1760 *drvdata; struct usb_hcd *hcd;
struct device_node *dp = dev->dev.of_node; struct device_node *dp = dev->dev.of_node;
struct resource *res; struct resource *res;
struct resource memory; struct resource memory;
...@@ -47,23 +43,15 @@ static int of_isp1760_probe(struct platform_device *dev) ...@@ -47,23 +43,15 @@ static int of_isp1760_probe(struct platform_device *dev)
unsigned int devflags = 0; unsigned int devflags = 0;
u32 bus_width = 0; u32 bus_width = 0;
drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
if (!drvdata)
return -ENOMEM;
ret = of_address_to_resource(dp, 0, &memory); ret = of_address_to_resource(dp, 0, &memory);
if (ret) { if (ret)
ret = -ENXIO; return -ENXIO;
goto free_data;
}
res_len = resource_size(&memory); res_len = resource_size(&memory);
res = request_mem_region(memory.start, res_len, dev_name(&dev->dev)); res = request_mem_region(memory.start, res_len, dev_name(&dev->dev));
if (!res) { if (!res)
ret = -EBUSY; return -EBUSY;
goto free_data;
}
virq = irq_of_parse_and_map(dp, 0); virq = irq_of_parse_and_map(dp, 0);
if (!virq) { if (!virq) {
...@@ -91,34 +79,30 @@ static int of_isp1760_probe(struct platform_device *dev) ...@@ -91,34 +79,30 @@ static int of_isp1760_probe(struct platform_device *dev)
if (of_get_property(dp, "dreq-polarity", NULL) != NULL) if (of_get_property(dp, "dreq-polarity", NULL) != NULL)
devflags |= ISP1760_FLAG_DREQ_POL_HIGH; devflags |= ISP1760_FLAG_DREQ_POL_HIGH;
drvdata->hcd = isp1760_register(memory.start, res_len, virq, hcd = isp1760_register(memory.start, res_len, virq, IRQF_SHARED,
IRQF_SHARED, &dev->dev, &dev->dev, dev_name(&dev->dev), devflags);
dev_name(&dev->dev), devflags); if (IS_ERR(hcd)) {
if (IS_ERR(drvdata->hcd)) { ret = PTR_ERR(hcd);
ret = PTR_ERR(drvdata->hcd);
goto release_reg; goto release_reg;
} }
platform_set_drvdata(dev, drvdata); platform_set_drvdata(dev, hcd);
return ret; return ret;
release_reg: release_reg:
release_mem_region(memory.start, res_len); release_mem_region(memory.start, res_len);
free_data:
kfree(drvdata);
return ret; return ret;
} }
static int of_isp1760_remove(struct platform_device *dev) static int of_isp1760_remove(struct platform_device *dev)
{ {
struct isp1760 *drvdata = platform_get_drvdata(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
usb_remove_hcd(drvdata->hcd); usb_remove_hcd(hcd);
iounmap(drvdata->hcd->regs); iounmap(hcd->regs);
release_mem_region(drvdata->hcd->rsrc_start, drvdata->hcd->rsrc_len); release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(drvdata->hcd); usb_put_hcd(hcd);
kfree(drvdata);
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