aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/bh1780gli.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-10-02 07:46:47 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-03 19:02:35 -0400
commitbc3426897652c05825f8fd5fc1727aac83a2d8bd (patch)
treeb1db0ce131fa9d477b57534a382b5baa2dde8b9b /drivers/misc/bh1780gli.c
parent6078e0bef2236f323377c53e77e26288fb52ee23 (diff)
misc: bh1780: probe from compatible string
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. Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/bh1780gli.c')
-rw-r--r--drivers/misc/bh1780gli.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c
index 057580e026c0..48ea33d15a79 100644
--- a/drivers/misc/bh1780gli.c
+++ b/drivers/misc/bh1780gli.c
@@ -23,6 +23,7 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/of.h>
26 27
27#define BH1780_REG_CONTROL 0x80 28#define BH1780_REG_CONTROL 0x80
28#define BH1780_REG_PARTID 0x8A 29#define BH1780_REG_PARTID 0x8A
@@ -244,6 +245,15 @@ static const struct i2c_device_id bh1780_id[] = {
244 { }, 245 { },
245}; 246};
246 247
248#ifdef CONFIG_OF
249static const struct of_device_id of_bh1780_match[] = {
250 { .compatible = "rohm,bh1780gli", },
251 {},
252};
253
254MODULE_DEVICE_TABLE(of, of_bh1780_match);
255#endif
256
247static struct i2c_driver bh1780_driver = { 257static struct i2c_driver bh1780_driver = {
248 .probe = bh1780_probe, 258 .probe = bh1780_probe,
249 .remove = bh1780_remove, 259 .remove = bh1780_remove,
@@ -251,6 +261,7 @@ static struct i2c_driver bh1780_driver = {
251 .driver = { 261 .driver = {
252 .name = "bh1780", 262 .name = "bh1780",
253 .pm = &bh1780_pm, 263 .pm = &bh1780_pm,
264 .of_match_table = of_match_ptr(of_bh1780_match),
254 }, 265 },
255}; 266};
256 267