mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
gpiolib: clear the event clock flags when a line is released
gpiod_free_commit() clears the flags that a request sets on a line, but not GPIOD_FLAG_EVENT_CLOCK_REALTIME and GPIOD_FLAG_EVENT_CLOCK_HTE, which gpio_v2_line_config_flags_to_desc_flags() sets from the uAPI v2 line config. Once a line requested with GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME or GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE is released, GPIO_V2_GET_LINEINFO_IOCTL and the line info changed events, the "released" one included, keep reporting that event clock for the free line: GPIO_V2_GET_LINE_IOCTL, line 1, input, event clock realtime: ok close() GPIO_V2_GET_LINEINFO_IOCTL, line 1: input, event clock realtime The flags are set before edge detection is set up, so a request that fails in hte_ts_get(), for instance because no HTE provider handles the line, leaves GPIOD_FLAG_EVENT_CLOCK_HTE behind as well. The next uAPI v2 request rewrites both flags, but requests through uAPI v1, sysfs exports and in-kernel consumers do not, and the line info then shows the event clock of an earlier user for them too. Clear both flags together with the other flags of the request. Reproduced under QEMU with a test GPIO chip: after a released request with the realtime event clock, and on a kernel with CONFIG_HTE=y but no HTE provider after a failed request with the HTE event clock, the line info of the free line still reports that event clock. With this change it reports none. Fixes:26d060e47e("gpiolib: cdev: allow edge event timestamps to be configured as REALTIME") Fixes:2068339a6c("gpiolib: cdev: Add hardware timestamp clock type") Signed-off-by: Adrian Ambrozewicz <aambrozewicz@nvidia.com> Link: https://patch.msgid.link/20261012-gpiolib-event-clock-v1-1-aambrozewicz@nvidia.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
This commit is contained in:
parent
138d7365c2
commit
d35f61581e
|
|
@ -2679,6 +2679,8 @@ void gpiod_free_commit(struct gpio_desc *desc)
|
|||
clear_bit(GPIOD_FLAG_BIAS_DISABLE, &flags);
|
||||
clear_bit(GPIOD_FLAG_EDGE_RISING, &flags);
|
||||
clear_bit(GPIOD_FLAG_EDGE_FALLING, &flags);
|
||||
clear_bit(GPIOD_FLAG_EVENT_CLOCK_REALTIME, &flags);
|
||||
clear_bit(GPIOD_FLAG_EVENT_CLOCK_HTE, &flags);
|
||||
clear_bit(GPIOD_FLAG_IS_HOGGED, &flags);
|
||||
#ifdef CONFIG_OF_DYNAMIC
|
||||
WRITE_ONCE(desc->hog, NULL);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user