From 8e6eb9e51cf4c4efeeb61910c35b01dcce2ec502 Mon Sep 17 00:00:00 2001 From: John Ogness Date: Thu, 18 Feb 2021 17:37:41 +0100 Subject: [PATCH 098/323] printk: convert @syslog_lock to spin_lock Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.10/older/patches-5.10.204-rt100.tar.xz Signed-off-by: John Ogness Signed-off-by: Sebastian Andrzej Siewior --- kernel/printk/printk.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 90a4cf4c23a4..57f3b8d7f35c 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -358,7 +358,7 @@ enum log_flags { }; /* syslog_lock protects syslog_* variables and write access to clear_seq. */ -static DEFINE_RAW_SPINLOCK(syslog_lock); +static DEFINE_SPINLOCK(syslog_lock); #ifdef CONFIG_PRINTK DECLARE_WAIT_QUEUE_HEAD(log_wait); @@ -1482,9 +1482,9 @@ static int syslog_print(char __user *buf, int size) size_t n; size_t skip; - raw_spin_lock_irq(&syslog_lock); + spin_lock_irq(&syslog_lock); if (!prb_read_valid(prb, syslog_seq, &r)) { - raw_spin_unlock_irq(&syslog_lock); + spin_unlock_irq(&syslog_lock); break; } if (r.info->seq != syslog_seq) { @@ -1513,7 +1513,7 @@ static int syslog_print(char __user *buf, int size) syslog_partial += n; } else n = 0; - raw_spin_unlock_irq(&syslog_lock); + spin_unlock_irq(&syslog_lock); if (!n) break; @@ -1577,9 +1577,9 @@ static int syslog_print_all(char __user *buf, int size, bool clear) } if (clear) { - raw_spin_lock_irq(&syslog_lock); + spin_lock_irq(&syslog_lock); latched_seq_write(&clear_seq, seq); - raw_spin_unlock_irq(&syslog_lock); + spin_unlock_irq(&syslog_lock); } kfree(text); @@ -1588,9 +1588,9 @@ static int syslog_print_all(char __user *buf, int size, bool clear) static void syslog_clear(void) { - raw_spin_lock_irq(&syslog_lock); + spin_lock_irq(&syslog_lock); latched_seq_write(&clear_seq, prb_next_seq(prb)); - raw_spin_unlock_irq(&syslog_lock); + spin_unlock_irq(&syslog_lock); } /* Return a consistent copy of @syslog_seq. */ @@ -1598,9 +1598,9 @@ static u64 read_syslog_seq_irq(void) { u64 seq; - raw_spin_lock_irq(&syslog_lock); + spin_lock_irq(&syslog_lock); seq = syslog_seq; - raw_spin_unlock_irq(&syslog_lock); + spin_unlock_irq(&syslog_lock); return seq; } @@ -1678,10 +1678,10 @@ int do_syslog(int type, char __user *buf, int len, int source) break; /* Number of chars in the log buffer */ case SYSLOG_ACTION_SIZE_UNREAD: - raw_spin_lock_irq(&syslog_lock); + spin_lock_irq(&syslog_lock); if (!prb_read_valid_info(prb, syslog_seq, &info, NULL)) { /* No unread messages. */ - raw_spin_unlock_irq(&syslog_lock); + spin_unlock_irq(&syslog_lock); return 0; } if (info.seq != syslog_seq) { @@ -1709,7 +1709,7 @@ int do_syslog(int type, char __user *buf, int len, int source) } error -= syslog_partial; } - raw_spin_unlock_irq(&syslog_lock); + spin_unlock_irq(&syslog_lock); break; /* Size of the log buffer */ case SYSLOG_ACTION_SIZE_BUFFER: @@ -3004,9 +3004,9 @@ void register_console(struct console *newcon) exclusive_console_stop_seq = console_seq; /* Get a consistent copy of @syslog_seq. */ - raw_spin_lock_irqsave(&syslog_lock, flags); + spin_lock_irqsave(&syslog_lock, flags); console_seq = syslog_seq; - raw_spin_unlock_irqrestore(&syslog_lock, flags); + spin_unlock_irqrestore(&syslog_lock, flags); } console_unlock(); console_sysfs_notify(); -- 2.43.0