summaryrefslogtreecommitdiff
path: root/drivers/mfd/wm831x-i2c.c
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2023-10-17 15:36:02 -0500
committerLee Jones <lee@kernel.org>2023-11-01 10:02:17 +0000
commit0db434f513d5cde5420787f737c7538b21f93998 (patch)
tree0810627f37a29f062f6cbb2fbc28361fa3437fc2 /drivers/mfd/wm831x-i2c.c
parent830fafce06e6fc2e63e141799833f7c7a73cf62b (diff)
mfd: Use i2c_get_match_data() in a selection of drivers
Use preferred i2c_get_match_data() instead of of_match_device() and i2c driver_data to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> Link: https://lore.kernel.org/r/20231017203603.2700864-1-robh@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/mfd/wm831x-i2c.c')
-rw-r--r--drivers/mfd/wm831x-i2c.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/mfd/wm831x-i2c.c b/drivers/mfd/wm831x-i2c.c
index 694ddbbf0372..9bee007f9c99 100644
--- a/drivers/mfd/wm831x-i2c.c
+++ b/drivers/mfd/wm831x-i2c.c
@@ -15,7 +15,6 @@
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/mfd/wm831x/core.h>
@@ -23,22 +22,15 @@
static int wm831x_i2c_probe(struct i2c_client *i2c)
{
- const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
struct wm831x_pdata *pdata = dev_get_platdata(&i2c->dev);
- const struct of_device_id *of_id;
struct wm831x *wm831x;
enum wm831x_parent type;
int ret;
- if (i2c->dev.of_node) {
- of_id = of_match_device(wm831x_of_match, &i2c->dev);
- if (!of_id) {
- dev_err(&i2c->dev, "Failed to match device\n");
- return -ENODEV;
- }
- type = (uintptr_t)of_id->data;
- } else {
- type = (enum wm831x_parent)id->driver_data;
+ type = (uintptr_t)i2c_get_match_data(i2c);
+ if (!type) {
+ dev_err(&i2c->dev, "Failed to match device\n");
+ return -ENODEV;
}
wm831x = devm_kzalloc(&i2c->dev, sizeof(struct wm831x), GFP_KERNEL);