From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] PWM: i.MX: register successfully without alias
Date: Thu, 5 Mar 2015 15:18:01 +0100 [thread overview]
Message-ID: <1425565081-9515-1-git-send-email-s.hauer@pengutronix.de> (raw)
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>
---
drivers/pwm/pwm-imx.c | 14 ++++++--------
1 file 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;
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2015-03-05 14:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425565081-9515-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox