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.
This commit is contained in:
Gleb Chesnokov
2023-06-30 10:56:09 +03:00
parent 6a925490fd
commit 057224f669
+6 -15
View File
@@ -36,10 +36,6 @@
#endif
#include "scst_dev_handler.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/signal.h>
#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);