From: Javier Martinez Canillas <javier@osg.samsung.com>
To: linux-kernel@vger.kernel.org
Cc: Javier Martinez Canillas <javier@osg.samsung.com>,
Sebastian Reichel <sre@kernel.org>,
linux-pm@vger.kernel.org
Subject: [PATCH v3 2/2] power: supply: max17040: Add OF device ID table
Date: Wed, 15 Mar 2017 00:43:49 -0300 [thread overview]
Message-ID: <20170315034349.8494-2-javier@osg.samsung.com> (raw)
In-Reply-To: <20170315034349.8494-1-javier@osg.samsung.com>
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
Changes in v3:
- Don't use of_match_ptr() to avoid build warning when CONFIG_OF is disabled.
Changes in v2: None
drivers/power/supply/max17040_battery.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
index e7c3649b31a0..33c40f79d23d 100644
--- a/drivers/power/supply/max17040_battery.c
+++ b/drivers/power/supply/max17040_battery.c
@@ -277,9 +277,17 @@ static const struct i2c_device_id max17040_id[] = {
};
MODULE_DEVICE_TABLE(i2c, max17040_id);
+static const struct of_device_id max17040_of_match[] = {
+ { .compatible = "maxim,max17040" },
+ { .compatible = "maxim,max77836-battery" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, max17040_of_match);
+
static struct i2c_driver max17040_i2c_driver = {
.driver = {
.name = "max17040",
+ .of_match_table = max17040_of_match,
.pm = MAX17040_PM_OPS,
},
.probe = max17040_probe,
--
2.9.3
next prev parent reply other threads:[~2017-03-15 3:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-15 3:43 [PATCH v3 1/2] power: supply: ltc2941-battery-gauge: Add OF device ID table Javier Martinez Canillas
2017-03-15 3:43 ` Javier Martinez Canillas [this message]
2017-03-15 20:50 ` [PATCH v3 2/2] power: supply: max17040: " Sebastian Reichel
2017-03-15 20:55 ` [PATCH v3 1/2] power: supply: ltc2941-battery-gauge: " Sebastian Reichel
2017-03-15 20:59 ` Javier Martinez Canillas
2017-03-15 21:10 ` Sebastian Reichel
2017-03-15 21:25 ` Javier Martinez Canillas
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=20170315034349.8494-2-javier@osg.samsung.com \
--to=javier@osg.samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@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.