Skip to content

Commit

Permalink
pinctrl: Propagate firmware node from a parent device
Browse files Browse the repository at this point in the history
When creating MFD platform devices the firmware node is left unset.
This, in particular, prevents GPIO library to use it for different
purposes. Propagate firmware node from the parent device and let
GPIO library do the right thing.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
andy-shev authored and intel-lab-lkp committed Dec 13, 2021
1 parent 1e57587 commit 09301bc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion drivers/pinctrl/cirrus/pinctrl-madera-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1004,13 +1004,14 @@ static int madera_pin_probe(struct platform_device *pdev)

dev_dbg(&pdev->dev, "%s\n", __func__);

device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));

priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;

priv->dev = &pdev->dev;
priv->madera = madera;
pdev->dev.of_node = madera->dev->of_node;

switch (madera->type) {
case CS47L15:
Expand Down
4 changes: 2 additions & 2 deletions drivers/pinctrl/pinctrl-as3722.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,13 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
struct as3722_pctrl_info *as_pci;
int ret;

device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));

as_pci = devm_kzalloc(&pdev->dev, sizeof(*as_pci), GFP_KERNEL);
if (!as_pci)
return -ENOMEM;

as_pci->dev = &pdev->dev;
as_pci->dev->of_node = pdev->dev.parent->of_node;
as_pci->as3722 = dev_get_drvdata(pdev->dev.parent);
platform_set_drvdata(pdev, as_pci);

Expand All @@ -578,7 +579,6 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)

as_pci->gpio_chip = as3722_gpio_chip;
as_pci->gpio_chip.parent = &pdev->dev;
as_pci->gpio_chip.of_node = pdev->dev.parent->of_node;
ret = gpiochip_add_data(&as_pci->gpio_chip, as_pci);
if (ret < 0) {
dev_err(&pdev->dev, "Couldn't register gpiochip, %d\n", ret);
Expand Down
5 changes: 2 additions & 3 deletions drivers/pinctrl/pinctrl-da9062.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ static int da9062_pctl_probe(struct platform_device *pdev)
struct da9062_pctl *pctl;
int i;

device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));

pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
if (!pctl)
return -ENOMEM;
Expand All @@ -277,9 +279,6 @@ static int da9062_pctl_probe(struct platform_device *pdev)
pctl->gc = reference_gc;
pctl->gc.label = dev_name(&pdev->dev);
pctl->gc.parent = &pdev->dev;
#ifdef CONFIG_OF_GPIO
pctl->gc.of_node = parent->of_node;
#endif

platform_set_drvdata(pdev, pctl);

Expand Down
3 changes: 2 additions & 1 deletion drivers/pinctrl/pinctrl-max77620.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,13 @@ static int max77620_pinctrl_probe(struct platform_device *pdev)
struct max77620_pctrl_info *mpci;
int i;

device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));

mpci = devm_kzalloc(&pdev->dev, sizeof(*mpci), GFP_KERNEL);
if (!mpci)
return -ENOMEM;

mpci->dev = &pdev->dev;
mpci->dev->of_node = pdev->dev.parent->of_node;
mpci->rmap = max77620->rmap;

mpci->pins = max77620_pins_desc;
Expand Down
4 changes: 2 additions & 2 deletions drivers/pinctrl/pinctrl-rk805.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,18 +420,18 @@ static int rk805_pinctrl_probe(struct platform_device *pdev)
struct rk805_pctrl_info *pci;
int ret;

device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));

pci = devm_kzalloc(&pdev->dev, sizeof(*pci), GFP_KERNEL);
if (!pci)
return -ENOMEM;

pci->dev = &pdev->dev;
pci->dev->of_node = pdev->dev.parent->of_node;
pci->rk808 = dev_get_drvdata(pdev->dev.parent);

pci->pinctrl_desc = rk805_pinctrl_desc;
pci->gpio_chip = rk805_gpio_chip;
pci->gpio_chip.parent = &pdev->dev;
pci->gpio_chip.of_node = pdev->dev.parent->of_node;

platform_set_drvdata(pdev, pci);

Expand Down

0 comments on commit 09301bc

Please sign in to comment.