Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc342689 authored by Linus Walleij's avatar Linus Walleij Committed by Greg Kroah-Hartman
Browse files

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: default avatarWolfram Sang <wsa@the-dreams.de>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6078e0be
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/of.h>


#define BH1780_REG_CONTROL	0x80
#define BH1780_REG_CONTROL	0x80
#define BH1780_REG_PARTID	0x8A
#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 = {
static struct i2c_driver bh1780_driver = {
	.probe		= bh1780_probe,
	.probe		= bh1780_probe,
	.remove		= bh1780_remove,
	.remove		= bh1780_remove,
@@ -251,6 +261,7 @@ static struct i2c_driver bh1780_driver = {
	.driver = {
	.driver = {
		.name = "bh1780",
		.name = "bh1780",
		.pm	= &bh1780_pm,
		.pm	= &bh1780_pm,
		.of_match_table = of_match_ptr(of_bh1780_match),
	},
	},
};
};