mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 09:41:03 +02:00
tty: goldfish: use guard() for locks
Using guard()s is cleaner and safer. goldfish_tty_probe() is omitted due to the crossing err_unmap goto-label. Using scoped_guard() does not look that nice there. Perhaps if someone refactored the locked part into a separate function... Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Link: https://patch.msgid.link/20260703084717.176442-4-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e31bd02f19
commit
e508a176d8
|
|
@ -61,10 +61,10 @@ static inline void gf_write_addr(unsigned long addr, void __iomem *portl, void _
|
|||
static void do_rw_io(struct goldfish_tty *qtty, unsigned long address,
|
||||
size_t count, bool is_write)
|
||||
{
|
||||
unsigned long irq_flags;
|
||||
void __iomem *base = qtty->base;
|
||||
|
||||
spin_lock_irqsave(&qtty->lock, irq_flags);
|
||||
guard(spinlock_irqsave)(&qtty->lock);
|
||||
|
||||
gf_write_addr(address, base + GOLDFISH_TTY_REG_DATA_PTR,
|
||||
base + GOLDFISH_TTY_REG_DATA_PTR_HIGH);
|
||||
gf_iowrite32(count, base + GOLDFISH_TTY_REG_DATA_LEN);
|
||||
|
|
@ -75,8 +75,6 @@ static void do_rw_io(struct goldfish_tty *qtty, unsigned long address,
|
|||
else
|
||||
gf_iowrite32(GOLDFISH_TTY_CMD_READ_BUFFER,
|
||||
base + GOLDFISH_TTY_REG_CMD);
|
||||
|
||||
spin_unlock_irqrestore(&qtty->lock, irq_flags);
|
||||
}
|
||||
|
||||
static void goldfish_tty_rw(struct goldfish_tty *qtty, unsigned long addr,
|
||||
|
|
@ -418,7 +416,7 @@ static void goldfish_tty_remove(struct platform_device *pdev)
|
|||
{
|
||||
struct goldfish_tty *qtty = platform_get_drvdata(pdev);
|
||||
|
||||
mutex_lock(&goldfish_tty_lock);
|
||||
guard(mutex)(&goldfish_tty_lock);
|
||||
|
||||
unregister_console(&qtty->console);
|
||||
tty_unregister_device(goldfish_tty_driver, qtty->console.index);
|
||||
|
|
@ -429,7 +427,6 @@ static void goldfish_tty_remove(struct platform_device *pdev)
|
|||
goldfish_tty_current_line_count--;
|
||||
if (goldfish_tty_current_line_count == 0)
|
||||
goldfish_tty_delete_driver();
|
||||
mutex_unlock(&goldfish_tty_lock);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GOLDFISH_TTY_EARLY_CONSOLE
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user