[RFC 8/9] ata_dev_printk: Add durable name to output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we have a durable name we will add to output, else
we will default to existing message output format.

Signed-off-by: Tony Asleson <tasleson@xxxxxxxxxx>
---
 drivers/ata/libata-core.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 28c492be0a57..b57a74cfb529 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -7249,6 +7249,9 @@ EXPORT_SYMBOL(ata_link_printk);
 void ata_dev_printk(const struct ata_device *dev, const char *level,
 		    const char *fmt, ...)
 {
+	char dict[128];
+	int dict_len = 0;
+
 	struct va_format vaf;
 	va_list args;
 
@@ -7257,9 +7260,26 @@ void ata_dev_printk(const struct ata_device *dev, const char *level,
 	vaf.fmt = fmt;
 	vaf.va = &args;
 
-	printk("%sata%u.%02u: %pV",
-	       level, dev->link->ap->print_id, dev->link->pmp + dev->devno,
-	       &vaf);
+	if (dev->sdev) {
+		dict_len = dev_durable_name(
+			&dev->sdev->sdev_gendev,
+			dict,
+			sizeof(dict));
+	}
+
+	if (dict_len > 0) {
+		printk_emit(0, level[1] - '0', dict, dict_len,
+				"sata%u.%02u: %pV",
+				dev->link->ap->print_id,
+				dev->link->pmp + dev->devno,
+				&vaf);
+	} else {
+		printk("%sata%u.%02u: %pV",
+			level,
+			dev->link->ap->print_id,
+			dev->link->pmp + dev->devno,
+			&vaf);
+	}
 
 	va_end(args);
 }
-- 
2.21.0




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux