Skip to contentSkip to conversation

i2c: gpio: replace printk with dev_err in probe

PATCH New Jovin Basil 3 participants 6 messages Mar 20 – Mar 31

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: gpio: replace printk with dev_err in probe

---
 drivers/i2c/busses/i2c-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-gpio.c +1 -1
index f4355b17bfbf..f51f12c70a78 100644
@@ -490,7 +490,7 @@ static int __init i2c_gpio_init(void)
 
 	ret = platform_driver_register(&i2c_gpio_driver);
 	if (ret)
-		printk(KERN_ERR "i2c-gpio: probe failed: %d\n", ret);
+		dev_err(&pdev->dev, "probe failed :%d\n",ret);
 
 	return ret;
 }
Signature · 1 line
2.47.3
#1 lore raw

PATCH 1/1 i2c: gpio: replace printk with dev_err in probe

v2:
- Restore original log message prefix ("i2c-gpio:")
- Restore original spacing and colon placement

---
 drivers/i2c/busses/i2c-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-gpio.c +1 -1
index f4355b17bfbf..724f13cef9fe 100644
@@ -490,7 +490,7 @@ static int __init i2c_gpio_init(void)
 
 	ret = platform_driver_register(&i2c_gpio_driver);
 	if (ret)
-		printk(KERN_ERR "i2c-gpio: probe failed: %d\n", ret);
+		dev_err(&pdev->dev, "i2c-gpio: probe failed: %d\n",ret);
 
 	return ret;
 }
Signature · 1 line
2.47.3
maintainer
#2 lore raw
Quoted 5 lines · Jovin Basil

v2:
- Restore original log message prefix ("i2c-gpio:")
- Restore original spacing and colon placement

Please read 'Documentation/process/submitting-patches.rst', especially the section "Describe your changes".

#3 lore raw
In reply to Jovin Basil
kernel test robot noticed the following build errors:

Hi Jovin,

kernel test robot noticed the following build errors:

[auto build test ERROR on andi-shyti/i2c/i2c-host]
[also build test ERROR on wsa/i2c/for-next linus/master v7.0-rc4 next-20260320] [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/Jovin-Basil/i2c-gpio-replace-printk-with-dev_err-in-probe/20260322-012109
base:   https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git i2c/i2c-host
patch link:    https://lore.kernel.org/r/20260320150144.432345-1-jovin555%40gmail.com
patch subject: [PATCH] i2c: gpio: replace printk with dev_err in probe
config: csky-randconfig-r073-20260322 (https://download.01.org/0day-ci/archive/20260322/[email protected]/config)
compiler: csky-linux-gcc (GCC) 15.2.0
smatch: v0.5.0-9004-gb810ac53
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260322/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from include/linux/device.h:15,

                    from include/linux/acpi.h:15,
                    from include/linux/i2c.h:13,
                    from include/linux/i2c-algo-bit.h:13,
                    from drivers/i2c/busses/i2c-gpio.c:11:
   drivers/i2c/busses/i2c-gpio.c: In function 'i2c_gpio_init':
>> drivers/i2c/busses/i2c-gpio.c:493:26: error: 'pdev' undeclared (first use in this function); did you mean 'cdev'?
     493 |                 dev_err(&pdev->dev, "i2c-gpio: probe failed: %d\n",ret);
         |                          ^~~~
   include/linux/dev_printk.h:110:25: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                         ^~~
   drivers/i2c/busses/i2c-gpio.c:493:17: note: in expansion of macro 'dev_err'
     493 |                 dev_err(&pdev->dev, "i2c-gpio: probe failed: %d\n",ret);
         |                 ^~~~~~~
   drivers/i2c/busses/i2c-gpio.c:493:26: note: each undeclared identifier is reported only once for each function it appears in
     493 |                 dev_err(&pdev->dev, "i2c-gpio: probe failed: %d\n",ret);
         |                          ^~~~
   include/linux/dev_printk.h:110:25: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                         ^~~
   drivers/i2c/busses/i2c-gpio.c:493:17: note: in expansion of macro 'dev_err'
     493 |                 dev_err(&pdev->dev, "i2c-gpio: probe failed: %d\n",ret);
         |                 ^~~~~~~

vim +493 drivers/i2c/busses/i2c-gpio.c

486
487 static int __init i2c_gpio_init(void)
488 {
489 int ret;
490
491 ret = platform_driver_register(&i2c_gpio_driver);
492 if (ret)

 > 493			dev_err(&pdev->dev, "i2c-gpio: probe failed: %d\n",ret);

494
495 return ret;
496 }
497 subsys_initcall(i2c_gpio_init);
498

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#4 lore raw
In reply to Jovin Basil
kernel test robot noticed the following build errors:

Hi Jovin,

kernel test robot noticed the following build errors:

[auto build test ERROR on andi-shyti/i2c/i2c-host]
[also build test ERROR on wsa/i2c/for-next linus/master v7.0-rc4 next-20260320] [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/Jovin-Basil/i2c-gpio-replace-printk-with-dev_err-in-probe/20260322-012109
base:   https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git i2c/i2c-host
patch link:    https://lore.kernel.org/r/20260320150144.432345-1-jovin555%40gmail.com
patch subject: [PATCH] i2c: gpio: replace printk with dev_err in probe
config: riscv-randconfig-001-20260322 (https://download.01.org/0day-ci/archive/20260322/[email protected]/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 4abb927bacf37f18f6359a41639a6d1b3bffffb5)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260322/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from include/linux/cgroup.h:27:
In file included from include/linux/kernel_stat.h:8:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:12:
In file included from arch/riscv/include/asm/io.h:140:
include/asm-generic/io.h:854:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]

     854 |         insl(addr, buffer, count);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:110:53: note: expanded from macro 'insl'
     110 | #define insl(addr, buffer, count) __insl(PCI_IOBASE + (addr), buffer, count)
         |                                          ~~~~~~~~~~ ^
   In file included from drivers/i2c/busses/i2c-gpio.c:11:
   In file included from include/linux/i2c-algo-bit.h:13:
   In file included from include/linux/i2c.h:19:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:27:
   In file included from include/linux/kernel_stat.h:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:12:
   In file included from arch/riscv/include/asm/io.h:140:
   include/asm-generic/io.h:863:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     863 |         outsb(addr, buffer, count);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:122:55: note: expanded from macro 'outsb'
     122 | #define outsb(addr, buffer, count) __outsb(PCI_IOBASE + (addr), buffer, count)
         |                                            ~~~~~~~~~~ ^
   In file included from drivers/i2c/busses/i2c-gpio.c:11:
   In file included from include/linux/i2c-algo-bit.h:13:
   In file included from include/linux/i2c.h:19:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:27:
   In file included from include/linux/kernel_stat.h:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:12:
   In file included from arch/riscv/include/asm/io.h:140:
   include/asm-generic/io.h:872:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     872 |         outsw(addr, buffer, count);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:123:55: note: expanded from macro 'outsw'
     123 | #define outsw(addr, buffer, count) __outsw(PCI_IOBASE + (addr), buffer, count)
         |                                            ~~~~~~~~~~ ^
   In file included from drivers/i2c/busses/i2c-gpio.c:11:
   In file included from include/linux/i2c-algo-bit.h:13:
   In file included from include/linux/i2c.h:19:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:27:
   In file included from include/linux/kernel_stat.h:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:12:
   In file included from arch/riscv/include/asm/io.h:140:
   include/asm-generic/io.h:881:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     881 |         outsl(addr, buffer, count);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:124:55: note: expanded from macro 'outsl'
     124 | #define outsl(addr, buffer, count) __outsl(PCI_IOBASE + (addr), buffer, count)
         |                                            ~~~~~~~~~~ ^
   In file included from drivers/i2c/busses/i2c-gpio.c:11:
   In file included from include/linux/i2c-algo-bit.h:13:
   In file included from include/linux/i2c.h:19:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:27:
   In file included from include/linux/kernel_stat.h:8:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:12:
   In file included from arch/riscv/include/asm/io.h:140:
   include/asm-generic/io.h:1209:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
    1209 |         return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
         |                                                   ~~~~~~~~~~ ^
>> drivers/i2c/busses/i2c-gpio.c:493:12: error: use of undeclared identifier 'pdev'
     493 |                 dev_err(&pdev->dev, "i2c-gpio: probe failed: %d\n",ret);
         |                          ^~~~

7 warnings and 1 error generated.

vim +/pdev +493 drivers/i2c/busses/i2c-gpio.c

486
487 static int __init i2c_gpio_init(void)
488 {
489 int ret;
490
491 ret = platform_driver_register(&i2c_gpio_driver);
492 if (ret)

 > 493			dev_err(&pdev->dev, "i2c-gpio: probe failed: %d\n",ret);

494
495 return ret;
496 }
497 subsys_initcall(i2c_gpio_init);
498

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#5 lore raw
In reply to Jovin Basil
kernel test robot noticed the following build errors:

Hi Jovin,

kernel test robot noticed the following build errors:

[auto build test ERROR on andi-shyti/i2c/i2c-host]
[also build test ERROR on wsa/i2c/for-next linus/master v7.0-rc6 next-20260330] [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/Jovin-Basil/i2c-gpio-replace-printk-with-dev_err-in-probe/20260322-133522
base:   https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git i2c/i2c-host
patch link:    https://lore.kernel.org/r/20260320122656.430939-1-jovin555%40gmail.com
patch subject: [PATCH] i2c: gpio: replace printk with dev_err in probe
config: x86_64-randconfig-078-20250816-CONFIG_SENSORS_LM75 (https://download.01.org/0day-ci/archive/20260331/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260331/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from include/linux/device.h:15,

                    from include/linux/acpi.h:15,
                    from include/linux/i2c.h:13,
                    from include/linux/i2c-algo-bit.h:13,
                    from drivers/i2c/busses/i2c-gpio.c:11:
   drivers/i2c/busses/i2c-gpio.c: In function 'i2c_gpio_init':
>> drivers/i2c/busses/i2c-gpio.c:493:26: error: 'pdev' undeclared (first use in this function); did you mean 'cdev'?
     493 |                 dev_err(&pdev->dev, "probe failed :%d\n",ret);
         |                          ^~~~
   include/linux/dev_printk.h:110:25: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                         ^~~
   drivers/i2c/busses/i2c-gpio.c:493:17: note: in expansion of macro 'dev_err'
     493 |                 dev_err(&pdev->dev, "probe failed :%d\n",ret);
         |                 ^~~~~~~
   drivers/i2c/busses/i2c-gpio.c:493:26: note: each undeclared identifier is reported only once for each function it appears in
     493 |                 dev_err(&pdev->dev, "probe failed :%d\n",ret);
         |                          ^~~~
   include/linux/dev_printk.h:110:25: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                         ^~~
   drivers/i2c/busses/i2c-gpio.c:493:17: note: in expansion of macro 'dev_err'
     493 |                 dev_err(&pdev->dev, "probe failed :%d\n",ret);
         |                 ^~~~~~~

vim +493 drivers/i2c/busses/i2c-gpio.c

486
487 static int __init i2c_gpio_init(void)
488 {
489 int ret;
490
491 ret = platform_driver_register(&i2c_gpio_driver);
492 if (ret)

 > 493			dev_err(&pdev->dev, "probe failed :%d\n",ret);

494
495 return ret;
496 }
497 subsys_initcall(i2c_gpio_init);
498

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki