From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Lee Jones <lee.jones@linaro.org>, linux-kernel@vger.kernel.org
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Subject: [PATCH] sm501: Add device property
Date: Tue, 28 Jun 2016 15:59:30 +0900 [thread overview]
Message-ID: <1467097170-6087-1-git-send-email-ysato@users.sourceforge.jp> (raw)
This driver have configuration parameter "device" in platform_data.
But don't have it in devicetree.
This patch add "device" configuration to devicetree.
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
drivers/mfd/sm501.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 65cd0d2..e2e3f9b 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -21,6 +21,7 @@
#include <linux/pci.h>
#include <linux/i2c-gpio.h>
#include <linux/slab.h>
+#include <linux/of.h>
#include <linux/sm501.h>
#include <linux/sm501-regs.h>
@@ -1377,6 +1378,8 @@ static int sm501_plat_probe(struct platform_device *dev)
{
struct sm501_devdata *sm;
int ret;
+ struct sm501_platdata private_platdata;
+ struct sm501_initdata private_initdata;
sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
if (sm == NULL) {
@@ -1388,6 +1391,12 @@ static int sm501_plat_probe(struct platform_device *dev)
sm->dev = &dev->dev;
sm->pdev_id = dev->id;
sm->platdata = dev_get_platdata(&dev->dev);
+ if (!sm->platdata) {
+ of_property_read_u32(dev->dev.of_node, "smi,devices",
+ (u32 *)&private_initdata.devices);
+ private_platdata.init = &private_initdata;
+ sm->platdata = &private_platdata;
+ }
ret = platform_get_irq(dev, 0);
if (ret < 0) {
--
2.7.0
next reply other threads:[~2016-06-28 6:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-28 6:59 Yoshinori Sato [this message]
2016-06-28 7:49 ` [PATCH] sm501: Add device property Lee Jones
2016-06-28 14:32 ` Yoshinori Sato
2016-06-28 14:33 ` [PATCH v2] " Yoshinori Sato
2016-06-29 8:16 ` Lee Jones
2016-06-29 8:17 ` Lee Jones
2016-06-29 16:09 ` Yoshinori Sato
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=1467097170-6087-1-git-send-email-ysato@users.sourceforge.jp \
--to=ysato@users.sourceforge.jp \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.