diff options
Diffstat (limited to 'drivers/usb/host/uhci-platform.c')
-rw-r--r-- | drivers/usb/host/uhci-platform.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index 01833ab2b5c3..b987f1d10058 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/of.h> | 10 | #include <linux/of.h> |
11 | #include <linux/device.h> | ||
11 | #include <linux/platform_device.h> | 12 | #include <linux/platform_device.h> |
12 | 13 | ||
13 | static int uhci_platform_init(struct usb_hcd *hcd) | 14 | static int uhci_platform_init(struct usb_hcd *hcd) |
@@ -88,33 +89,22 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) | |||
88 | hcd->rsrc_start = res->start; | 89 | hcd->rsrc_start = res->start; |
89 | hcd->rsrc_len = resource_size(res); | 90 | hcd->rsrc_len = resource_size(res); |
90 | 91 | ||
91 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 92 | hcd->regs = devm_ioremap_resource(&pdev->dev, res); |
92 | pr_err("%s: request_mem_region failed\n", __func__); | 93 | if (IS_ERR(hcd->regs)) { |
93 | ret = -EBUSY; | 94 | ret = PTR_ERR(hcd->regs); |
94 | goto err_rmr; | 95 | goto err_rmr; |
95 | } | 96 | } |
96 | |||
97 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
98 | if (!hcd->regs) { | ||
99 | pr_err("%s: ioremap failed\n", __func__); | ||
100 | ret = -ENOMEM; | ||
101 | goto err_irq; | ||
102 | } | ||
103 | uhci = hcd_to_uhci(hcd); | 97 | uhci = hcd_to_uhci(hcd); |
104 | 98 | ||
105 | uhci->regs = hcd->regs; | 99 | uhci->regs = hcd->regs; |
106 | 100 | ||
107 | ret = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_SHARED); | 101 | ret = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_SHARED); |
108 | if (ret) | 102 | if (ret) |
109 | goto err_uhci; | 103 | goto err_rmr; |
110 | 104 | ||
111 | device_wakeup_enable(hcd->self.controller); | 105 | device_wakeup_enable(hcd->self.controller); |
112 | return 0; | 106 | return 0; |
113 | 107 | ||
114 | err_uhci: | ||
115 | iounmap(hcd->regs); | ||
116 | err_irq: | ||
117 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
118 | err_rmr: | 108 | err_rmr: |
119 | usb_put_hcd(hcd); | 109 | usb_put_hcd(hcd); |
120 | 110 | ||
@@ -126,8 +116,6 @@ static int uhci_hcd_platform_remove(struct platform_device *pdev) | |||
126 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 116 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
127 | 117 | ||
128 | usb_remove_hcd(hcd); | 118 | usb_remove_hcd(hcd); |
129 | iounmap(hcd->regs); | ||
130 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
131 | usb_put_hcd(hcd); | 119 | usb_put_hcd(hcd); |
132 | 120 | ||
133 | return 0; | 121 | return 0; |