Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH 1/4] goldfish: remove unused gf_write_dma_addr()
@ 2026-07-03  8:47 Jiri Slaby (SUSE)
  2026-07-03  8:47 ` [PATCH 2/4] tty: goldfish: drop unused goldfish_tty::opencount Jiri Slaby (SUSE)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiri Slaby (SUSE) @ 2026-07-03  8:47 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)

The last user was removed in 2020 by commit c869eaa617e4 ("drivers:
staging: retire drivers/staging/goldfish").

Drop it.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
 include/linux/goldfish.h | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/include/linux/goldfish.h b/include/linux/goldfish.h
index bcc17f95b906..40a059e03d78 100644
--- a/include/linux/goldfish.h
+++ b/include/linux/goldfish.h
@@ -26,15 +26,4 @@ static inline void gf_write_ptr(const void *ptr, void __iomem *portl,
 #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 */
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/4] tty: goldfish: drop unused goldfish_tty::opencount
  2026-07-03  8:47 [PATCH 1/4] goldfish: remove unused gf_write_dma_addr() Jiri Slaby (SUSE)
@ 2026-07-03  8:47 ` Jiri Slaby (SUSE)
  2026-07-03  8:47 ` [PATCH 3/4] tty: goldfish: move gf_write_ptr() to tty/goldfish.c Jiri Slaby (SUSE)
  2026-07-03  8:47 ` [PATCH 4/4] tty: goldfish: use guard() for locks Jiri Slaby (SUSE)
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby (SUSE) @ 2026-07-03  8:47 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)

The field was never used.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
 drivers/tty/goldfish.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c
index 16edd71a0d8d..69367d878877 100644
--- a/drivers/tty/goldfish.c
+++ b/drivers/tty/goldfish.c
@@ -37,7 +37,6 @@ struct goldfish_tty {
 	spinlock_t lock;
 	void __iomem *base;
 	u32 irq;
-	int opencount;
 	struct console console;
 	u32 version;
 	struct device *dev;
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/4] tty: goldfish: move gf_write_ptr() to tty/goldfish.c
  2026-07-03  8:47 [PATCH 1/4] goldfish: remove unused gf_write_dma_addr() Jiri Slaby (SUSE)
  2026-07-03  8:47 ` [PATCH 2/4] tty: goldfish: drop unused goldfish_tty::opencount Jiri Slaby (SUSE)
@ 2026-07-03  8:47 ` Jiri Slaby (SUSE)
  2026-07-03  8:47 ` [PATCH 4/4] tty: goldfish: use guard() for locks Jiri Slaby (SUSE)
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby (SUSE) @ 2026-07-03  8:47 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)

tty/goldfish.c is the only user of gf_write_ptr(). Move it there, drop
the unneeded casts, and name it appropriately.

FTR, the last non-tty user was removed in 2018 by 4ae0fe70a097 ("Delete
the goldfish_nand driver.").

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
 drivers/tty/goldfish.c   | 13 +++++++++++--
 include/linux/goldfish.h | 13 -------------
 2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c
index 69367d878877..c643d76e9d1b 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
@@ -48,6 +49,14 @@ 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)
 {
@@ -55,8 +64,8 @@ static void do_rw_io(struct goldfish_tty *qtty, unsigned long address,
 	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);
+	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)
diff --git a/include/linux/goldfish.h b/include/linux/goldfish.h
index 40a059e03d78..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,15 +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
-}
-
 #endif /* __LINUX_GOLDFISH_H */
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 4/4] tty: goldfish: use guard() for locks
  2026-07-03  8:47 [PATCH 1/4] goldfish: remove unused gf_write_dma_addr() Jiri Slaby (SUSE)
  2026-07-03  8:47 ` [PATCH 2/4] tty: goldfish: drop unused goldfish_tty::opencount Jiri Slaby (SUSE)
  2026-07-03  8:47 ` [PATCH 3/4] tty: goldfish: move gf_write_ptr() to tty/goldfish.c Jiri Slaby (SUSE)
@ 2026-07-03  8:47 ` Jiri Slaby (SUSE)
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby (SUSE) @ 2026-07-03  8:47 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)

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>
---
 drivers/tty/goldfish.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c
index c643d76e9d1b..fa723a4ba7b3 100644
--- a/drivers/tty/goldfish.c
+++ b/drivers/tty/goldfish.c
@@ -60,10 +60,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);
@@ -74,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,
@@ -417,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);
@@ -428,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
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-03  8:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-03  8:47 [PATCH 1/4] goldfish: remove unused gf_write_dma_addr() Jiri Slaby (SUSE)
2026-07-03  8:47 ` [PATCH 2/4] tty: goldfish: drop unused goldfish_tty::opencount Jiri Slaby (SUSE)
2026-07-03  8:47 ` [PATCH 3/4] tty: goldfish: move gf_write_ptr() to tty/goldfish.c Jiri Slaby (SUSE)
2026-07-03  8:47 ` [PATCH 4/4] tty: goldfish: use guard() for locks Jiri Slaby (SUSE)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox