[PATCH] platform/x86: silicom: remove unnecessary GPIO line direction check

Bartosz Golaszewski posted 1 patch 4 months ago
There is a newer version of this series
drivers/platform/x86/silicom-platform.c | 3 ---
1 file changed, 3 deletions(-)
[PATCH] platform/x86: silicom: remove unnecessary GPIO line direction check
Posted by Bartosz Golaszewski 4 months ago
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

As of commit 92ac7de3175e3 ("gpiolib: don't allow setting values on input
lines"), the GPIO core makes sure values cannot be set on input lines.
Remove the unnecessary check.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/platform/x86/silicom-platform.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/platform/x86/silicom-platform.c b/drivers/platform/x86/silicom-platform.c
index 021f3fed197a6..4d2c2d4a66e5e 100644
--- a/drivers/platform/x86/silicom-platform.c
+++ b/drivers/platform/x86/silicom-platform.c
@@ -252,9 +252,6 @@ static int silicom_gpio_set(struct gpio_chip *gc, unsigned int offset,
 	u8 *channels = gpiochip_get_data(gc);
 	int channel = channels[offset];
 
-	if (direction == GPIO_LINE_DIRECTION_IN)
-		return -EPERM;
-
 	silicom_mec_port_set(channel, !value);
 
 	return 0;
-- 
2.48.1
Re: [PATCH] platform/x86: silicom: remove unnecessary GPIO line direction check
Posted by kernel test robot 4 months ago
Hi Bartosz,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.16-rc1 next-20250610]
[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/Bartosz-Golaszewski/platform-x86-silicom-remove-unnecessary-GPIO-line-direction-check/20250610-225049
base:   linus/master
patch link:    https://lore.kernel.org/r/20250610144935.84375-1-brgl%40bgdev.pl
patch subject: [PATCH] platform/x86: silicom: remove unnecessary GPIO line direction check
config: x86_64-buildonly-randconfig-001-20250611 (https://download.01.org/0day-ci/archive/20250611/202506111214.mbG7aOVD-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250611/202506111214.mbG7aOVD-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506111214.mbG7aOVD-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/platform/x86/silicom-platform.c: In function 'silicom_gpio_set':
>> drivers/platform/x86/silicom-platform.c:251:13: warning: unused variable 'direction' [-Wunused-variable]
     251 |         int direction = silicom_gpio_get_direction(gc, offset);
         |             ^~~~~~~~~


vim +/direction +251 drivers/platform/x86/silicom-platform.c

d9cd21d441c8c7 Henry Shi           2023-11-24  247  
88f67f2a99f061 Bartosz Golaszewski 2025-04-08  248  static int silicom_gpio_set(struct gpio_chip *gc, unsigned int offset,
d9cd21d441c8c7 Henry Shi           2023-11-24  249  			    int value)
d9cd21d441c8c7 Henry Shi           2023-11-24  250  {
d9cd21d441c8c7 Henry Shi           2023-11-24 @251  	int direction = silicom_gpio_get_direction(gc, offset);
d9cd21d441c8c7 Henry Shi           2023-11-24  252  	u8 *channels = gpiochip_get_data(gc);
d9cd21d441c8c7 Henry Shi           2023-11-24  253  	int channel = channels[offset];
d9cd21d441c8c7 Henry Shi           2023-11-24  254  
890a48ca7b0540 Dan Carpenter       2024-01-12  255  	silicom_mec_port_set(channel, !value);
88f67f2a99f061 Bartosz Golaszewski 2025-04-08  256  
88f67f2a99f061 Bartosz Golaszewski 2025-04-08  257  	return 0;
d9cd21d441c8c7 Henry Shi           2023-11-24  258  }
d9cd21d441c8c7 Henry Shi           2023-11-24  259  

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