Skip to contentSkip to conversation

platform/x86: silicom: remove unnecessary GPIO line direction check

PATCH Superseded Bartosz Golaszewski 2 participants 2 messages Jun 10, 2025 – Jun 11, 2025 x86 platform drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

From: Bartosz Golaszewski <[email protected]>

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.

---
 drivers/platform/x86/silicom-platform.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/platform/x86/silicom-platform.c +0 -3
index 021f3fed197a6..4d2c2d4a66e5e 100644
@@ -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;
Signature · 1 line
2.48.1
#1 lore raw
kernel test robot noticed the following build warnings:

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/[email protected]/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/[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 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  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki