dirvers/pinctrl.c : using pinctrl_dev->dev to obtain struct device * dev

Message ID 20230508154043.11859-1-sensor1010@163.com
State New
Headers
Series dirvers/pinctrl.c : using pinctrl_dev->dev to obtain struct device * dev |

Commit Message

Lizhe May 8, 2023, 3:40 p.m. UTC
  After the execution of the devm_pinctrl_register() function,
the member 'dev' in the 'pinctrl_dev' points to the
'struct device' structure. see pinctrl_init_controller().

Signed-off-by: Lizhe <sensor1010@163.com>
---
 drivers/pinctrl/pinctrl-apple-gpio.c |  2 +-
 drivers/pinctrl/pinctrl-oxnas.c      | 12 ++++++------
 drivers/pinctrl/pinctrl-pic32.c      | 12 ++++++------
 drivers/pinctrl/pinctrl-stmfx.c      |  6 +++---
 drivers/pinctrl/pxa/pinctrl-pxa2xx.c |  4 ++--
 5 files changed, 18 insertions(+), 18 deletions(-)
  

Comments

kernel test robot May 8, 2023, 9:19 p.m. UTC | #1
Hi Lizhe,

kernel test robot noticed the following build errors:

[auto build test ERROR on linusw-pinctrl/devel]
[also build test ERROR on linusw-pinctrl/for-next linus/master v6.4-rc1 next-20230508]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lizhe/dirvers-pinctrl-c-using-pinctrl_dev-dev-to-obtain-struct-device-dev/20230508-234502
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
patch link:    https://lore.kernel.org/r/20230508154043.11859-1-sensor1010%40163.com
patch subject: [PATCH] dirvers/pinctrl.c : using pinctrl_dev->dev to obtain struct device * dev
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230509/202305090411.OyJRHVis-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/83751a28d7f5223597b6742300796fb80362dc20
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Lizhe/dirvers-pinctrl-c-using-pinctrl_dev-dev-to-obtain-struct-device-dev/20230508-234502
        git checkout 83751a28d7f5223597b6742300796fb80362dc20
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305090411.OyJRHVis-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
                    from include/linux/platform_device.h:13,
                    from drivers/pinctrl/pinctrl-stmfx.c:12:
   drivers/pinctrl/pinctrl-stmfx.c: In function 'stmfx_pinctrl_probe':
>> drivers/pinctrl/pinctrl-stmfx.c:714:25: error: 'pctldev' undeclared (first use in this function); did you mean 'pci_dev'?
     714 |                 dev_err(pctldev->dev, "gpio_chip registration failed\n");
         |                         ^~~~~~~
   include/linux/dev_printk.h:110:25: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                         ^~~
   drivers/pinctrl/pinctrl-stmfx.c:714:17: note: in expansion of macro 'dev_err'
     714 |                 dev_err(pctldev->dev, "gpio_chip registration failed\n");
         |                 ^~~~~~~
   drivers/pinctrl/pinctrl-stmfx.c:714:25: note: each undeclared identifier is reported only once for each function it appears in
     714 |                 dev_err(pctldev->dev, "gpio_chip registration failed\n");
         |                         ^~~~~~~
   include/linux/dev_printk.h:110:25: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                         ^~~
   drivers/pinctrl/pinctrl-stmfx.c:714:17: note: in expansion of macro 'dev_err'
     714 |                 dev_err(pctldev->dev, "gpio_chip registration failed\n");
         |                 ^~~~~~~
--
   In file included from include/linux/printk.h:564,
                    from include/asm-generic/bug.h:22,
                    from arch/m68k/include/asm/bug.h:32,
                    from include/linux/bug.h:5,
                    from include/linux/io.h:11,
                    from drivers/pinctrl/pxa/pinctrl-pxa2xx.c:9:
   drivers/pinctrl/pxa/pinctrl-pxa2xx.c: In function 'pxa2xx_pmx_gpio_set_direction':
