summaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-02-18 11:38:58 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-03-07 08:57:56 +0100
commit3bd69ad077a955b469baa90d938fd83510297335 (patch)
tree94d314d51fd295e6cb7de9f682582c29fdd50eed /drivers/usb/host
parentfe7855bb4f2d82ac4559c46c586c2f29e9f123e2 (diff)
downloadbarebox-3bd69ad077a955b469baa90d938fd83510297335.tar.gz
barebox-3bd69ad077a955b469baa90d938fd83510297335.tar.xz
driver: replace dev_request_mem_region with dev_request_mem_resource
dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-atmel.c6
-rw-r--r--drivers/usb/host/ehci-hcd.c16
-rw-r--r--drivers/usb/host/ohci-hcd.c8
-rw-r--r--drivers/usb/host/xhci-hcd.c6
4 files changed, 26 insertions, 10 deletions
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 11b1a894e1..cc9636c4b7 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -46,6 +46,7 @@ static void atmel_stop_clock(void)
static int atmel_ehci_probe(struct device_d *dev)
{
+ struct resource *iores;
struct ehci_data data;
iclk = clk_get(dev, "ehci_clk");
@@ -67,7 +68,10 @@ static int atmel_ehci_probe(struct device_d *dev)
data.flags = 0;
- data.hccr = dev_request_mem_region(dev, 0);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ data.hccr = IOMEM(iores->start);
ehci_register(dev, &data);
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 91c6d73c30..8ea26e3591 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1334,6 +1334,7 @@ int ehci_register(struct device_d *dev, struct ehci_data *data)
static int ehci_probe(struct device_d *dev)
{
+ struct resource *iores;
struct ehci_data data = {};
struct ehci_platform_data *pdata = dev->platform_data;
struct device_node *dn = dev->device_node;
@@ -1350,12 +1351,17 @@ static int ehci_probe(struct device_d *dev)
*/
data.flags = EHCI_HAS_TT;
- data.hccr = dev_request_mem_region(dev, 0);
- if (IS_ERR(data.hccr))
- return PTR_ERR(data.hccr);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ data.hccr = IOMEM(iores->start);
- if (dev->num_resources > 1)
- data.hcor = dev_request_mem_region(dev, 1);
+ if (dev->num_resources > 1) {
+ iores = dev_request_mem_resource(dev, 1);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ data.hcor = IOMEM(iores->start);
+ }
else
data.hcor = NULL;
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 1d511b7563..612c3a1033 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1793,6 +1793,7 @@ static int ohci_init(struct usb_host *host)
static int ohci_probe(struct device_d *dev)
{
+ struct resource *iores;
struct usb_host *host;
struct ohci *ohci;
@@ -1818,9 +1819,10 @@ static int ohci_probe(struct device_d *dev)
usb_register_host(host);
- ohci->regs = dev_request_mem_region(dev, 0);
- if (IS_ERR(ohci->regs))
- return PTR_ERR(ohci->regs);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ ohci->regs = IOMEM(iores->start);
return 0;
}
diff --git a/drivers/usb/host/xhci-hcd.c b/drivers/usb/host/xhci-hcd.c
index a44a1a4dff..2b808cc875 100644
--- a/drivers/usb/host/xhci-hcd.c
+++ b/drivers/usb/host/xhci-hcd.c
@@ -1509,9 +1509,13 @@ int xhci_register(struct device_d *dev, struct xhci_data *data)
static int xhci_probe(struct device_d *dev)
{
+ struct resource *iores;
struct xhci_data data = {};
- data.regs = dev_request_mem_region(dev, 0);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ data.regs = IOMEM(iores->start);
return xhci_register(dev, &data);
}