[tip: sched/rt] printk: nbcon: Use raw_cpu_ptr() instead of open coding

tip-bot2 for John Ogness posted 1 patch 2 months, 3 weeks ago
kernel/printk/nbcon.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[tip: sched/rt] printk: nbcon: Use raw_cpu_ptr() instead of open coding
Posted by tip-bot2 for John Ogness 2 months, 3 weeks ago
The following commit has been merged into the sched/rt branch of tip:

Commit-ID:     d33d5e683b0d3b4f5fc6a49ce17583f8ca663944
Gitweb:        https://git.kernel.org/tip/d33d5e683b0d3b4f5fc6a49ce17583f8ca663944
Author:        John Ogness <john.ogness@linutronix.de>
AuthorDate:    Tue, 27 Aug 2024 16:25:31 +02:06
Committer:     Petr Mladek <pmladek@suse.com>
CommitterDate: Wed, 04 Sep 2024 12:28:25 +02:00

printk: nbcon: Use raw_cpu_ptr() instead of open coding

There is no need to open code a non-migration-checking
this_cpu_ptr(). That is exactly what raw_cpu_ptr() is.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/87plpum4jw.fsf@jogness.linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
---
 kernel/printk/nbcon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
index 92ac5c5..cf62f67 100644
--- a/kernel/printk/nbcon.c
+++ b/kernel/printk/nbcon.c
@@ -998,8 +998,7 @@ static __ref unsigned int *nbcon_get_cpu_emergency_nesting(void)
 	if (!printk_percpu_data_ready())
 		return &early_nbcon_pcpu_emergency_nesting;
 
-	/* Open code this_cpu_ptr() without checking migration. */
-	return per_cpu_ptr(&nbcon_pcpu_emergency_nesting, raw_smp_processor_id());
+	return raw_cpu_ptr(&nbcon_pcpu_emergency_nesting);
 }
 
 /**