>> drivers/pinctrl/pxa/pinctrl-pxa2xx.c:94:24: error: invalid use of undefined type 'struct pinctrl_dev'
      94 |         dev_dbg(pctldev->dev, "set_direction(pin=%d): dir=%d\n",
         |                        ^~
   include/linux/dynamic_debug.h:222:29: note: in definition of macro '__dynamic_func_call_cls'
     222 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:248:9: note: in expansion of macro '_dynamic_func_call_cls'
     248 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:271:9: note: in expansion of macro '_dynamic_func_call'
     271 |         _dynamic_func_call(fmt, __dynamic_dev_dbg,              \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
     155 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~
   drivers/pinctrl/pxa/pinctrl-pxa2xx.c:94:9: note: in expansion of macro 'dev_dbg'
      94 |         dev_dbg(pctldev->dev, "set_direction(pin=%d): dir=%d\n",
         |         ^~~~~~~
   drivers/pinctrl/pxa/pinctrl-pxa2xx.c: In function 'pxa2xx_pmx_set_mux':
   drivers/pinctrl/pxa/pinctrl-pxa2xx.c:159:24: error: invalid use of undefined type 'struct pinctrl_dev'
     159 |         dev_dbg(pctldev->dev, "set_mux(pin=%d): af=%d dir=%d\n",
         |                        ^~
   include/linux/dynamic_debug.h:222:29: note: in definition of macro '__dynamic_func_call_cls'
     222 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:248:9: note: in expansion of macro '_dynamic_func_call_cls'
     248 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:271:9: note: in expansion of macro '_dynamic_func_call'
     271 |         _dynamic_func_call(fmt, __dynamic_dev_dbg,              \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
     155 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~
   drivers/pinctrl/pxa/pinctrl-pxa2xx.c:159:9: note: in expansion of macro 'dev_dbg'
     159 |         dev_dbg(pctldev->dev, "set_mux(pin=%d): af=%d dir=%d\n",
         |         ^~~~~~~


vim +714 drivers/pinctrl/pinctrl-stmfx.c

   638	
   639	static int stmfx_pinctrl_probe(struct platform_device *pdev)
   640	{
   641		struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);
   642		struct device_node *np = pdev->dev.of_node;
   643		struct stmfx_pinctrl *pctl;
   644		struct gpio_irq_chip *girq;
   645		int irq, ret;
   646	
   647		pctl = devm_kzalloc(stmfx->dev, sizeof(*pctl), GFP_KERNEL);
   648		if (!pctl)
   649			return -ENOMEM;
   650	
   651		platform_set_drvdata(pdev, pctl);
   652	
   653		pctl->dev = &pdev->dev;
   654		pctl->stmfx = stmfx;
   655	
   656		if (!of_property_present(np, "gpio-ranges")) {
   657			dev_err(pctl->dev, "missing required gpio-ranges property\n");
   658			return -EINVAL;
   659		}
   660	
   661		irq = platform_get_irq(pdev, 0);
   662		if (irq <= 0)
   663			return -ENXIO;
   664	
   665		mutex_init(&pctl->lock);
   666	
   667		/* Register pin controller */
   668		pctl->pctl_desc.name = "stmfx-pinctrl";
   669		pctl->pctl_desc.pctlops = &stmfx_pinctrl_ops;
   670		pctl->pctl_desc.confops = &stmfx_pinconf_ops;
   671		pctl->pctl_desc.pins = stmfx_pins;
   672		pctl->pctl_desc.npins = ARRAY_SIZE(stmfx_pins);
   673		pctl->pctl_desc.owner = THIS_MODULE;
   674		pctl->pctl_desc.link_consumers = true;
   675	
   676		ret = devm_pinctrl_register_and_init(pctl->dev, &pctl->pctl_desc,
   677						     pctl, &pctl->pctl_dev);
   678		if (ret) {
   679			dev_err(pctl->dev, "pinctrl registration failed\n");
   680			return ret;
   681		}
   682	
   683		ret = pinctrl_enable(pctl->pctl_dev);
   684		if (ret) {
   685			dev_err(pctl->dev, "pinctrl enable failed\n");
   686			return ret;
   687		}
   688	
   689		/* Register gpio controller */
   690		pctl->gpio_chip.label = "stmfx-gpio";
   691		pctl->gpio_chip.parent = pctl->dev;
   692		pctl->gpio_chip.get_direction = stmfx_gpio_get_direction;
   693		pctl->gpio_chip.direction_input = stmfx_gpio_direction_input;
   694		pctl->gpio_chip.direction_output = stmfx_gpio_direction_output;
   695		pctl->gpio_chip.get = stmfx_gpio_get;
   696		pctl->gpio_chip.set = stmfx_gpio_set;
   697		pctl->gpio_chip.set_config = gpiochip_generic_config;
   698		pctl->gpio_chip.base = -1;
   699		pctl->gpio_chip.ngpio = pctl->pctl_desc.npins;
   700		pctl->gpio_chip.can_sleep = true;
   701	
   702		girq = &pctl->gpio_chip.irq;
   703		gpio_irq_chip_set_chip(girq, &stmfx_pinctrl_irq_chip);
   704		/* This will let us handle the parent IRQ in the driver */
   705		girq->parent_handler = NULL;
   706		girq->num_parents = 0;
   707		girq->parents = NULL;
   708		girq->default_type = IRQ_TYPE_NONE;
   709		girq->handler = handle_bad_irq;
   710		girq->threaded = true;
   711	
   712		ret = devm_gpiochip_add_data(pctl->dev, &pctl->gpio_chip, pctl);
   713		if (ret) {
 > 714			dev_err(pctldev->dev, "gpio_chip registration failed\n");
   715			return ret;
   716		}
   717	
   718		ret = stmfx_pinctrl_gpio_function_enable(pctl);
   719		if (ret)
   720			return ret;
   721	
   722		ret = devm_request_threaded_irq(pctl->dev, irq, NULL,
   723						stmfx_pinctrl_irq_thread_fn,
   724						IRQF_ONESHOT,
   725						dev_name(pctl->dev), pctl);
   726		if (ret) {
   727			dev_err(pctldev->dev, "cannot request irq%d\n", irq);
   728			return ret;
   729		}
   730	
   731		dev_info(pctldev->dev,
   732			 "%ld GPIOs available\n", hweight_long(pctl->gpio_valid_mask));
   733	
   734		return 0;
   735	}
   736
  
kernel test robot May 9, 2023, 10:59 a.m. UTC | #2
Hi Lizhe,

kernel test robot noticed the following build errors:

[auto build test ERROR on linusw-pinctrl/devel]
[also build test ERROR on linusw-pinctrl/for-next linus/master v6.4-rc1 next-20230509]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lizhe/dirvers-pinctrl-c-using-pinctrl_dev-dev-to-obtain-struct-device-dev/20230508-234502
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
patch link:    https://lore.kernel.org/r/20230508154043.11859-1-sensor1010%40163.com
patch subject: [PATCH] dirvers/pinctrl.c : using pinctrl_dev->dev to obtain struct device * dev
config: i386-randconfig-a001-20230508 (https://download.01.org/0day-ci/archive/20230509/202305091858.pJaUy3Gt-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/intel-lab-lkp/linux/commit/83751a28d7f5223597b6742300796fb80362dc20
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Lizhe/dirvers-pinctrl-c-using-pinctrl_dev-dev-to-obtain-struct-device-dev/20230508-234502
        git checkout 83751a28d7f5223597b6742300796fb80362dc20
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305091858.pJaUy3Gt-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/pinctrl/pinctrl-stmfx.c:714:11: error: use of undeclared identifier 'pctldev'
                   dev_err(pctldev->dev, "gpio_chip registration failed\n");
                           ^
   drivers/pinctrl/pinctrl-stmfx.c:727:11: error: use of undeclared identifier 'pctldev'
                   dev_err(pctldev->dev, "cannot request irq%d\n", irq);
                           ^
   drivers/pinctrl/pinctrl-stmfx.c:731:11: error: use of undeclared identifier 'pctldev'
           dev_info(pctldev->dev,
                    ^
   3 errors generated.


vim +/pctldev +714 drivers/pinctrl/pinctrl-stmfx.c

   638	
   639	static int stmfx_pinctrl_probe(struct platform_device *pdev)
   640	{
   641		struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);
   642		struct device_node *np = pdev->dev.of_node;
   643		struct stmfx_pinctrl *pctl;
   644		struct gpio_irq_chip *girq;
   645		int irq, ret;
   646	
   647		pctl = devm_kzalloc(stmfx->dev, sizeof(*pctl), GFP_KERNEL);
   648		if (!pctl)
   649			return -ENOMEM;
   650	
   651		platform_set_drvdata(pdev, pctl);
   652	
   653		pctl->dev = &pdev->dev;
   654		pctl->stmfx = stmfx;
   655	
   656		if (!of_property_present(np, "gpio-ranges")) {
   657			dev_err(pctl->dev, "missing required gpio-ranges property\n");
   658			return -EINVAL;
   659		}
   660	
   661		irq = platform_get_irq(pdev, 0);
   662		if (irq <= 0)
   663			return -ENXIO;
   664	
   665		mutex_init(&pctl->lock);
   666	
   667		/* Register pin controller */
   668		pctl->pctl_desc.name = "stmfx-pinctrl";
   669		pctl->pctl_desc.pctlops = &stmfx_pinctrl_ops;
   670		pctl->pctl_desc.confops = &stmfx_pinconf_ops;
   671		pctl->pctl_desc.pins = stmfx_pins;
   672		pctl->pctl_desc.npins = ARRAY_SIZE(stmfx_pins);
   673		pctl->pctl_desc.owner = THIS_MODULE;
   674		pctl->pctl_desc.link_consumers = true;
   675	
   676		ret = devm_pinctrl_register_and_init(pctl->dev, &pctl->pctl_desc,
   677						     pctl, &pctl->pctl_dev);
   678		if (ret) {
   679			dev_err(pctl->dev, "pinctrl registration failed\n");
   680			return ret;
   681		}
   682	
   683		ret = pinctrl_enable(pctl->pctl_dev);
   684		if (ret) {
   685			dev_err(pctl->dev, "pinctrl enable failed\n");
   686			return ret;
   687		}
   688	
   689		/* Register gpio controller */
   690		pctl->gpio_chip.label = "stmfx-gpio";
   691		pctl->gpio_chip.parent = pctl->dev;
   692		pctl->gpio_chip.get_direction = stmfx_gpio_get_direction;
   693		pctl->gpio_chip.direction_input = stmfx_gpio_direction_input;
   694		pctl->gpio_chip.direction_output = stmfx_gpio_direction_output;
   695		pctl->gpio_chip.get = stmfx_gpio_get;
   696		pctl->gpio_chip.set = stmfx_gpio_set;
   697		pctl->gpio_chip.set_config = gpiochip_generic_config;
   698		pctl->gpio_chip.base = -1;
   699		pctl->gpio_chip.ngpio = pctl->pctl_desc.npins;
   700		pctl->gpio_chip.can_sleep = true;
   701	
   702		girq = &pctl->gpio_chip.irq;
   703		gpio_irq_chip_set_chip(girq, &stmfx_pinctrl_irq_chip);
   704		/* This will let us handle the parent IRQ in the driver */
   705		girq->parent_handler = NULL;
   706		girq->num_parents = 0;
   707		girq->parents = NULL;
   708		girq->default_type = IRQ_TYPE_NONE;
   709		girq->handler = handle_bad_irq;
   710		girq->threaded = true;
   711	
   712		ret = devm_gpiochip_add_data(pctl->dev, &pctl->gpio_chip, pctl);
   713		if (ret) {
 > 714			dev_err(pctldev->dev, "gpio_chip registration failed\n");
   715			return ret;
   716		}
   717	
   718		ret = stmfx_pinctrl_gpio_function_enable(pctl);
   719		if (ret)
   720			return ret;
   721	
   722		ret = devm_request_threaded_irq(pctl->dev, irq, NULL,
   723						stmfx_pinctrl_irq_thread_fn,
   724						IRQF_ONESHOT,
   725						dev_name(pctl->dev), pctl);
   726		if (ret) {
   727			dev_err(pctldev->dev, "cannot request irq%d\n", irq);
   728			return ret;
   729		}
   730	
   731		dev_info(pctldev->dev,
   732			 "%ld GPIOs available\n", hweight_long(pctl->gpio_valid_mask));
   733	
   734		return 0;
   735	}
   736
  

Patch

diff --git a/drivers/pinctrl/pinctrl-apple-gpio.c b/drivers/pinctrl/pinctrl-apple-gpio.c
index 3751c7de37aa..9dac920a3619 100644
--- a/drivers/pinctrl/pinctrl-apple-gpio.c
+++ b/drivers/pinctrl/pinctrl-apple-gpio.c
@@ -119,7 +119,7 @@  static int apple_gpio_dt_node_to_map(struct pinctrl_dev *pctldev,
 
 	ret = of_property_count_u32_elems(node, "pinmux");
 	if (ret <= 0) {
-		dev_err(pctl->dev,
+		dev_err(pctldev->dev,
 			"missing or empty pinmux property in node %pOFn.\n",
 			node);
 		return ret ? ret : -EINVAL;
diff --git a/drivers/pinctrl/pinctrl-oxnas.c b/drivers/pinctrl/pinctrl-oxnas.c
index fb10a8473ebe..88b03bd9f4dc 100644
--- a/drivers/pinctrl/pinctrl-oxnas.c
+++ b/drivers/pinctrl/pinctrl-oxnas.c
@@ -596,7 +596,7 @@  static int oxnas_ox810se_pinmux_enable(struct pinctrl_dev *pctldev,
 
 	while (functions->name) {
 		if (!strcmp(functions->name, fname)) {
-			dev_dbg(pctl->dev,
+			dev_dbg(pctldev->dev,
 				"setting function %s bank %d pin %d fct %d mask %x\n",
 				fname, pg->bank, pg->pin,
 				functions->fct, mask);
@@ -647,7 +647,7 @@  static int oxnas_ox820_pinmux_enable(struct pinctrl_dev *pctldev,
 
 	while (functions->name) {
 		if (!strcmp(functions->name, fname)) {
-			dev_dbg(pctl->dev,
+			dev_dbg(pctldev->dev,
 				"setting function %s bank %d pin %d fct %d mask %x\n",
 				fname, pg->bank, pg->pin,
 				functions->fct, mask);
@@ -697,7 +697,7 @@  static int oxnas_ox810se_gpio_request_enable(struct pinctrl_dev *pctldev,
 	struct oxnas_gpio_bank *bank = gpiochip_get_data(range->gc);
 	u32 mask = BIT(offset - bank->gpio_chip.base);
 
-	dev_dbg(pctl->dev, "requesting gpio %d in bank %d (id %d) with mask 0x%x\n",
+	dev_dbg(pctldev->dev, "requesting gpio %d in bank %d (id %d) with mask 0x%x\n",
 		offset, bank->gpio_chip.base, bank->id, mask);
 
 	regmap_write_bits(pctl->regmap,
@@ -909,7 +909,7 @@  static int oxnas_ox810se_pinconf_set(struct pinctrl_dev *pctldev,
 	u32 offset = pin - bank->gpio_chip.base;
 	u32 mask = BIT(offset);
 
-	dev_dbg(pctl->dev, "setting pin %d bank %d mask 0x%x\n",
+	dev_dbg(pctldev->dev, "setting pin %d bank %d mask 0x%x\n",
 		pin, bank->gpio_chip.base, mask);
 
 	for (i = 0; i < num_configs; i++) {
@@ -946,7 +946,7 @@  static int oxnas_ox820_pinconf_set(struct pinctrl_dev *pctldev,
 	u32 offset = pin - bank->gpio_chip.base;
 	u32 mask = BIT(offset);
 
-	dev_dbg(pctl->dev, "setting pin %d bank %d mask 0x%x\n",
+	dev_dbg(pctldev->dev, "setting pin %d bank %d mask 0x%x\n",
 		pin, bank->gpio_chip.base, mask);
 
 	for (i = 0; i < num_configs; i++) {
@@ -960,7 +960,7 @@  static int oxnas_ox820_pinconf_set(struct pinctrl_dev *pctldev,
 					  mask, mask);
 			break;
 		default:
-			dev_err(pctl->dev, "Property %u not supported\n",
+			dev_err(pctldev->dev, "Property %u not supported\n",
 				param);
 			return -ENOTSUPP;
 		}
diff --git a/drivers/pinctrl/pinctrl-pic32.c b/drivers/pinctrl/pinctrl-pic32.c
index dad05294fa72..bc98888acb7c 100644
--- a/drivers/pinctrl/pinctrl-pic32.c
+++ b/drivers/pinctrl/pinctrl-pic32.c
@@ -1937,23 +1937,23 @@  static int pic32_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin,
 
 		switch (param) {
 		case PIN_CONFIG_BIAS_PULL_UP:
-			dev_dbg(pctl->dev, "   pullup\n");
+			dev_dbg(pctldev->dev, "   pullup\n");
 			writel(mask, bank->reg_base +PIC32_SET(CNPU_REG));
 			break;
 		case PIN_CONFIG_BIAS_PULL_DOWN:
-			dev_dbg(pctl->dev, "   pulldown\n");
+			dev_dbg(pctl_dev->dev, "   pulldown\n");
 			writel(mask, bank->reg_base + PIC32_SET(CNPD_REG));
 			break;
 		case PIN_CONFIG_MICROCHIP_DIGITAL:
-			dev_dbg(pctl->dev, "   digital\n");
+			dev_dbg(pctl_dev->dev, "   digital\n");
 			writel(mask, bank->reg_base + PIC32_CLR(ANSEL_REG));
 			break;
 		case PIN_CONFIG_MICROCHIP_ANALOG:
-			dev_dbg(pctl->dev, "   analog\n");
+			dev_dbg(pctldev->dev, "   analog\n");
 			writel(mask, bank->reg_base + PIC32_SET(ANSEL_REG));
 			break;
 		case PIN_CONFIG_DRIVE_OPEN_DRAIN:
-			dev_dbg(pctl->dev, "   opendrain\n");
+			dev_dbg(pctldev->dev, "   opendrain\n");
 			writel(mask, bank->reg_base + PIC32_SET(ODCU_REG));
 			break;
 		case PIN_CONFIG_INPUT_ENABLE:
@@ -1964,7 +1964,7 @@  static int pic32_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin,
 						    offset, arg);
 			break;
 		default:
-			dev_err(pctl->dev, "Property %u not supported\n",
+			dev_err(pctldev->dev, "Property %u not supported\n",
 				param);
 			return -ENOTSUPP;
 		}
diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c
index ab23d7ac3107..396996201856 100644
--- a/drivers/pinctrl/pinctrl-stmfx.c
+++ b/drivers/pinctrl/pinctrl-stmfx.c
@@ -711,7 +711,7 @@  static int stmfx_pinctrl_probe(struct platform_device *pdev)
 
 	ret = devm_gpiochip_add_data(pctl->dev, &pctl->gpio_chip, pctl);
 	if (ret) {
-		dev_err(pctl->dev, "gpio_chip registration failed\n");
+		dev_err(pctldev->dev, "gpio_chip registration failed\n");
 		return ret;
 	}
 
@@ -724,11 +724,11 @@  static int stmfx_pinctrl_probe(struct platform_device *pdev)
 					IRQF_ONESHOT,
 					dev_name(pctl->dev), pctl);
 	if (ret) {
-		dev_err(pctl->dev, "cannot request irq%d\n", irq);
+		dev_err(pctldev->dev, "cannot request irq%d\n", irq);
 		return ret;
 	}
 
-	dev_info(pctl->dev,
+	dev_info(pctldev->dev,
 		 "%ld GPIOs available\n", hweight_long(pctl->gpio_valid_mask));
 
 	return 0;
diff --git a/drivers/pinctrl/pxa/pinctrl-pxa2xx.c b/drivers/pinctrl/pxa/pinctrl-pxa2xx.c
index d2568dab8c78..f997cc26f01f 100644
--- a/drivers/pinctrl/pxa/pinctrl-pxa2xx.c
+++ b/drivers/pinctrl/pxa/pinctrl-pxa2xx.c
@@ -91,7 +91,7 @@  static int pxa2xx_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
 	void __iomem *gpdr;
 
 	gpdr = pctl->base_gpdr[pin / 32];
-	dev_dbg(pctl->dev, "set_direction(pin=%d): dir=%d\n",
+	dev_dbg(pctldev->dev, "set_direction(pin=%d): dir=%d\n",
 		pin, !input);
 
 	spin_lock_irqsave(&pctl->lock, flags);
@@ -156,7 +156,7 @@  static int pxa2xx_pmx_set_mux(struct pinctrl_dev *pctldev, unsigned function,
 	gafr = pctl->base_gafr[pin / 16];
 	gpdr = pctl->base_gpdr[pin / 32];
 	shift = (pin % 16) << 1;
-	dev_dbg(pctl->dev, "set_mux(pin=%d): af=%d dir=%d\n",
+	dev_dbg(pctldev->dev, "set_mux(pin=%d): af=%d dir=%d\n",
 		pin, df->muxval >> 1, df->muxval & 0x1);
 
 	spin_lock_irqsave(&pctl->lock, flags);