Skip to contentSkip to conversation

sched: Remove unneeded function type cast in do_balance_callbacks()

PATCH Applied Vladimir Zapolskiy 3 participants 4 messages Aug 19 – Sep 2 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: Remove unneeded function type cast in do_balance_callbacks()

It's a trivial and non-functional change, the removed explicit function type cast does not convert the function type of struct balance_callback member (*func), and the cast can be removed.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index f5f7ff8c680a..63956d8c3db6 100644
@@ -5126,7 +5126,7 @@ static void do_balance_callbacks(struct rq *rq, struct balance_callback *head)
 	lockdep_assert_rq_held(rq);
 
 	while (head) {
-		func = (void (*)(struct rq *))head->func;
+		func = head->func;
 		next = head->next;
 		head->next = NULL;
 		head = next;
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 3 lines · Vladimir Zapolskiy

It's a trivial and non-functional change, the removed explicit function type cast does not convert the function type of struct balance_callback member (*func), and the cast can be removed.

Right you are; I suspect this was once a struct callback_head. Ah yes, see commit: 8e5bad7dccec ("sched: Introduce struct balance_callback to avoid CFI mismatches").

Quoted 21 lines
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index f5f7ff8c680a..63956d8c3db6 100644
@@ -5126,7 +5126,7 @@ static void do_balance_callbacks(struct rq *rq, struct balance_callback *head)
 	lockdep_assert_rq_held(rq);
 
 	while (head) {
-		func = (void (*)(struct rq *))head->func;
+		func = head->func;
 		next = head->next;
 		head->next = NULL;
 		head = next;
Signature · 1 line
2.51.0
#2 lore raw
In reply to Vladimir Zapolskiy
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     4248f68fe26da7b741d3b9c6a88a3c5b685377f9
Gitweb:        https://git.kernel.org/tip/4248f68fe26da7b741d3b9c6a88a3c5b685377f9
Author:        Vladimir Zapolskiy <[email protected]>
AuthorDate:    Wed, 19 Aug 2026 11:01:58 +03:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Wed, 02 Sep 2026 09:37:25 +02:00

sched: Remove unneeded function type cast in do_balance_callbacks()

It's a trivial and non-functional change, the removed explicit function type cast does not convert the function type of struct balance_callback member (*func), and the cast can be removed.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index 4e97766..545f494 100644
@@ -5143,7 +5143,7 @@ static void do_balance_callbacks(struct rq *rq, struct balance_callback *head)
 	lockdep_assert_rq_held(rq);
 
 	while (head) {
-		func = (void (*)(struct rq *))head->func;
+		func = head->func;
 		next = head->next;
 		head->next = NULL;
 		head = next;
#3 lore raw
In reply to Vladimir Zapolskiy
The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     879eaa76e6086ab4aff77a669bfb50b7db03e0b4
Gitweb:        https://git.kernel.org/tip/879eaa76e6086ab4aff77a669bfb50b7db03e0b4
Author:        Vladimir Zapolskiy <[email protected]>
AuthorDate:    Wed, 19 Aug 2026 11:01:58 +03:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Wed, 02 Sep 2026 10:28:25 +02:00

sched: Remove unneeded function type cast in do_balance_callbacks()

It's a trivial and non-functional change, the removed explicit function type cast does not convert the function type of struct balance_callback member (*func), and the cast can be removed.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index 4e97766..545f494 100644
@@ -5143,7 +5143,7 @@ static void do_balance_callbacks(struct rq *rq, struct balance_callback *head)
 	lockdep_assert_rq_held(rq);
 
 	while (head) {
-		func = (void (*)(struct rq *))head->func;
+		func = head->func;
 		next = head->next;
 		head->next = NULL;
 		head = next;