@@ -31,22 +31,17 @@ static void swnode_format_propname(const char *con_id, char *propname,
31
31
strscpy (propname , "gpios" , max_size );
32
32
}
33
33
34
- static int swnode_gpiochip_match_name ( struct gpio_chip * chip , void * data )
34
+ static struct gpio_device * swnode_get_gpio_device ( struct fwnode_handle * fwnode )
35
35
{
36
- return !strcmp (chip -> label , data );
37
- }
38
-
39
- static struct gpio_chip * swnode_get_chip (struct fwnode_handle * fwnode )
40
- {
41
- const struct software_node * chip_node ;
42
- struct gpio_chip * chip ;
36
+ const struct software_node * gdev_node ;
37
+ struct gpio_device * gdev ;
43
38
44
- chip_node = to_software_node (fwnode );
45
- if (!chip_node || !chip_node -> name )
39
+ gdev_node = to_software_node (fwnode );
40
+ if (!gdev_node || !gdev_node -> name )
46
41
return ERR_PTR (- EINVAL );
47
42
48
- chip = gpiochip_find (( void * ) chip_node -> name , swnode_gpiochip_match_name );
49
- return chip ?: ERR_PTR (- EPROBE_DEFER );
43
+ gdev = gpio_device_find_by_label ( gdev_node -> name );
44
+ return gdev ?: ERR_PTR (- EPROBE_DEFER );
50
45
}
51
46
52
47
struct gpio_desc * swnode_find_gpio (struct fwnode_handle * fwnode ,
@@ -55,7 +50,6 @@ struct gpio_desc *swnode_find_gpio(struct fwnode_handle *fwnode,
55
50
{
56
51
const struct software_node * swnode ;
57
52
struct fwnode_reference_args args ;
58
- struct gpio_chip * chip ;
59
53
struct gpio_desc * desc ;
60
54
char propname [32 ]; /* 32 is max size of property name */
61
55
int error ;
@@ -77,12 +71,17 @@ struct gpio_desc *swnode_find_gpio(struct fwnode_handle *fwnode,
77
71
return ERR_PTR (error );
78
72
}
79
73
80
- chip = swnode_get_chip (args .fwnode );
74
+ struct gpio_device * gdev __free (gpio_device_put ) =
75
+ swnode_get_gpio_device (args .fwnode );
81
76
fwnode_handle_put (args .fwnode );
82
- if (IS_ERR (chip ))
83
- return ERR_CAST (chip );
77
+ if (IS_ERR (gdev ))
78
+ return ERR_CAST (gdev );
84
79
85
- desc = gpiochip_get_desc (chip , args .args [0 ]);
80
+ /*
81
+ * FIXME: The GPIO device reference is put at return but the descriptor
82
+ * is passed on. Find a proper solution.
83
+ */
84
+ desc = gpio_device_get_desc (gdev , args .args [0 ]);
86
85
* flags = args .args [1 ]; /* We expect native GPIO flags */
87
86
88
87
pr_debug ("%s: parsed '%s' property of node '%pfwP[%d]' - status (%d)\n" ,
0 commit comments