pinctrl: Get rid of duplicate of_node assignment in the drivers
Subsystems (21)
PATCH 1/2 pinctrl: Get rid of duplicate of_node assignment in the drivers
GPIO library does copy the of_node from the parent device of the GPIO chip, there is no need to repeat this in the individual drivers. Remove these assignment all at once.
For the details one may look into the of_gpio_dev_init() implementation.
--- drivers/pinctrl/actions/pinctrl-owl.c | 1 - drivers/pinctrl/bcm/pinctrl-bcm2835.c | 1 - drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 1 - drivers/pinctrl/bcm/pinctrl-nsp-gpio.c | 1 - drivers/pinctrl/cirrus/pinctrl-lochnagar.c | 3 --- drivers/pinctrl/mediatek/pinctrl-moore.c | 7 +++---- drivers/pinctrl/mediatek/pinctrl-paris.c | 5 ++--- drivers/pinctrl/pinctrl-amd.c | 3 --- drivers/pinctrl/pinctrl-at91-pio4.c | 1 - drivers/pinctrl/pinctrl-at91.c | 1 - drivers/pinctrl/pinctrl-digicolor.c | 5 ++--- drivers/pinctrl/pinctrl-mcp23s08.c | 1 - drivers/pinctrl/pinctrl-ocelot.c | 1 - drivers/pinctrl/pinctrl-oxnas.c | 1 - drivers/pinctrl/pinctrl-pic32.c | 2 +- drivers/pinctrl/pinctrl-stmfx.c | 1 - drivers/pinctrl/pinctrl-sx150x.c | 3 --- drivers/pinctrl/pinctrl-xway.c | 1 - drivers/pinctrl/qcom/pinctrl-msm.c | 1 - drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c | 1 - drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c | 1 - drivers/pinctrl/renesas/pinctrl-rza2.c | 1 - drivers/pinctrl/spear/pinctrl-plgpio.c | 1 - drivers/pinctrl/vt8500/pinctrl-wmt.c | 1 - 24 files changed, 8 insertions(+), 37 deletions(-)
drivers/pinctrl/actions/pinctrl-owl.c +0 -1
@@ -874,7 +874,6 @@ static int owl_gpio_init(struct owl_pinctrl *pctrl) chip->label =dev_name (pctrl->dev); chip->parent = pctrl->dev; chip->owner =THIS_MODULE ; - chip->of_node = pctrl->dev->of_node; pctrl->irq_chip.name = chip->of_node->name; pctrl->irq_chip.irq_ack = owl_gpio_irq_ack;
drivers/pinctrl/bcm/pinctrl-bcm2835.c +0 -1
@@ -1222,7 +1222,6 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) pc->gpio_chip = *pdata->gpio_chip; pc->gpio_chip.parent = dev; - pc->gpio_chip.of_node = np;for (i =0 ; i <BCM2835_NUM_BANKS ; i++) {unsigned long events;
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +0 -1
@@ -836,7 +836,6 @@ static int iproc_gpio_probe(struct platform_device *pdev) chip->num_banks = (ngpios +NGPIOS_PER_BANK -1 ) /NGPIOS_PER_BANK ; gc->label =dev_name (dev); gc->parent = dev; - gc->of_node = dev->of_node; gc->request = iproc_gpio_request; gc->free = iproc_gpio_free; gc->direction_input = iproc_gpio_direction_input;
drivers/pinctrl/bcm/pinctrl-nsp-gpio.c +0 -1
@@ -648,7 +648,6 @@ static int nsp_gpio_probe(struct platform_device *pdev) gc->ngpio = val; gc->label =dev_name (dev); gc->parent = dev; - gc->of_node = dev->of_node; gc->request = gpiochip_generic_request; gc->free = gpiochip_generic_free; gc->direction_input = nsp_gpio_direction_input;
drivers/pinctrl/cirrus/pinctrl-lochnagar.c +0 -3
@@ -1161,9 +1161,6 @@ static int lochnagar_pin_probe(struct platform_device *pdev) priv->gpio_chip.can_sleep = true; priv->gpio_chip.parent = dev; priv->gpio_chip.base =-1 ; -#ifdef CONFIG_OF_GPIO - priv->gpio_chip.of_node = dev->of_node; -#endif switch (lochnagar->type) {case LOCHNAGAR1 :
drivers/pinctrl/mediatek/pinctrl-moore.c +3 -4
@@ -519,7 +519,7 @@ static int mtk_gpio_set_config(struct gpio_chip *chip, unsigned int offset,return mtk_eint_set_debounce (hw->eint, desc->eint.eint_n, debounce); } -static int mtk_build_gpiochip (struct mtk_pinctrl *hw,struct device_node *np) +static int mtk_build_gpiochip (struct mtk_pinctrl *hw) {struct gpio_chip *chip = &hw->chip;int ret;
@@ -536,7 +536,6 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw, struct device_node *np) chip->set_config = mtk_gpio_set_config; chip->base =-1 ; chip->ngpio = hw->soc->npins; - chip->of_node = np; chip->of_gpio_n_cells =2 ; ret =gpiochip_add_data (chip, hw);
@@ -550,7 +549,7 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw, struct device_node *np)* Documentation/devicetree/bindings/gpio/gpio.txt on how to * bind pinctrl and gpio drivers via the "gpio-ranges" property. */ -if (!of_find_property (np,"gpio-ranges" ,NULL )) { +if (!of_find_property (hw->dev->of_node,"gpio-ranges" ,NULL )) { ret =gpiochip_add_pin_range (chip,dev_name (hw->dev),0 ,0 , chip->ngpio);if (ret <0 ) {
@@ -691,7 +690,7 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev, "Failed to add EINT, but pinctrl still can work\n");/* Build gpiochip should be after pinctrl_enable is done */ - err =mtk_build_gpiochip (hw, pdev->dev.of_node); + err =mtk_build_gpiochip (hw);if (err) {dev_err (&pdev->dev,"Failed to add gpio_chip\n" );return err;
drivers/pinctrl/mediatek/pinctrl-paris.c +2 -3
@@ -895,7 +895,7 @@ static int mtk_gpio_set_config(struct gpio_chip *chip, unsigned int offset,return mtk_eint_set_debounce (hw->eint, desc->eint.eint_n, debounce); } -static int mtk_build_gpiochip (struct mtk_pinctrl *hw,struct device_node *np) +static int mtk_build_gpiochip (struct mtk_pinctrl *hw) {struct gpio_chip *chip = &hw->chip;int ret;
@@ -913,7 +913,6 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw, struct device_node *np) chip->set_config = mtk_gpio_set_config; chip->base =-1 ; chip->ngpio = hw->soc->npins; - chip->of_node = np; chip->of_gpio_n_cells =2 ; ret =gpiochip_add_data (chip, hw);
@@ -1037,7 +1036,7 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev, "Failed to add EINT, but pinctrl still can work\n");/* Build gpiochip should be after pinctrl_enable is done */ - err =mtk_build_gpiochip (hw, pdev->dev.of_node); + err =mtk_build_gpiochip (hw);if (err) {dev_err (&pdev->dev,"Failed to add gpio_chip\n" );return err;
drivers/pinctrl/pinctrl-amd.c +0 -3
@@ -1009,9 +1009,6 @@ static int amd_gpio_probe(struct platform_device *pdev) gpio_dev->gc.owner =THIS_MODULE ; gpio_dev->gc.parent = &pdev->dev; gpio_dev->gc.ngpio =resource_size (res) /4 ; -#if defined(CONFIG_OF_GPIO ) - gpio_dev->gc.of_node = pdev->dev.of_node; -#endif gpio_dev->hwbank_num = gpio_dev->gc.ngpio /64 ; gpio_dev->groups = kerncz_groups;
drivers/pinctrl/pinctrl-at91-pio4.c +0 -1
@@ -1136,7 +1136,6 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) } atmel_pioctrl->gpio_chip = &atmel_gpio_chip; - atmel_pioctrl->gpio_chip->of_node = dev->of_node; atmel_pioctrl->gpio_chip->ngpio = atmel_pioctrl->npins; atmel_pioctrl->gpio_chip->label =dev_name (dev); atmel_pioctrl->gpio_chip->parent = dev;
drivers/pinctrl/pinctrl-at91.c +0 -1
@@ -1868,7 +1868,6 @@ static int at91_gpio_probe(struct platform_device *pdev) at91_chip->chip = at91_gpio_template; chip = &at91_chip->chip; - chip->of_node = np; chip->label =dev_name (&pdev->dev); chip->parent = &pdev->dev; chip->owner =THIS_MODULE ;
drivers/pinctrl/pinctrl-digicolor.c +2 -3
@@ -233,7 +233,7 @@ static void dc_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)spin_unlock_irqrestore (&pmap->lock, flags); } -static int dc_gpiochip_add (struct dc_pinmap *pmap,struct device_node *np) +static int dc_gpiochip_add (struct dc_pinmap *pmap) {struct gpio_chip *chip = &pmap->chip;int ret;
@@ -248,7 +248,6 @@ static int dc_gpiochip_add(struct dc_pinmap *pmap, struct device_node *np) chip->set = dc_gpio_set; chip->base =-1 ; chip->ngpio =PINS_COUNT ; - chip->of_node = np; chip->of_gpio_n_cells =2 ;spin_lock_init (&pmap->lock);
@@ -326,7 +325,7 @@ static int dc_pinctrl_probe(struct platform_device *pdev)return PTR_ERR (pmap->pctl); } -return dc_gpiochip_add (pmap, pdev->dev.of_node); +return dc_gpiochip_add (pmap); }static const struct of_device_id dc_pinctrl_ids[] = {
drivers/pinctrl/pinctrl-mcp23s08.c +0 -1
@@ -551,7 +551,6 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, mcp->chip.set = mcp23s08_set;#ifdef CONFIG_OF_GPIO mcp->chip.of_gpio_n_cells =2 ; - mcp->chip.of_node = dev->of_node;#endif mcp->chip.base = base;
drivers/pinctrl/pinctrl-ocelot.c +0 -1
@@ -1748,7 +1748,6 @@ static int ocelot_gpiochip_register(struct platform_device *pdev, gc->ngpio = info->desc->npins; gc->parent = &pdev->dev; gc->base =-1 ; - gc->of_node = info->dev->of_node; gc->label ="ocelot-gpio" ; irq =irq_of_parse_and_map (gc->of_node,0 );
drivers/pinctrl/pinctrl-oxnas.c +0 -1
@@ -1232,7 +1232,6 @@ static int oxnas_gpio_probe(struct platform_device *pdev) bank->id = id; bank->gpio_chip.parent = &pdev->dev; - bank->gpio_chip.of_node = np; bank->gpio_chip.ngpio = ngpios; girq = &bank->gpio_chip.irq; girq->chip = &bank->irq_chip;
drivers/pinctrl/pinctrl-pic32.c +1 -1
@@ -2241,7 +2241,7 @@ static int pic32_gpio_probe(struct platform_device *pdev) } bank->gpio_chip.parent = &pdev->dev; - bank->gpio_chip.of_node = np; + girq = &bank->gpio_chip.irq; girq->chip = &bank->irq_chip; girq->parent_handler = pic32_gpio_irq_handler;
drivers/pinctrl/pinctrl-stmfx.c +0 -1
@@ -675,7 +675,6 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev) pctl->gpio_chip.base =-1 ; pctl->gpio_chip.ngpio = pctl->pctl_desc.npins; pctl->gpio_chip.can_sleep = true; - pctl->gpio_chip.of_node = np; pctl->irq_chip.name =dev_name (pctl->dev); pctl->irq_chip.irq_mask = stmfx_pinctrl_irq_mask;
drivers/pinctrl/pinctrl-sx150x.c +0 -3
@@ -1163,9 +1163,6 @@ static int sx150x_probe(struct i2c_client *client, pctl->gpio.set = sx150x_gpio_set; pctl->gpio.set_config = gpiochip_generic_config; pctl->gpio.parent = dev; -#ifdef CONFIG_OF_GPIO - pctl->gpio.of_node = dev->of_node; -#endif pctl->gpio.can_sleep = true; pctl->gpio.label =devm_kstrdup (dev, client->name,GFP_KERNEL );if (!pctl->gpio.label)
drivers/pinctrl/pinctrl-xway.c +0 -1
@@ -1763,7 +1763,6 @@ static int pinmux_xway_probe(struct platform_device *pdev)/* register the gpio chip */ xway_chip.parent = &pdev->dev; xway_chip.owner =THIS_MODULE ; - xway_chip.of_node = pdev->dev.of_node; ret =devm_gpiochip_add_data (&pdev->dev, &xway_chip,NULL );if (ret) {dev_err (&pdev->dev,"Failed to register gpio chip\n" );
drivers/pinctrl/qcom/pinctrl-msm.c +0 -1
@@ -1264,7 +1264,6 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) chip->label =dev_name (pctrl->dev); chip->parent = pctrl->dev; chip->owner =THIS_MODULE ; - chip->of_node = pctrl->dev->of_node;if (msm_gpio_needs_valid_mask (pctrl)) chip->init_valid_mask = msm_gpio_init_valid_mask;
drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c +0 -1
@@ -773,7 +773,6 @@ static int pm8xxx_gpio_probe(struct platform_device *pdev) pctrl->chip = pm8xxx_gpio_template; pctrl->chip.base =-1 ; pctrl->chip.parent = &pdev->dev; - pctrl->chip.of_node = pdev->dev.of_node; pctrl->chip.of_gpio_n_cells =2 ; pctrl->chip.label =dev_name (pctrl->dev); pctrl->chip.ngpio = pctrl->npins;
drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c +0 -1
@@ -857,7 +857,6 @@ static int pm8xxx_mpp_probe(struct platform_device *pdev) pctrl->chip = pm8xxx_mpp_template; pctrl->chip.base =-1 ; pctrl->chip.parent = &pdev->dev; - pctrl->chip.of_node = pdev->dev.of_node; pctrl->chip.of_gpio_n_cells =2 ; pctrl->chip.label =dev_name (pctrl->dev); pctrl->chip.ngpio = pctrl->npins;
drivers/pinctrl/renesas/pinctrl-rza2.c +0 -1
@@ -240,7 +240,6 @@ static int rza2_gpio_register(struct rza2_pinctrl_priv *priv)int ret; chip.label =devm_kasprintf (priv->dev,GFP_KERNEL ,"%pOFn" , np); - chip.of_node = np; chip.parent = priv->dev; chip.ngpio = priv->npins;
drivers/pinctrl/spear/pinctrl-plgpio.c +0 -1
@@ -581,7 +581,6 @@ static int plgpio_probe(struct platform_device *pdev) plgpio->chip.label =dev_name (&pdev->dev); plgpio->chip.parent = &pdev->dev; plgpio->chip.owner =THIS_MODULE ; - plgpio->chip.of_node = pdev->dev.of_node;if (!IS_ERR (plgpio->clk)) { ret =clk_prepare (plgpio->clk);
drivers/pinctrl/vt8500/pinctrl-wmt.c +0 -1
@@ -565,7 +565,6 @@ int wmt_pinctrl_probe(struct platform_device *pdev, data->gpio_chip = wmt_gpio_chip; data->gpio_chip.parent = &pdev->dev; - data->gpio_chip.of_node = pdev->dev.of_node; data->gpio_chip.ngpio = data->nbanks *32 ;platform_set_drvdata (pdev, data);
Signature · 1 line
2.33.0
PATCH 2/2 pinctrl: Propagate firmware node from a parent device
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.
--- drivers/pinctrl/cirrus/pinctrl-madera-core.c | 3 ++- drivers/pinctrl/pinctrl-as3722.c | 4 ++-- drivers/pinctrl/pinctrl-da9062.c | 5 ++--- drivers/pinctrl/pinctrl-max77620.c | 3 ++- drivers/pinctrl/pinctrl-rk805.c | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-)
drivers/pinctrl/cirrus/pinctrl-madera-core.c +2 -1
@@ -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 :
drivers/pinctrl/pinctrl-as3722.c +2 -2
@@ -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);
@@ -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);
drivers/pinctrl/pinctrl-da9062.c +2 -3
@@ -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 ;
@@ -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);
drivers/pinctrl/pinctrl-max77620.c +2 -1
@@ -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;
drivers/pinctrl/pinctrl-rk805.c +2 -2
@@ -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);
Signature · 1 line
2.33.0
kernel test robot
build botRe: [PATCH v1 2/2] pinctrl: Propagate firmware node from a parent device
I love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on linusw-pinctrl/devel]
[cannot apply to geert-renesas-drivers/renesas-pinctrl v5.16-rc5] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/pinctrl-Get-rid-of-duplicate-of_node-assignment-in-the-drivers/20211214-004129 base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel config: ia64-randconfig-r032-20211213 (https://download.01.org/0day-ci/archive/20211214/202112140202.rfjJQkD9-lkp(a)intel.com/config) compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/09301bc05d31cbebbea459be85ce973a065379d1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/pinctrl-Get-rid-of-duplicate-of_node-assignment-in-the-drivers/20211214-004129 git checkout 09301bc05d31cbebbea459be85ce973a065379d1
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/pinctrl/cirrus/
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
drivers/pinctrl/cirrus/pinctrl-madera-core.c: In function 'madera_pin_probe':
>> drivers/pinctrl/cirrus/pinctrl-madera-core.c:1007:37: error: implicit declaration of function 'dev_fwnode'; did you mean 'dev_of_node'? [-Werror=implicit-function-declaration]
1007 | device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));
| ^~~~~~~~~~
| dev_of_node
>> drivers/pinctrl/cirrus/pinctrl-madera-core.c:1007:37: warning: passing argument 2 of 'device_set_node' makes pointer from integer without a cast [-Wint-conversion]
1007 | device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
In file included from include/linux/platform_device.h:13,
from drivers/pinctrl/cirrus/pinctrl-madera-core.c:10:
include/linux/device.h:854:64: note: expected 'struct fwnode_handle *' but argument is of type 'int'
854 | void device_set_node(struct device *dev, struct fwnode_handle *fwnode);
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~cc1: some warnings being treated as errors
vim +1007 drivers/pinctrl/cirrus/pinctrl-madera-core.c
994
995 static int madera_pin_probe(struct platform_device *pdev)
996 {
997 struct madera *madera = dev_get_drvdata(pdev->dev.parent);
998 const struct madera_pdata *pdata = &madera->pdata;
999 struct madera_pin_private *priv;
1000 int ret;
1001
1002 BUILD_BUG_ON(ARRAY_SIZE(madera_pin_single_group_names) !=
1003 ARRAY_SIZE(madera_pin_single_group_pins));
1004
1005 dev_dbg(&pdev->dev, "%s\n", __func__);
1006
> 1007 device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));
1008
1009 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
1010 if (!priv)
1011 return -ENOMEM;
1012
1013 priv->dev = &pdev->dev;
1014 priv->madera = madera;
1015
1016 switch (madera->type) {
1017 case CS47L15:
1018 if (IS_ENABLED(CONFIG_PINCTRL_CS47L15))
1019 priv->chip = &cs47l15_pin_chip;
1020 break;
1021 case CS47L35:
1022 if (IS_ENABLED(CONFIG_PINCTRL_CS47L35))
1023 priv->chip = &cs47l35_pin_chip;
1024 break;
1025 case CS47L85:
1026 case WM1840:
1027 if (IS_ENABLED(CONFIG_PINCTRL_CS47L85))
1028 priv->chip = &cs47l85_pin_chip;
1029 break;
1030 case CS47L90:
1031 case CS47L91:
1032 if (IS_ENABLED(CONFIG_PINCTRL_CS47L90))
1033 priv->chip = &cs47l90_pin_chip;
1034 break;
1035 case CS42L92:
1036 case CS47L92:
1037 case CS47L93:
1038 if (IS_ENABLED(CONFIG_PINCTRL_CS47L92))
1039 priv->chip = &cs47l92_pin_chip;
1040 break;
1041 default:
1042 break;
1043 }
1044
1045 if (!priv->chip)
1046 return -ENODEV;
1047
1048 madera_pin_desc.npins = priv->chip->n_pins;
1049
1050 ret = devm_pinctrl_register_and_init(&pdev->dev,
1051 &madera_pin_desc,
1052 priv,
1053 &priv->pctl); 1054 if (ret) {
1055 dev_err(priv->dev, "Failed pinctrl register (%d)\n", ret);
1056 return ret;
1057 }
1058
1059 /* if the configuration is provided through pdata, apply it */
1060 if (pdata->gpio_configs) {
1061 ret = pinctrl_register_mappings(pdata->gpio_configs,
1062 pdata->n_gpio_configs);
1063 if (ret) {
1064 dev_err(priv->dev,
1065 "Failed to register pdata mappings (%d)\n",
1066 ret);
1067 return ret;
1068 }
1069 }
1070
1071 ret = pinctrl_enable(priv->pctl);
1072 if (ret) {
1073 dev_err(priv->dev, "Failed to enable pinctrl (%d)\n", ret);
1074 return ret;
1075 }
1076
1077 platform_set_drvdata(pdev, priv);
1078
1079 dev_dbg(priv->dev, "pinctrl probed ok\n");
1080
1081 return 0;
1082 }
1083
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCH v1 2/2] pinctrl: Propagate firmware node from a parent device
Quoted 25 lines · kernel test robot
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on linusw-pinctrl/devel]
[cannot apply to geert-renesas-drivers/renesas-pinctrl v5.16-rc5] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/pinctrl-Get-rid-of-duplicate-of_node-assignment-in-the-drivers/20211214-004129 base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel config: ia64-randconfig-r032-20211213 (https://download.01.org/0day-ci/archive/20211214/202112140202.rfjJQkD9-lkp(a)intel.com/config) compiler: ia64-linux-gcc (GCC) 11.2.0reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/09301bc05d31cbebbea459be85ce973a065379d1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/pinctrl-Get-rid-of-duplicate-of_node-assignment-in-the-drivers/20211214-004129 git checkout09301bc05d31cbebbea459be85ce973a065379d1
# save the config file to linux build tree
mkdirbuild_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bashdrivers/pinctrl/cirrus/
Quoted 4 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All error/warnings (new ones prefixed by >>):
Indeed. Thanks! I'll fix this in v2 after a while.
Quoted 2 lines
drivers/pinctrl/cirrus/pinctrl-madera-core.c: In function 'madera_pin_probe':Quoted 1 line
Quoted 1 line
drivers/pinctrl/cirrus/pinctrl-madera-core.c:1007:37: error: implicit declaration of function 'dev_fwnode'; did you mean 'dev_of_node'? [-Werror=implicit-function-declaration]
Nope, I meant to include property.h.
Signature · 2 lines
With Best Regards, Andy Shevchenko
kernel test robot
build botRe: [PATCH v1 2/2] pinctrl: Propagate firmware node from a parent device
In reply to Andy ShevchenkoI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on linusw-pinctrl/devel]
[cannot apply to geert-renesas-drivers/renesas-pinctrl v5.16-rc5] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/pinctrl-Get-rid-of-duplicate-of_node-assignment-in-the-drivers/20211214-004129 base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel config: hexagon-randconfig-r045-20211213 (https://download.01.org/0day-ci/archive/20211214/202112140342.nuGxXwso-lkp(a)intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2ddb6c8ac29412b1361810972e15221fa021c)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/09301bc05d31cbebbea459be85ce973a065379d1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/pinctrl-Get-rid-of-duplicate-of_node-assignment-in-the-drivers/20211214-004129 git checkout 09301bc05d31cbebbea459be85ce973a065379d1
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/pinctrl/cirrus/
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
>> drivers/pinctrl/cirrus/pinctrl-madera-core.c:1007:30: error: implicit declaration of function 'dev_fwnode' [-Werror,-Wimplicit-function-declaration]
device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));
^
drivers/pinctrl/cirrus/pinctrl-madera-core.c:1007:30: note: did you mean 'dev_of_node'?
include/linux/device.h:783:35: note: 'dev_of_node' declared here
static inline struct device_node *dev_of_node(struct device *dev)
^
>> drivers/pinctrl/cirrus/pinctrl-madera-core.c:1007:30: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct fwnode_handle *' [-Wint-conversion]
device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/device.h:854:64: note: passing argument to parameter 'fwnode' here
void device_set_node(struct device *dev, struct fwnode_handle *fwnode);
^1 warning and 1 error generated.
vim +/dev_fwnode +1007 drivers/pinctrl/cirrus/pinctrl-madera-core.c
994
995 static int madera_pin_probe(struct platform_device *pdev)
996 {
997 struct madera *madera = dev_get_drvdata(pdev->dev.parent);
998 const struct madera_pdata *pdata = &madera->pdata;
999 struct madera_pin_private *priv;
1000 int ret;
1001
1002 BUILD_BUG_ON(ARRAY_SIZE(madera_pin_single_group_names) !=
1003 ARRAY_SIZE(madera_pin_single_group_pins));
1004
1005 dev_dbg(&pdev->dev, "%s\n", __func__);
1006
> 1007 device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent));
1008
1009 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
1010 if (!priv)
1011 return -ENOMEM;
1012
1013 priv->dev = &pdev->dev;
1014 priv->madera = madera;
1015
1016 switch (madera->type) {
1017 case CS47L15:
1018 if (IS_ENABLED(CONFIG_PINCTRL_CS47L15))
1019 priv->chip = &cs47l15_pin_chip;
1020 break;
1021 case CS47L35:
1022 if (IS_ENABLED(CONFIG_PINCTRL_CS47L35))
1023 priv->chip = &cs47l35_pin_chip;
1024 break;
1025 case CS47L85:
1026 case WM1840:
1027 if (IS_ENABLED(CONFIG_PINCTRL_CS47L85))
1028 priv->chip = &cs47l85_pin_chip;
1029 break;
1030 case CS47L90:
1031 case CS47L91:
1032 if (IS_ENABLED(CONFIG_PINCTRL_CS47L90))
1033 priv->chip = &cs47l90_pin_chip;
1034 break;
1035 case CS42L92:
1036 case CS47L92:
1037 case CS47L93:
1038 if (IS_ENABLED(CONFIG_PINCTRL_CS47L92))
1039 priv->chip = &cs47l92_pin_chip;
1040 break;
1041 default:
1042 break;
1043 }
1044
1045 if (!priv->chip)
1046 return -ENODEV;
1047
1048 madera_pin_desc.npins = priv->chip->n_pins;
1049
1050 ret = devm_pinctrl_register_and_init(&pdev->dev,
1051 &madera_pin_desc,
1052 priv,
1053 &priv->pctl); 1054 if (ret) {
1055 dev_err(priv->dev, "Failed pinctrl register (%d)\n", ret);
1056 return ret;
1057 }
1058
1059 /* if the configuration is provided through pdata, apply it */
1060 if (pdata->gpio_configs) {
1061 ret = pinctrl_register_mappings(pdata->gpio_configs,
1062 pdata->n_gpio_configs);
1063 if (ret) {
1064 dev_err(priv->dev,
1065 "Failed to register pdata mappings (%d)\n",
1066 ret);
1067 return ret;
1068 }
1069 }
1070
1071 ret = pinctrl_enable(priv->pctl);
1072 if (ret) {
1073 dev_err(priv->dev, "Failed to enable pinctrl (%d)\n", ret);
1074 return ret;
1075 }
1076
1077 platform_set_drvdata(pdev, priv);
1078
1079 dev_dbg(priv->dev, "pinctrl probed ok\n");
1080
1081 return 0;
1082 }
1083
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCH v1 2/2] pinctrl: Propagate firmware node from a parent device
Quoted 3 lines · kernel test robot
Hi Andy,
I love your patch! Yet something to improve:
Yeah, I have got it from the previous mail made by bot, no need to repeat.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 9 lines · Andy Shevchenko
GPIO library does copy the
of_nodefrom the parent device of the GPIO chip, there is no need to repeat this in the individual drivers. Remove these assignment all at once.For the details one may look into the
of_gpio_dev_init()implementation.Signed-off-by Andy Shevchenko <[email protected]>drivers/pinctrl/renesas/pinctrl-rza2.c | 1 -
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 6 lines · Geert Uytterhoeven
Quoted 4 lines · Andy Shevchenko
GPIO library does copy the
of_nodefrom the parent device of the GPIO chip, there is no need to repeat this in the individual drivers. Remove these assignment all at once.
Quoted 6 lines
Quoted 3 lines
For the details one may look into the
of_gpio_dev_init()implementation.drivers/pinctrl/renesas/pinctrl-rza2.c | 1 -Reviewed-by Geert Uytterhoeven <[email protected]>Tested-by Geert Uytterhoeven <[email protected]>
Thanks, there is v2 with this patch w/o changes. I take a liberty to extrapolate the tags to it. I need to send a v3 in case Linus hasn't taken the first patch before it happens.
Signature · 2 lines
With Best Regards, Andy Shevchenko