diff options
-rw-r--r-- | drivers/usb/host/ehci-cns3xxx.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/usb/host/ehci-cns3xxx.c b/drivers/usb/host/ehci-cns3xxx.c index caaa3e5be334..d91708d2e729 100644 --- a/drivers/usb/host/ehci-cns3xxx.c +++ b/drivers/usb/host/ehci-cns3xxx.c | |||
@@ -105,27 +105,17 @@ static int cns3xxx_ehci_probe(struct platform_device *pdev) | |||
105 | hcd->rsrc_start = res->start; | 105 | hcd->rsrc_start = res->start; |
106 | hcd->rsrc_len = resource_size(res); | 106 | hcd->rsrc_len = resource_size(res); |
107 | 107 | ||
108 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, | 108 | hcd->regs = devm_request_and_ioremap(&pdev->dev, res); |
109 | driver->description)) { | ||
110 | dev_dbg(dev, "controller already in use\n"); | ||
111 | retval = -EBUSY; | ||
112 | goto err1; | ||
113 | } | ||
114 | |||
115 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
116 | if (hcd->regs == NULL) { | 109 | if (hcd->regs == NULL) { |
117 | dev_dbg(dev, "error mapping memory\n"); | 110 | dev_dbg(dev, "error mapping memory\n"); |
118 | retval = -EFAULT; | 111 | retval = -EFAULT; |
119 | goto err2; | 112 | goto err1; |
120 | } | 113 | } |
121 | 114 | ||
122 | retval = usb_add_hcd(hcd, irq, IRQF_SHARED); | 115 | retval = usb_add_hcd(hcd, irq, IRQF_SHARED); |
123 | if (retval == 0) | 116 | if (retval == 0) |
124 | return retval; | 117 | return retval; |
125 | 118 | ||
126 | iounmap(hcd->regs); | ||
127 | err2: | ||
128 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
129 | err1: | 119 | err1: |
130 | usb_put_hcd(hcd); | 120 | usb_put_hcd(hcd); |
131 | 121 | ||
@@ -137,8 +127,6 @@ static int cns3xxx_ehci_remove(struct platform_device *pdev) | |||
137 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 127 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
138 | 128 | ||
139 | usb_remove_hcd(hcd); | 129 | usb_remove_hcd(hcd); |
140 | iounmap(hcd->regs); | ||
141 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
142 | 130 | ||
143 | /* | 131 | /* |
144 | * EHCI and OHCI share the same clock and power, | 132 | * EHCI and OHCI share the same clock and power, |