From 057224f6691b8ee7fedb677e1c69844d051423b1 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Thu, 29 Jun 2023 12:16:49 +0300 Subject: [PATCH] scst_user: Simplify signal pending check The scst_wait_event_interruptible_lock_irq() function now implicitly checks for pending signals. Therefore, there is no need to check for these signals explicitly. This patch replaces the explicit check with a simple evaluation of the function's return value. This patch doesn't change any functionality. --- scst/src/dev_handlers/scst_user.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index fcf2d90b8..e66a41069 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -36,10 +36,6 @@ #endif #include "scst_dev_handler.h" -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) -#include -#endif - #ifndef INSIDE_KERNEL_TREE #if defined(CONFIG_HIGHMEM4G) || defined(CONFIG_HIGHMEM64G) #warning HIGHMEM kernel configurations are not supported by this module, \ @@ -2219,8 +2215,7 @@ static inline int test_cmd_threads(struct scst_user_dev *dev, bool can_block) { int res = !list_empty(&dev->udev_cmd_threads.active_cmd_list) || !list_empty(&dev->ready_cmd_list) || - !can_block || !dev->blocking || dev->cleanup_done || - signal_pending(current); + !can_block || !dev->blocking || dev->cleanup_done; return res; } @@ -2233,9 +2228,11 @@ static int dev_user_get_next_cmd(struct scst_user_dev *dev, TRACE_ENTRY(); while (1) { - scst_wait_event_interruptible_lock_irq(dev->udev_cmd_threads.cmd_list_waitQ, - test_cmd_threads(dev, can_block), - dev->udev_cmd_threads.cmd_list_lock); + res = scst_wait_event_interruptible_lock_irq(dev->udev_cmd_threads.cmd_list_waitQ, + test_cmd_threads(dev, can_block), + dev->udev_cmd_threads.cmd_list_lock); + if (res) + break; dev_user_process_scst_commands(dev); @@ -2248,12 +2245,6 @@ static int dev_user_get_next_cmd(struct scst_user_dev *dev, TRACE_DBG("No ready commands, returning %d", res); break; } - - if (signal_pending(current)) { - res = -EINTR; - TRACE_DBG("Signal pending, returning %d", res); - break; - } } TRACE_EXIT_RES(res);