diff options
| author | Mark Brown <broonie@kernel.org> | 2026-07-06 14:54:20 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-07-06 14:54:20 +0100 |
| commit | 4978a7cd0398e5b11b946a2bad8ca60de61cbf0e (patch) | |
| tree | e60c3b4f26e09d0eb8193365a82ccc239658e9a1 | |
| parent | 5b90fb1d1b94ea8dfacc21d6cd9ec7fde3a4e445 (diff) | |
| parent | e508a176d86f5ca0916ac1caf80806f9ad3d91ef (diff) | |
| download | linux-next-4978a7cd0398e5b11b946a2bad8ca60de61cbf0e.tar.gz linux-next-4978a7cd0398e5b11b946a2bad8ca60de61cbf0e.zip | |
Merge branch 'tty-next' of https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
| -rw-r--r-- | drivers/tty/goldfish.c | 23 | ||||
| -rw-r--r-- | include/linux/goldfish.h | 24 |
2 files changed, 14 insertions, 33 deletions
diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c index 16edd71a0d8d..fa723a4ba7b3 100644 --- a/drivers/tty/goldfish.c +++ b/drivers/tty/goldfish.c @@ -17,6 +17,7 @@ #include <linux/mm.h> #include <linux/dma-mapping.h> #include <linux/serial_core.h> +#include <linux/wordpart.h> /* Goldfish tty register's offsets */ #define GOLDFISH_TTY_REG_BYTES_READY 0x04 @@ -37,7 +38,6 @@ struct goldfish_tty { spinlock_t lock; void __iomem *base; u32 irq; - int opencount; struct console console; u32 version; struct device *dev; @@ -49,15 +49,23 @@ static u32 goldfish_tty_line_count = 8; static u32 goldfish_tty_current_line_count; static struct goldfish_tty *goldfish_ttys; +static inline void gf_write_addr(unsigned long addr, void __iomem *portl, void __iomem *porth) +{ + gf_iowrite32(lower_32_bits(addr), portl); +#ifdef CONFIG_64BIT + gf_iowrite32(upper_32_bits(addr), porth); +#endif +} + 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); - gf_write_ptr((void *)address, base + GOLDFISH_TTY_REG_DATA_PTR, - base + GOLDFISH_TTY_REG_DATA_PTR_HIGH); + 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); if (is_write) @@ -66,8 +74,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, @@ -409,7 +415,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); @@ -420,7 +426,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 diff --git a/include/linux/goldfish.h b/include/linux/goldfish.h index bcc17f95b906..98a4719c6776 100644 --- a/include/linux/goldfish.h +++ b/include/linux/goldfish.h @@ -2,8 +2,6 @@ #ifndef __LINUX_GOLDFISH_H #define __LINUX_GOLDFISH_H -#include <linux/kernel.h> -#include <linux/types.h> #include <linux/io.h> /* Helpers for Goldfish virtual platform */ @@ -15,26 +13,4 @@ #define gf_iowrite32 iowrite32 #endif -static inline void gf_write_ptr(const void *ptr, void __iomem *portl, - void __iomem *porth) -{ - const unsigned long addr = (unsigned long)ptr; - - gf_iowrite32(lower_32_bits(addr), portl); -#ifdef CONFIG_64BIT - gf_iowrite32(upper_32_bits(addr), porth); -#endif -} - -static inline void gf_write_dma_addr(const dma_addr_t addr, - void __iomem *portl, - void __iomem *porth) -{ - gf_iowrite32(lower_32_bits(addr), portl); -#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT - gf_iowrite32(upper_32_bits(addr), porth); -#endif -} - - #endif /* __LINUX_GOLDFISH_H */ |
