Skip to contentSkip to conversation

gpio: cdev: EOPNOTSUPP when HTE unavailable

PATCH In review Iván Ezequiel Rodriguez 2 participants 3 messages Aug 31 – Sep 2

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

cover gpio: cdev: EOPNOTSUPP when HTE unavailable

Hi,

When CONFIG_HTE is enabled but hte_ts_get() returns -ENODEV (no HTE provider for the line), gpiolib-cdev currently propagates -ENODEV to userspace.

Map that to -EOPNOTSUPP so it matches the errno already returned when CONFIG_HTE is disabled or GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE is otherwise unsupported.

Base: v7.3-rc1

Tested: built with CONFIG_GPIOLIB=y, CONFIG_GPIO_CDEV=y, CONFIG_HTE=y. QEMU smoke for the HTE ioctl path was skipped (no gpiochip0 in this guest); the change is a one-line errno remap on the existing error path.

Thanks,
Iván

Iván Ezequiel Rodriguez (1):
gpio: cdev: return EOPNOTSUPP when HTE is unavailable

 drivers/gpio/gpiolib-cdev.c | 2 ++
 1 file changed, 2 insertions(+)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 gpio: cdev: return EOPNOTSUPP when HTE is unavailable

Map hte_ts_get() -ENODEV to -EOPNOTSUPP so userspace sees the same errno as when CONFIG_HTE is disabled or EVENT_CLOCK_HTE is unsupported.

---
 drivers/gpio/gpiolib-cdev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpio/gpiolib-cdev.c +2 -0
index 9f3b628d5793..6dc01f7ea838 100644
@@ -715,6 +715,8 @@ static int hte_edge_setup(struct line *line, u64 eflags)
 			   line->desc);
 
 	ret = hte_ts_get(NULL, hdesc, 0);
+	if (ret == -ENODEV)
+		return -EOPNOTSUPP;
 	if (ret)
 		return ret;
 
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v1 1/1] gpio: cdev: return EOPNOTSUPP when HTE is unavailable

Quoted 4 lines · Iván Ezequiel Rodriguez

Map hte_ts_get() -ENODEV to -EOPNOTSUPP so userspace sees the same errno as when CONFIG_HTE is disabled or EVENT_CLOCK_HTE is unsupported.

Makes sense. I hope it will not break any user-space users, though that's highly unlikely.

[1/1] gpio: cdev: return EOPNOTSUPP when HTE is unavailable

      https://git.kernel.org/brgl/c/cf176c115497bc6462391c3118bedfd212092c4d

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>