Skip to contentSkip to conversation

workqueue: Remove unused work_on_cpu_safe

PATCH Applied [email protected] 2 participants 2 messages Jun 23, 2025 Workqueue

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 workqueue: Remove unused work_on_cpu_safe

From: "Dr. David Alan Gilbert" <[email protected]>

The last use of the work_on_cpu_safe() macro was removed recently by commit 9cda46babdfe ("crypto: n2 - remove Niagara2 SPU driver")

Remove it, and the work_on_cpu_safe_key() function it calls.

---
 include/linux/workqueue.h | 13 -------------
 kernel/workqueue.c        | 25 -------------------------
 2 files changed, 38 deletions(-)
include/linux/workqueue.h +0 -13
index 6e30f275da77..3bf65b8e14cc 100644
@@ -840,19 +840,6 @@ long work_on_cpu_key(int cpu, long (*fn)(void *),
 	work_on_cpu_key(_cpu, _fn, _arg, &__key);	\
 })
 
-long work_on_cpu_safe_key(int cpu, long (*fn)(void *),
-			  void *arg, struct lock_class_key *key);
-
-/*
- * A new key is defined for each caller to make sure the work
- * associated with the function doesn't share its locking class.
- */
-#define work_on_cpu_safe(_cpu, _fn, _arg)		\
-({							\
-	static struct lock_class_key __key;		\
-							\
-	work_on_cpu_safe_key(_cpu, _fn, _arg, &__key);	\
-})
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_FREEZER
kernel/workqueue.c +0 -25
index 97f37b5bae66..ade5c1152822 100644
@@ -6770,31 +6770,6 @@ long work_on_cpu_key(int cpu, long (*fn)(void *),
 	return wfc.ret;
 }
 EXPORT_SYMBOL_GPL(work_on_cpu_key);
-
-/**
- * work_on_cpu_safe_key - run a function in thread context on a particular cpu
- * @cpu: the cpu to run on
- * @fn:  the function to run
- * @arg: the function argument
- * @key: The lock class key for lock debugging purposes
- *
- * Disables CPU hotplug and calls work_on_cpu(). The caller must not hold
- * any locks which would prevent @fn from completing.
- *
- * Return: The value @fn returns.
- */
-long work_on_cpu_safe_key(int cpu, long (*fn)(void *),
-			  void *arg, struct lock_class_key *key)
-{
-	long ret = -ENODEV;
-
-	cpus_read_lock();
-	if (cpu_online(cpu))
-		ret = work_on_cpu_key(cpu, fn, arg, key);
-	cpus_read_unlock();
-	return ret;
-}
-EXPORT_SYMBOL_GPL(work_on_cpu_safe_key);
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_FREEZER
Signature · 1 line
2.49.0
maintainer Applied
#1 lore raw
Quoted 8 lines · On Mon, Jun 23, 2025 at 01:30:49AM +0100, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

The last use of the work_on_cpu_safe() macro was removed recently by commit 9cda46babdfe ("crypto: n2 - remove Niagara2 SPU driver")

Remove it, and the work_on_cpu_safe_key() function it calls.

Applied to wq/for-6.17.

Thanks.

Signature · 1 line
tejun