summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-03-05 13:59:26 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-09 06:34:20 +0100
commit9b133915f6fb96d917e63f50a465242fe1ccae56 (patch)
tree6285df2d2472c470f619fd669a04689d4e68303d
parenta55c8d806eccac6ca29e4c8e2aa33379aedfea3e (diff)
downloadbarebox-9b133915f6fb96d917e63f50a465242fe1ccae56.tar.gz
PWM: i.MX: register successfully without alias
When a PWM does not have an of alias generate a name from the base address so that we can register it successfully. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/pwm/pwm-imx.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index fbfc3af..b00bf7e 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -226,21 +226,19 @@ static int imx_pwm_probe(struct device_d *dev)
if (IS_ERR(imx->clk_per))
return PTR_ERR(imx->clk_per);
+ imx->mmio_base = dev_request_mem_region(dev, 0);
+ if (IS_ERR(imx->mmio_base))
+ return PTR_ERR(imx->mmio_base);
+
imx->chip.ops = &imx_pwm_ops;
if (dev->device_node) {
imx->chip.devname = of_alias_get(dev->device_node);
- if (!imx->chip.devname) {
- dev_err(dev, "no alias for pwm\n");
- return -EINVAL;
- }
+ if (!imx->chip.devname)
+ imx->chip.devname = asprintf("pwm_%p", imx->mmio_base);
} else {
imx->chip.devname = asprintf("pwm%d", dev->id);
}
- imx->mmio_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(imx->mmio_base))
- return PTR_ERR(imx->mmio_base);
-
imx->config = data->config;
imx->set_enable = data->set_enable;