* [PATCH] misc: bh1780: probe from compatible string
@ 2013-10-02 11:46 Linus Walleij
2013-10-02 11:57 ` Wolfram Sang
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2013-10-02 11:46 UTC (permalink / raw)
To: linux-kernel, Greg Kroah-Hartman, Arnd Bergmann
Cc: Linus Walleij, Wolfram Sang
Currently the BH1780GLI I2C driver relies on the device tree node
having the right name, but this is fragile. Use the compatible
string to probe the driver instead.
Cc: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/misc/bh1780gli.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c
index 057580e..48ea33d 100644
--- a/drivers/misc/bh1780gli.c
+++ b/drivers/misc/bh1780gli.c
@@ -23,6 +23,7 @@
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/module.h>
+#include <linux/of.h>
#define BH1780_REG_CONTROL 0x80
#define BH1780_REG_PARTID 0x8A
@@ -244,6 +245,15 @@ static const struct i2c_device_id bh1780_id[] = {
{ },
};
+#ifdef CONFIG_OF
+static const struct of_device_id of_bh1780_match[] = {
+ { .compatible = "rohm,bh1780gli", },
+ {},
+};
+
+MODULE_DEVICE_TABLE(of, of_bh1780_match);
+#endif
+
static struct i2c_driver bh1780_driver = {
.probe = bh1780_probe,
.remove = bh1780_remove,
@@ -251,6 +261,7 @@ static struct i2c_driver bh1780_driver = {
.driver = {
.name = "bh1780",
.pm = &bh1780_pm,
+ .of_match_table = of_match_ptr(of_bh1780_match),
},
};
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] misc: bh1780: probe from compatible string
2013-10-02 11:46 [PATCH] misc: bh1780: probe from compatible string Linus Walleij
@ 2013-10-02 11:57 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2013-10-02 11:57 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-kernel, Greg Kroah-Hartman, Arnd Bergmann
[-- Attachment #1: Type: text/plain, Size: 389 bytes --]
On Wed, Oct 02, 2013 at 01:46:47PM +0200, Linus Walleij wrote:
> Currently the BH1780GLI I2C driver relies on the device tree node
> having the right name, but this is fragile. Use the compatible
> string to probe the driver instead.
>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-02 11:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-02 11:46 [PATCH] misc: bh1780: probe from compatible string Linus Walleij
2013-10-02 11:57 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox