Skip to content

Commit 63e006c

Browse files
ADESTMlinusw
authored andcommitted
pinctrl: stmfx: fix valid_mask init sequence
With stmfx_pinctrl_gpio_init_valid_mask callback, gpio_valid_mask was used to initialize gpiochip valid_mask for gpiolib. But gpio_valid_mask was not yet initialized. gpio_valid_mask required gpio-ranges to be registered, this is the case after gpiochip_add_data call. But init_valid_mask callback is also called under gpiochip_add_data. gpio_valid_mask initialization cannot be moved before gpiochip_add_data because gpio-ranges are not registered. So, it is not possible to use init_valid_mask callback. To avoid this issue, get rid of valid_mask and rely on ranges. Fixes: da9b142 ("pinctrl: stmfx: Use the callback to populate valid_mask") Signed-off-by: Amelie Delaunay <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 451a59b commit 63e006c

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

drivers/pinctrl/pinctrl-stmfx.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -585,19 +585,6 @@ static int stmfx_pinctrl_gpio_function_enable(struct stmfx_pinctrl *pctl)
585585
return stmfx_function_enable(pctl->stmfx, func);
586586
}
587587

588-
static int stmfx_pinctrl_gpio_init_valid_mask(struct gpio_chip *gc,
589-
unsigned long *valid_mask,
590-
unsigned int ngpios)
591-
{
592-
struct stmfx_pinctrl *pctl = gpiochip_get_data(gc);
593-
u32 n;
594-
595-
for_each_clear_bit(n, &pctl->gpio_valid_mask, ngpios)
596-
clear_bit(n, valid_mask);
597-
598-
return 0;
599-
}
600-
601588
static int stmfx_pinctrl_probe(struct platform_device *pdev)
602589
{
603590
struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);
@@ -660,7 +647,6 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev)
660647
pctl->gpio_chip.ngpio = pctl->pctl_desc.npins;
661648
pctl->gpio_chip.can_sleep = true;
662649
pctl->gpio_chip.of_node = np;
663-
pctl->gpio_chip.init_valid_mask = stmfx_pinctrl_gpio_init_valid_mask;
664650

665651
ret = devm_gpiochip_add_data(pctl->dev, &pctl->gpio_chip, pctl);
666652
if (ret) {

0 commit comments

Comments
 (0)