On 5/13/20 11:36 PM, Tony Asleson wrote:
Utilize the dev_printk function which will add structured data
to the log message.
Signed-off-by: Tony Asleson <tasleson@xxxxxxxxxx>
---
drivers/ata/libata-core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 42c8728f6117..16978d615a17 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -7301,6 +7301,7 @@ EXPORT_SYMBOL(ata_link_printk);
void ata_dev_printk(const struct ata_device *dev, const char *level,
const char *fmt, ...)
{
+ const struct device *gendev;
struct va_format vaf;
va_list args;
@@ -7309,9 +7310,12 @@ 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);
+ gendev = (dev->sdev) ? &dev->sdev->sdev_gendev : &dev->tdev;
+
+ dev_printk(level, gendev, "ata%u.%02u: %pV",
+ dev->link->ap->print_id,
+ dev->link->pmp + dev->devno,
+ &vaf);
va_end(args);
}
That is wrong.
dev_printk() will already prefix the logging message with the device
name, so we'll end up having the name printed twice.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@xxxxxxx +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer