diff options
author | Florian Fainelli <florian@openwrt.org> | 2012-10-08 09:11:45 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-22 14:30:26 -0400 |
commit | 61ff2745e53512adf22625f9194e83e471882523 (patch) | |
tree | a09a5b9fa02ce6e23ef4cf132da11878adcb0670 /drivers/usb/host | |
parent | ac0e3c04eb7dbf093032b72020951f9b92ede3d7 (diff) |
USB: EHCI: make ehci-platform use devm_request_and_ioremap helper
This patch changes the ehci-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')
-rw-r--r-- | drivers/usb/host/ehci-platform.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 3cb0b1bf9ac2..272728c48c9e 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c | |||
@@ -123,29 +123,19 @@ static int __devinit ehci_platform_probe(struct platform_device *dev) | |||
123 | hcd->rsrc_start = res_mem->start; | 123 | hcd->rsrc_start = res_mem->start; |
124 | hcd->rsrc_len = resource_size(res_mem); | 124 | hcd->rsrc_len = resource_size(res_mem); |
125 | 125 | ||
126 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 126 | hcd->regs = devm_request_and_ioremap(&dev->dev, res_mem); |
127 | dev_err(&dev->dev, "controller already in use"); | ||
128 | err = -EBUSY; | ||
129 | goto err_put_hcd; | ||
130 | } | ||
131 | |||
132 | hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); | ||
133 | if (!hcd->regs) { | 127 | if (!hcd->regs) { |
134 | err = -ENOMEM; | 128 | err = -ENOMEM; |
135 | goto err_release_region; | 129 | goto err_put_hcd; |
136 | } | 130 | } |
137 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); | 131 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); |
138 | if (err) | 132 | if (err) |
139 | goto err_iounmap; | 133 | goto err_put_hcd; |
140 | 134 | ||
141 | platform_set_drvdata(dev, hcd); | 135 | platform_set_drvdata(dev, hcd); |
142 | 136 | ||
143 | return err; | 137 | return err; |
144 | 138 | ||
145 | err_iounmap: | ||
146 | iounmap(hcd->regs); | ||
147 | err_release_region: | ||
148 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
149 | err_put_hcd: | 139 | err_put_hcd: |
150 | usb_put_hcd(hcd); | 140 | usb_put_hcd(hcd); |
151 | err_power: | 141 | err_power: |
@@ -161,8 +151,6 @@ static int __devexit ehci_platform_remove(struct platform_device *dev) | |||
161 | struct usb_ehci_pdata *pdata = dev->dev.platform_data; | 151 | struct usb_ehci_pdata *pdata = dev->dev.platform_data; |
162 | 152 | ||
163 | usb_remove_hcd(hcd); | 153 | usb_remove_hcd(hcd); |
164 | iounmap(hcd->regs); | ||
165 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
166 | usb_put_hcd(hcd); | 154 | usb_put_hcd(hcd); |
167 | platform_set_drvdata(dev, NULL); | 155 | platform_set_drvdata(dev, NULL); |
168 | 156 | ||