@@ -127,10 +127,10 @@ static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, void *data)
127
127
chip -> of_xlate (chip , gpiospec , NULL ) >= 0 ;
128
128
}
129
129
130
- static struct gpio_chip * of_find_gpiochip_by_xlate (
131
- struct of_phandle_args * gpiospec )
130
+ static struct gpio_device *
131
+ of_find_gpio_device_by_xlate ( struct of_phandle_args * gpiospec )
132
132
{
133
- return gpiochip_find (gpiospec , of_gpiochip_match_node_and_xlate );
133
+ return gpio_device_find (gpiospec , of_gpiochip_match_node_and_xlate );
134
134
}
135
135
136
136
static struct gpio_desc * of_xlate_and_get_gpiod_flags (struct gpio_chip * chip ,
@@ -372,7 +372,6 @@ static struct gpio_desc *of_get_named_gpiod_flags(const struct device_node *np,
372
372
const char * propname , int index , enum of_gpio_flags * flags )
373
373
{
374
374
struct of_phandle_args gpiospec ;
375
- struct gpio_chip * chip ;
376
375
struct gpio_desc * desc ;
377
376
int ret ;
378
377
@@ -384,13 +383,15 @@ static struct gpio_desc *of_get_named_gpiod_flags(const struct device_node *np,
384
383
return ERR_PTR (ret );
385
384
}
386
385
387
- chip = of_find_gpiochip_by_xlate (& gpiospec );
388
- if (!chip ) {
386
+ struct gpio_device * gdev __free (gpio_device_put ) =
387
+ of_find_gpio_device_by_xlate (& gpiospec );
388
+ if (!gdev ) {
389
389
desc = ERR_PTR (- EPROBE_DEFER );
390
390
goto out ;
391
391
}
392
392
393
- desc = of_xlate_and_get_gpiod_flags (chip , & gpiospec , flags );
393
+ desc = of_xlate_and_get_gpiod_flags (gpio_device_get_chip (gdev ),
394
+ & gpiospec , flags );
394
395
if (IS_ERR (desc ))
395
396
goto out ;
396
397
@@ -850,16 +851,16 @@ static int of_gpiochip_match_node(struct gpio_chip *chip, void *data)
850
851
return device_match_of_node (& chip -> gpiodev -> dev , data );
851
852
}
852
853
853
- static struct gpio_chip * of_find_gpiochip_by_node (struct device_node * np )
854
+ static struct gpio_device * of_find_gpio_device_by_node (struct device_node * np )
854
855
{
855
- return gpiochip_find (np , of_gpiochip_match_node );
856
+ return gpio_device_find (np , of_gpiochip_match_node );
856
857
}
857
858
858
859
static int of_gpio_notify (struct notifier_block * nb , unsigned long action ,
859
860
void * arg )
860
861
{
862
+ struct gpio_device * gdev __free (gpio_device_put ) = NULL ;
861
863
struct of_reconfig_data * rd = arg ;
862
- struct gpio_chip * chip ;
863
864
int ret ;
864
865
865
866
/*
@@ -876,11 +877,11 @@ static int of_gpio_notify(struct notifier_block *nb, unsigned long action,
876
877
if (of_node_test_and_set_flag (rd -> dn , OF_POPULATED ))
877
878
return NOTIFY_DONE ;
878
879
879
- chip = of_find_gpiochip_by_node (rd -> dn -> parent );
880
- if (chip == NULL )
880
+ gdev = of_find_gpio_device_by_node (rd -> dn -> parent );
881
+ if (! gdev )
881
882
return NOTIFY_DONE ; /* not for us */
882
883
883
- ret = of_gpiochip_add_hog (chip , rd -> dn );
884
+ ret = of_gpiochip_add_hog (gpio_device_get_chip ( gdev ) , rd -> dn );
884
885
if (ret < 0 ) {
885
886
pr_err ("%s: failed to add hogs for %pOF\n" , __func__ ,
886
887
rd -> dn );
@@ -893,11 +894,11 @@ static int of_gpio_notify(struct notifier_block *nb, unsigned long action,
893
894
if (!of_node_check_flag (rd -> dn , OF_POPULATED ))
894
895
return NOTIFY_DONE ; /* already depopulated */
895
896
896
- chip = of_find_gpiochip_by_node (rd -> dn -> parent );
897
- if (chip == NULL )
897
+ gdev = of_find_gpio_device_by_node (rd -> dn -> parent );
898
+ if (! gdev )
898
899
return NOTIFY_DONE ; /* not for us */
899
900
900
- of_gpiochip_remove_hog (chip , rd -> dn );
901
+ of_gpiochip_remove_hog (gpio_device_get_chip ( gdev ) , rd -> dn );
901
902
of_node_clear_flag (rd -> dn , OF_POPULATED );
902
903
return NOTIFY_OK ;
903
904
}
0 commit comments