Skip to contentSkip to conversation

ata: libata-core: Simplify ata_print_version_once

PATCH Applied Heiner Kallweit 2 participants 2 messages Apr 11, 2025 – Apr 14, 2025 libata

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ata: libata-core: Simplify ata_print_version_once

Use dev_dbg_once() instead of open-coding the once functionality.

---
v2:
- inline ata_print_version_once

---
 drivers/ata/libata-core.c |  6 ------
 include/linux/libata.h    | 17 +++++------------
 2 files changed, 5 insertions(+), 18 deletions(-)
drivers/ata/libata-core.c +0 -6
index 773799cfd..79b20da0a 100644
@@ -6682,12 +6682,6 @@ const struct ata_port_info ata_dummy_port_info = {
 };
 EXPORT_SYMBOL_GPL(ata_dummy_port_info);
 
-void ata_print_version(const struct device *dev, const char *version)
-{
-	dev_printk(KERN_DEBUG, dev, "version %s\n", version);
-}
-EXPORT_SYMBOL(ata_print_version);
-
 EXPORT_TRACEPOINT_SYMBOL_GPL(ata_tf_load);
 EXPORT_TRACEPOINT_SYMBOL_GPL(ata_exec_command);
 EXPORT_TRACEPOINT_SYMBOL_GPL(ata_bmdma_setup);
include/linux/libata.h +5 -12
index e5695998a..98affa1d9 100644
@@ -41,17 +41,6 @@
  */
 #undef ATA_IRQ_TRAP		/* define to ack screaming irqs */
 
-
-#define ata_print_version_once(dev, version)			\
-({								\
-	static bool __print_once;				\
-								\
-	if (!__print_once) {					\
-		__print_once = true;				\
-		ata_print_version(dev, version);		\
-	}							\
-})
-
 /* defines only for the constants which don't work well as enums */
 #define ATA_TAG_POISON		0xfafbfcfdU
 
@@ -1593,7 +1582,11 @@ do {								\
 #define ata_dev_dbg(dev, fmt, ...)				\
 	ata_dev_printk(debug, dev, fmt, ##__VA_ARGS__)
 
-void ata_print_version(const struct device *dev, const char *version);
+static inline void ata_print_version_once(const struct device *dev,
+					  const char *version)
+{
+	dev_dbg_once(dev, "version %s\n", version);
+}
 
 /*
  * ata_eh_info helpers
Signature · 1 line
2.49.0
maintainer Applied
#1 lore raw
Quoted 3 lines · Heiner Kallweit

Use dev_dbg_once() instead of open-coding the once functionality.

Applied to for-6.16. Thanks !

Signature · 2 lines
Damien Le Moal
Western Digital Research