File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515#include <linux/i2c.h>
1616#include <linux/lockdep.h>
1717#include <linux/mfd/core.h>
18+ #include <linux/mod_devicetable.h>
1819#include <linux/mutex.h>
19- #include <linux/of.h>
2020#include <linux/of_platform.h>
2121#include <linux/regmap.h>
2222
@@ -270,7 +270,6 @@ static int lochnagar_i2c_probe(struct i2c_client *i2c)
270270{
271271 struct device * dev = & i2c -> dev ;
272272 const struct lochnagar_config * config = NULL ;
273- const struct of_device_id * of_id ;
274273 struct lochnagar * lochnagar ;
275274 struct gpio_desc * reset , * present ;
276275 unsigned int val ;
@@ -282,11 +281,7 @@ static int lochnagar_i2c_probe(struct i2c_client *i2c)
282281 if (!lochnagar )
283282 return - ENOMEM ;
284283
285- of_id = of_match_device (lochnagar_of_match , dev );
286- if (!of_id )
287- return - EINVAL ;
288-
289- config = of_id -> data ;
284+ config = i2c_get_match_data (i2c );
290285
291286 lochnagar -> dev = dev ;
292287 mutex_init (& lochnagar -> analogue_config_lock );
Original file line number Diff line number Diff line change 66 */
77
88#include <linux/gpio/consumer.h>
9+ #include <linux/i2c.h>
910#include <linux/interrupt.h>
1011#include <linux/mfd/core.h>
12+ #include <linux/mod_devicetable.h>
1113#include <linux/module.h>
12- #include <linux/of_device.h>
1314#include <linux/regmap.h>
1415
1516#include <linux/mfd/lp87565.h>
@@ -46,7 +47,6 @@ MODULE_DEVICE_TABLE(of, of_lp87565_match_table);
4647static int lp87565_probe (struct i2c_client * client )
4748{
4849 struct lp87565 * lp87565 ;
49- const struct of_device_id * of_id ;
5050 int ret ;
5151 unsigned int otpid ;
5252
@@ -89,10 +89,7 @@ static int lp87565_probe(struct i2c_client *client)
8989 }
9090
9191 lp87565 -> rev = otpid & LP87565_OTP_REV_OTP_ID ;
92-
93- of_id = of_match_device (of_lp87565_match_table , & client -> dev );
94- if (of_id )
95- lp87565 -> dev_type = (uintptr_t )of_id -> data ;
92+ lp87565 -> dev_type = (uintptr_t )i2c_get_match_data (client );
9693
9794 i2c_set_clientdata (client , lp87565 );
9895
Original file line number Diff line number Diff line change 99// This driver is based on max8997.c
1010
1111#include <linux/err.h>
12+ #include <linux/i2c.h>
13+ #include <linux/mod_devicetable.h>
1214#include <linux/module.h>
1315#include <linux/interrupt.h>
14- #include <linux/of_device.h>
1516#include <linux/mfd/core.h>
1617#include <linux/mfd/max14577.h>
1718#include <linux/mfd/max14577-private.h>
@@ -357,7 +358,6 @@ static void max77836_remove(struct max14577 *max14577)
357358
358359static int max14577_i2c_probe (struct i2c_client * i2c )
359360{
360- const struct i2c_device_id * id = i2c_client_get_device_id (i2c );
361361 struct max14577 * max14577 ;
362362 struct max14577_platform_data * pdata = dev_get_platdata (& i2c -> dev );
363363 struct device_node * np = i2c -> dev .of_node ;
@@ -397,15 +397,7 @@ static int max14577_i2c_probe(struct i2c_client *i2c)
397397 return ret ;
398398 }
399399
400- if (np ) {
401- const struct of_device_id * of_id ;
402-
403- of_id = of_match_device (max14577_dt_match , & i2c -> dev );
404- if (of_id )
405- max14577 -> dev_type = (uintptr_t )of_id -> data ;
406- } else {
407- max14577 -> dev_type = id -> driver_data ;
408- }
400+ max14577 -> dev_type = (enum maxim_device_type )i2c_get_match_data (i2c );
409401
410402 max14577_print_dev_type (max14577 );
411403
Original file line number Diff line number Diff line change 1313#include <linux/mfd/core.h>
1414#include <linux/mfd/rn5t618.h>
1515#include <linux/module.h>
16- #include <linux/of_device .h>
16+ #include <linux/of .h>
1717#include <linux/platform_device.h>
1818#include <linux/reboot.h>
1919#include <linux/regmap.h>
@@ -179,22 +179,15 @@ MODULE_DEVICE_TABLE(of, rn5t618_of_match);
179179
180180static int rn5t618_i2c_probe (struct i2c_client * i2c )
181181{
182- const struct of_device_id * of_id ;
183182 struct rn5t618 * priv ;
184183 int ret ;
185184
186- of_id = of_match_device (rn5t618_of_match , & i2c -> dev );
187- if (!of_id ) {
188- dev_err (& i2c -> dev , "Failed to find matching DT ID\n" );
189- return - EINVAL ;
190- }
191-
192185 priv = devm_kzalloc (& i2c -> dev , sizeof (* priv ), GFP_KERNEL );
193186 if (!priv )
194187 return - ENOMEM ;
195188
196189 i2c_set_clientdata (i2c , priv );
197- priv -> variant = (long )of_id -> data ;
190+ priv -> variant = (long )i2c_get_match_data ( i2c ) ;
198191 priv -> irq = i2c -> irq ;
199192 priv -> dev = & i2c -> dev ;
200193
Original file line number Diff line number Diff line change 1515#include <linux/slab.h>
1616#include <linux/err.h>
1717#include <linux/of.h>
18- #include <linux/of_device.h>
1918#include <linux/regmap.h>
2019
2120#include <linux/mfd/wm831x/core.h>
2221#include <linux/mfd/wm831x/pdata.h>
2322
2423static int wm831x_i2c_probe (struct i2c_client * i2c )
2524{
26- const struct i2c_device_id * id = i2c_client_get_device_id (i2c );
2725 struct wm831x_pdata * pdata = dev_get_platdata (& i2c -> dev );
28- const struct of_device_id * of_id ;
2926 struct wm831x * wm831x ;
3027 enum wm831x_parent type ;
3128 int ret ;
3229
33- if (i2c -> dev .of_node ) {
34- of_id = of_match_device (wm831x_of_match , & i2c -> dev );
35- if (!of_id ) {
36- dev_err (& i2c -> dev , "Failed to match device\n" );
37- return - ENODEV ;
38- }
39- type = (uintptr_t )of_id -> data ;
40- } else {
41- type = (enum wm831x_parent )id -> driver_data ;
30+ type = (uintptr_t )i2c_get_match_data (i2c );
31+ if (!type ) {
32+ dev_err (& i2c -> dev , "Failed to match device\n" );
33+ return - ENODEV ;
4234 }
4335
4436 wm831x = devm_kzalloc (& i2c -> dev , sizeof (struct wm831x ), GFP_KERNEL );
Original file line number Diff line number Diff line change 1515#include <linux/delay.h>
1616#include <linux/mfd/core.h>
1717#include <linux/of.h>
18- #include <linux/of_device.h>
1918#include <linux/pm_runtime.h>
2019#include <linux/regmap.h>
2120#include <linux/regulator/consumer.h>
@@ -612,8 +611,6 @@ MODULE_DEVICE_TABLE(of, wm8994_of_match);
612611
613612static int wm8994_i2c_probe (struct i2c_client * i2c )
614613{
615- const struct i2c_device_id * id = i2c_client_get_device_id (i2c );
616- const struct of_device_id * of_id ;
617614 struct wm8994 * wm8994 ;
618615 int ret ;
619616
@@ -625,13 +622,7 @@ static int wm8994_i2c_probe(struct i2c_client *i2c)
625622 wm8994 -> dev = & i2c -> dev ;
626623 wm8994 -> irq = i2c -> irq ;
627624
628- if (i2c -> dev .of_node ) {
629- of_id = of_match_device (wm8994_of_match , & i2c -> dev );
630- if (of_id )
631- wm8994 -> type = (uintptr_t )of_id -> data ;
632- } else {
633- wm8994 -> type = id -> driver_data ;
634- }
625+ wm8994 -> type = (enum wm8994_type )i2c_get_match_data (i2c );
635626
636627 wm8994 -> regmap = devm_regmap_init_i2c (i2c , & wm8994_base_regmap_config );
637628 if (IS_ERR (wm8994 -> regmap )) {
You can’t perform that action at this time.
0 commit comments