9
0
Fork 0

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>
This commit is contained in:
Sascha Hauer 2015-03-05 13:59:26 +01:00
parent a55c8d806e
commit 9b133915f6
1 changed files with 9 additions and 11 deletions

View File

@ -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->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;
}
} 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->chip.ops = &imx_pwm_ops;
if (dev->device_node) {
imx->chip.devname = of_alias_get(dev->device_node);
if (!imx->chip.devname)
imx->chip.devname = asprintf("pwm_%p", imx->mmio_base);
} else {
imx->chip.devname = asprintf("pwm%d", dev->id);
}
imx->config = data->config;
imx->set_enable = data->set_enable;