Skip to contentSkip to conversation

gpio: amd-fch: Return 0-1 range for get operation

PATCH New Rory Little 2 participants 3 messages Jan 29 – Jan 30

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

PATCH 1/1 gpio: amd-fch: Return 0-1 range for get operation

Now that gpiochip_get sanitizes the output of these calls, this old non-1 behavior was causing -EBADE to be returned when voltage high was read.

---
 drivers/gpio/gpio-amd-fch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-amd-fch.c +1 -1
index e6c6c3ec7656..37bf1842481d 100644
@@ -125,7 +125,7 @@ static int amd_fch_gpio_get(struct gpio_chip *gc,
 	void __iomem *ptr = amd_fch_gpio_addr(priv, offset);
 
 	spin_lock_irqsave(&priv->lock, flags);
-	ret = (readl_relaxed(ptr) & AMD_FCH_GPIO_FLAG_READ);
+	ret = FIELD_GET(AMD_FCH_GPIO_FLAG_READ, readl_relaxed(ptr));
 	spin_unlock_irqrestore(&priv->lock, flags);
 
 	return ret;
Signature · 1 line
2.52.0
#1 lore raw
kernel test robot noticed the following build errors:

Hi Rory,

kernel test robot noticed the following build errors:

[auto build test ERROR on brgl/gpio/for-next]
[also build test ERROR on linus/master v6.19-rc7 next-20260129] [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/Rory-Little/gpio-amd-fch-Return-0-1-range-for-get-operation/20260130-063318
base:   https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
patch link:    https://lore.kernel.org/r/20260129222150.486419-1-rory%40candelatech.com
patch subject: [PATCH] gpio: amd-fch: Return 0-1 range for get operation
config: sparc-randconfig-002-20260130 (https://download.01.org/0day-ci/archive/20260130/[email protected]/config)
compiler: sparc-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260130/[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 >>):

drivers/gpio/gpio-amd-fch.c: In function 'amd_fch_gpio_get':

>> drivers/gpio/gpio-amd-fch.c:128:8: error: implicit declaration of function 'FIELD_GET' [-Werror=implicit-function-declaration]
     ret = FIELD_GET(AMD_FCH_GPIO_FLAG_READ, readl_relaxed(ptr));
           ^~~~~~~~~

cc1: some warnings being treated as errors

vim +/FIELD_GET +128 drivers/gpio/gpio-amd-fch.c

118
119 static int amd_fch_gpio_get(struct gpio_chip *gc,
120 unsigned int offset)
121 {
122 unsigned long flags;
123 int ret;
124 struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc);
125 void __iomem *ptr = amd_fch_gpio_addr(priv, offset);
126
127 spin_lock_irqsave(&priv->lock, flags);

 > 128		ret = FIELD_GET(AMD_FCH_GPIO_FLAG_READ, readl_relaxed(ptr));

129 spin_unlock_irqrestore(&priv->lock, flags);
130
131 return ret;
132 }
133

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

Hi Rory,

kernel test robot noticed the following build errors:

[auto build test ERROR on brgl/gpio/for-next]
[also build test ERROR on linus/master v6.19-rc7 next-20260129] [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/Rory-Little/gpio-amd-fch-Return-0-1-range-for-get-operation/20260130-063318
base:   https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
patch link:    https://lore.kernel.org/r/20260129222150.486419-1-rory%40candelatech.com
patch subject: [PATCH] gpio: amd-fch: Return 0-1 range for get operation
config: s390-randconfig-002-20260130 (https://download.01.org/0day-ci/archive/20260130/[email protected]/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260130/[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 >>):

>> drivers/gpio/gpio-amd-fch.c:128:8: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     128 |         ret = FIELD_GET(AMD_FCH_GPIO_FLAG_READ, readl_relaxed(ptr));
         |               ^

1 error generated.

vim +/FIELD_GET +128 drivers/gpio/gpio-amd-fch.c

118
119 static int amd_fch_gpio_get(struct gpio_chip *gc,
120 unsigned int offset)
121 {
122 unsigned long flags;
123 int ret;
124 struct amd_fch_gpio_priv *priv = gpiochip_get_data(gc);
125 void __iomem *ptr = amd_fch_gpio_addr(priv, offset);
126
127 spin_lock_irqsave(&priv->lock, flags);

 > 128		ret = FIELD_GET(AMD_FCH_GPIO_FLAG_READ, readl_relaxed(ptr));

129 spin_unlock_irqrestore(&priv->lock, flags);
130
131 return ret;
132 }
133

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