File tree Expand file tree Collapse file tree 6 files changed +15
-55
lines changed Expand file tree Collapse file tree 6 files changed +15
-55
lines changed Original file line number Diff line number Diff line change 15
15
#include <linux/i2c.h>
16
16
#include <linux/lockdep.h>
17
17
#include <linux/mfd/core.h>
18
+ #include <linux/mod_devicetable.h>
18
19
#include <linux/mutex.h>
19
- #include <linux/of.h>
20
20
#include <linux/of_platform.h>
21
21
#include <linux/regmap.h>
22
22
@@ -270,7 +270,6 @@ static int lochnagar_i2c_probe(struct i2c_client *i2c)
270
270
{
271
271
struct device * dev = & i2c -> dev ;
272
272
const struct lochnagar_config * config = NULL ;
273
- const struct of_device_id * of_id ;
274
273
struct lochnagar * lochnagar ;
275
274
struct gpio_desc * reset , * present ;
276
275
unsigned int val ;
@@ -282,11 +281,7 @@ static int lochnagar_i2c_probe(struct i2c_client *i2c)
282
281
if (!lochnagar )
283
282
return - ENOMEM ;
284
283
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 );
290
285
291
286
lochnagar -> dev = dev ;
292
287
mutex_init (& lochnagar -> analogue_config_lock );
Original file line number Diff line number Diff line change 6
6
*/
7
7
8
8
#include <linux/gpio/consumer.h>
9
+ #include <linux/i2c.h>
9
10
#include <linux/interrupt.h>
10
11
#include <linux/mfd/core.h>
12
+ #include <linux/mod_devicetable.h>
11
13
#include <linux/module.h>
12
- #include <linux/of_device.h>
13
14
#include <linux/regmap.h>
14
15
15
16
#include <linux/mfd/lp87565.h>
@@ -46,7 +47,6 @@ MODULE_DEVICE_TABLE(of, of_lp87565_match_table);
46
47
static int lp87565_probe (struct i2c_client * client )
47
48
{
48
49
struct lp87565 * lp87565 ;
49
- const struct of_device_id * of_id ;
50
50
int ret ;
51
51
unsigned int otpid ;
52
52
@@ -89,10 +89,7 @@ static int lp87565_probe(struct i2c_client *client)
89
89
}
90
90
91
91
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 );
96
93
97
94
i2c_set_clientdata (client , lp87565 );
98
95
Original file line number Diff line number Diff line change 9
9
// This driver is based on max8997.c
10
10
11
11
#include <linux/err.h>
12
+ #include <linux/i2c.h>
13
+ #include <linux/mod_devicetable.h>
12
14
#include <linux/module.h>
13
15
#include <linux/interrupt.h>
14
- #include <linux/of_device.h>
15
16
#include <linux/mfd/core.h>
16
17
#include <linux/mfd/max14577.h>
17
18
#include <linux/mfd/max14577-private.h>
@@ -357,7 +358,6 @@ static void max77836_remove(struct max14577 *max14577)
357
358
358
359
static int max14577_i2c_probe (struct i2c_client * i2c )
359
360
{
360
- const struct i2c_device_id * id = i2c_client_get_device_id (i2c );
361
361
struct max14577 * max14577 ;
362
362
struct max14577_platform_data * pdata = dev_get_platdata (& i2c -> dev );
363
363
struct device_node * np = i2c -> dev .of_node ;
@@ -397,15 +397,7 @@ static int max14577_i2c_probe(struct i2c_client *i2c)
397
397
return ret ;
398
398
}
399
399
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 );
409
401
410
402
max14577_print_dev_type (max14577 );
411
403
Original file line number Diff line number Diff line change 13
13
#include <linux/mfd/core.h>
14
14
#include <linux/mfd/rn5t618.h>
15
15
#include <linux/module.h>
16
- #include <linux/of_device .h>
16
+ #include <linux/of .h>
17
17
#include <linux/platform_device.h>
18
18
#include <linux/reboot.h>
19
19
#include <linux/regmap.h>
@@ -179,22 +179,15 @@ MODULE_DEVICE_TABLE(of, rn5t618_of_match);
179
179
180
180
static int rn5t618_i2c_probe (struct i2c_client * i2c )
181
181
{
182
- const struct of_device_id * of_id ;
183
182
struct rn5t618 * priv ;
184
183
int ret ;
185
184
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
-
192
185
priv = devm_kzalloc (& i2c -> dev , sizeof (* priv ), GFP_KERNEL );
193
186
if (!priv )
194
187
return - ENOMEM ;
195
188
196
189
i2c_set_clientdata (i2c , priv );
197
- priv -> variant = (long )of_id -> data ;
190
+ priv -> variant = (long )i2c_get_match_data ( i2c ) ;
198
191
priv -> irq = i2c -> irq ;
199
192
priv -> dev = & i2c -> dev ;
200
193
Original file line number Diff line number Diff line change 15
15
#include <linux/slab.h>
16
16
#include <linux/err.h>
17
17
#include <linux/of.h>
18
- #include <linux/of_device.h>
19
18
#include <linux/regmap.h>
20
19
21
20
#include <linux/mfd/wm831x/core.h>
22
21
#include <linux/mfd/wm831x/pdata.h>
23
22
24
23
static int wm831x_i2c_probe (struct i2c_client * i2c )
25
24
{
26
- const struct i2c_device_id * id = i2c_client_get_device_id (i2c );
27
25
struct wm831x_pdata * pdata = dev_get_platdata (& i2c -> dev );
28
- const struct of_device_id * of_id ;
29
26
struct wm831x * wm831x ;
30
27
enum wm831x_parent type ;
31
28
int ret ;
32
29
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 ;
42
34
}
43
35
44
36
wm831x = devm_kzalloc (& i2c -> dev , sizeof (struct wm831x ), GFP_KERNEL );
Original file line number Diff line number Diff line change 15
15
#include <linux/delay.h>
16
16
#include <linux/mfd/core.h>
17
17
#include <linux/of.h>
18
- #include <linux/of_device.h>
19
18
#include <linux/pm_runtime.h>
20
19
#include <linux/regmap.h>
21
20
#include <linux/regulator/consumer.h>
@@ -612,8 +611,6 @@ MODULE_DEVICE_TABLE(of, wm8994_of_match);
612
611
613
612
static int wm8994_i2c_probe (struct i2c_client * i2c )
614
613
{
615
- const struct i2c_device_id * id = i2c_client_get_device_id (i2c );
616
- const struct of_device_id * of_id ;
617
614
struct wm8994 * wm8994 ;
618
615
int ret ;
619
616
@@ -625,13 +622,7 @@ static int wm8994_i2c_probe(struct i2c_client *i2c)
625
622
wm8994 -> dev = & i2c -> dev ;
626
623
wm8994 -> irq = i2c -> irq ;
627
624
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 );
635
626
636
627
wm8994 -> regmap = devm_regmap_init_i2c (i2c , & wm8994_base_regmap_config );
637
628
if (IS_ERR (wm8994 -> regmap )) {
You can’t perform that action at this time.
0 commit comments