From 87d653a894a43adaf74637f175e86df79b399be4 Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Sat, 27 Dec 2025 23:26:32 +0200 Subject: [PATCH] staging: axis-fifo: Remove read/write timeout module parameters Module parameters for timeouts are a poor interface choice as they affect all device instances globally rather than being configurable per file descriptor. The current implementation also returns -EAGAIN on timeout, requiring userspace to implement retry loops around blocking operations. Remove the read_timeout and write_timeout module parameters. The next commit adds poll() support, allowing applications to implement timeout handling using standard poll()/select() interfaces. Signed-off-by: Ovidiu Panait Link: https://patch.msgid.link/20251227212640.3321310-1-ovidiu.panait.oss@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/axis-fifo/axis-fifo.c | 62 +++------------------------ 1 file changed, 6 insertions(+), 56 deletions(-) diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c index 509d620d6ce70..b2a9f5542fc1c 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -25,9 +25,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -91,25 +89,8 @@ #define XLLF_INT_CLEAR_ALL GENMASK(31, 0) -/* ---------------------------- - * globals - * ---------------------------- - */ -static long read_timeout = 1000; /* ms to wait before read() times out */ -static long write_timeout = 1000; /* ms to wait before write() times out */ - static DEFINE_IDA(axis_fifo_ida); -/* ---------------------------- - * module command-line arguments - * ---------------------------- - */ - -module_param(read_timeout, long, 0444); -MODULE_PARM_DESC(read_timeout, "ms to wait before blocking read() timing out; set to -1 for no timeout"); -module_param(write_timeout, long, 0444); -MODULE_PARM_DESC(write_timeout, "ms to wait before blocking write() timing out; set to -1 for no timeout"); - /* ---------------------------- * types * ---------------------------- @@ -202,20 +183,11 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf, * if nothing is currently available */ mutex_lock(&fifo->read_lock); - ret = wait_event_interruptible_timeout(fifo->read_queue, - ioread32(fifo->base_addr + XLLF_RDFO_OFFSET), - read_timeout); - - if (ret <= 0) { - if (ret == 0) { - ret = -EAGAIN; - } else if (ret != -ERESTARTSYS) { - dev_err(fifo->dt_device, "wait_event_interruptible_timeout() error in read (ret=%i)\n", - ret); - } + ret = wait_event_interruptible(fifo->read_queue, + ioread32(fifo->base_addr + XLLF_RDFO_OFFSET)); + if (ret) goto end_unlock; - } } bytes_available = ioread32(fifo->base_addr + XLLF_RLR_OFFSET); @@ -346,21 +318,11 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf, * currently enough room in the fifo */ mutex_lock(&fifo->write_lock); - ret = wait_event_interruptible_timeout(fifo->write_queue, - ioread32(fifo->base_addr + XLLF_TDFV_OFFSET) - >= words_to_write, - write_timeout); - - if (ret <= 0) { - if (ret == 0) { - ret = -EAGAIN; - } else if (ret != -ERESTARTSYS) { - dev_err(fifo->dt_device, "wait_event_interruptible_timeout() error in write (ret=%i)\n", - ret); - } + ret = wait_event_interruptible(fifo->write_queue, + ioread32(fifo->base_addr + XLLF_TDFV_OFFSET) >= words_to_write); + if (ret) goto end_unlock; - } } txbuf = vmemdup_user(buf, len); @@ -673,18 +635,6 @@ static struct platform_driver axis_fifo_driver = { static int __init axis_fifo_init(void) { - if (read_timeout >= 0) - read_timeout = msecs_to_jiffies(read_timeout); - else - read_timeout = MAX_SCHEDULE_TIMEOUT; - - if (write_timeout >= 0) - write_timeout = msecs_to_jiffies(write_timeout); - else - write_timeout = MAX_SCHEDULE_TIMEOUT; - - pr_info("axis-fifo driver loaded with parameters read_timeout = %li, write_timeout = %li\n", - read_timeout, write_timeout); return platform_driver_register(&axis_fifo_driver); } -- 2.47.3