aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ohci-platform.c
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2012-10-08 09:11:46 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-22 14:30:26 -0400
commitbe7ac70b9b1cb49758d52abb554c92c03acd6f08 (patch)
tree6e9768fa43ca5320877a4cdca7bbcc05a12e883a /drivers/usb/host/ohci-platform.c
parent61ff2745e53512adf22625f9194e83e471882523 (diff)
USB: OHCI: make ohci-platform use devm_request_and_ioremap helper
This patch changes the ohci-platform driver to use the device managed helper function for requesting memory region and ioremapping memory resources. As a result the error path in the probe function is simplified, and the platform driver remove callback does no longer need to release and iounmap memory resources. devm_request_and_ioremap() will use either the ioremap() or ioremap_nocache() handler depending on the resource's CACHEABLE flag, so we are good with this change. Signed-off-by: Florian Fainelli <florian@openwrt.org> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/ohci-platform.c')
-rw-r--r--drivers/usb/host/ohci-platform.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 1344426b05a..bda4e0bb8ab 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -127,29 +127,19 @@ static int __devinit ohci_platform_probe(struct platform_device *dev)
127 hcd->rsrc_start = res_mem->start; 127 hcd->rsrc_start = res_mem->start;
128 hcd->rsrc_len = resource_size(res_mem); 128 hcd->rsrc_len = resource_size(res_mem);
129 129
130 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 130 hcd->regs = devm_request_and_ioremap(&dev->dev, res_mem);
131 dev_err(&dev->dev, "controller already in use");
132 err = -EBUSY;
133 goto err_put_hcd;
134 }
135
136 hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
137 if (!hcd->regs) { 131 if (!hcd->regs) {
138 err = -ENOMEM; 132 err = -ENOMEM;
139 goto err_release_region; 133 goto err_put_hcd;
140 } 134 }
141 err = usb_add_hcd(hcd, irq, IRQF_SHARED); 135 err = usb_add_hcd(hcd, irq, IRQF_SHARED);
142 if (err) 136 if (err)
143 goto err_iounmap; 137 goto err_put_hcd;
144 138
145 platform_set_drvdata(dev, hcd); 139 platform_set_drvdata(dev, hcd);
146 140
147 return err; 141 return err;
148 142
149err_iounmap:
150 iounmap(hcd->regs);
151err_release_region:
152 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
153err_put_hcd: 143err_put_hcd:
154 usb_put_hcd(hcd); 144 usb_put_hcd(hcd);
155err_power: 145err_power:
@@ -165,8 +155,6 @@ static int __devexit ohci_platform_remove(struct platform_device *dev)
165 struct usb_ohci_pdata *pdata = dev->dev.platform_data; 155 struct usb_ohci_pdata *pdata = dev->dev.platform_data;
166 156
167 usb_remove_hcd(hcd); 157 usb_remove_hcd(hcd);
168 iounmap(hcd->regs);
169 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
170 usb_put_hcd(hcd); 158 usb_put_hcd(hcd);
171 platform_set_drvdata(dev, NULL); 159 platform_set_drvdata(dev, NULL);
172 160