Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ata: libata: move ata_{port,link,dev}_dbg to standard pr_XXX() macros

Use standard pr_{debug,info,notice,warn,err} macros instead of the
hand-crafted printk helpers.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

authored by

Hannes Reinecke and committed by
Damien Le Moal
742bef47 c318458c

+67 -117
+26 -22
drivers/ata/libata-acpi.c
··· 650 650 struct ata_taskfile *pptf = NULL; 651 651 struct ata_taskfile tf, ptf, rtf; 652 652 unsigned int err_mask; 653 - const char *level; 654 653 const char *descr; 655 - char msg[60]; 656 654 int rc; 657 655 658 656 if ((gtf->tf[0] == 0) && (gtf->tf[1] == 0) && (gtf->tf[2] == 0) ··· 664 666 pptf = &ptf; 665 667 } 666 668 669 + descr = ata_get_cmd_descript(tf.command); 670 + if (!descr) 671 + descr = "unknown"; 672 + 667 673 if (!ata_acpi_filter_tf(dev, &tf, pptf)) { 668 674 rtf = tf; 669 675 err_mask = ata_exec_internal(dev, &rtf, NULL, ··· 675 673 676 674 switch (err_mask) { 677 675 case 0: 678 - level = KERN_DEBUG; 679 - snprintf(msg, sizeof(msg), "succeeded"); 676 + ata_dev_dbg(dev, 677 + "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x" 678 + "(%s) succeeded\n", 679 + tf.command, tf.feature, tf.nsect, tf.lbal, 680 + tf.lbam, tf.lbah, tf.device, descr); 680 681 rc = 1; 681 682 break; 682 683 683 684 case AC_ERR_DEV: 684 - level = KERN_INFO; 685 - snprintf(msg, sizeof(msg), 686 - "rejected by device (Stat=0x%02x Err=0x%02x)", 687 - rtf.command, rtf.feature); 685 + ata_dev_info(dev, 686 + "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x" 687 + "(%s) rejected by device (Stat=0x%02x Err=0x%02x)", 688 + tf.command, tf.feature, tf.nsect, tf.lbal, 689 + tf.lbam, tf.lbah, tf.device, descr, 690 + rtf.command, rtf.feature); 688 691 rc = 0; 689 692 break; 690 693 691 694 default: 692 - level = KERN_ERR; 693 - snprintf(msg, sizeof(msg), 694 - "failed (Emask=0x%x Stat=0x%02x Err=0x%02x)", 695 - err_mask, rtf.command, rtf.feature); 695 + ata_dev_err(dev, 696 + "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x" 697 + "(%s) failed (Emask=0x%x Stat=0x%02x Err=0x%02x)", 698 + tf.command, tf.feature, tf.nsect, tf.lbal, 699 + tf.lbam, tf.lbah, tf.device, descr, 700 + err_mask, rtf.command, rtf.feature); 696 701 rc = -EIO; 697 702 break; 698 703 } 699 704 } else { 700 - level = KERN_INFO; 701 - snprintf(msg, sizeof(msg), "filtered out"); 705 + ata_dev_info(dev, 706 + "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x" 707 + "(%s) filtered out\n", 708 + tf.command, tf.feature, tf.nsect, tf.lbal, 709 + tf.lbam, tf.lbah, tf.device, descr); 702 710 rc = 0; 703 711 } 704 - descr = ata_get_cmd_descript(tf.command); 705 - 706 - ata_dev_printk(dev, level, 707 - "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x (%s) %s\n", 708 - tf.command, tf.feature, tf.nsect, tf.lbal, 709 - tf.lbam, tf.lbah, tf.device, 710 - (descr ? descr : "unknown"), msg); 711 - 712 712 return rc; 713 713 } 714 714
-61
drivers/ata/libata-core.c
··· 6510 6510 }; 6511 6511 EXPORT_SYMBOL_GPL(ata_dummy_port_info); 6512 6512 6513 - /* 6514 - * Utility print functions 6515 - */ 6516 - void ata_port_printk(const struct ata_port *ap, const char *level, 6517 - const char *fmt, ...) 6518 - { 6519 - struct va_format vaf; 6520 - va_list args; 6521 - 6522 - va_start(args, fmt); 6523 - 6524 - vaf.fmt = fmt; 6525 - vaf.va = &args; 6526 - 6527 - printk("%sata%u: %pV", level, ap->print_id, &vaf); 6528 - 6529 - va_end(args); 6530 - } 6531 - EXPORT_SYMBOL(ata_port_printk); 6532 - 6533 - void ata_link_printk(const struct ata_link *link, const char *level, 6534 - const char *fmt, ...) 6535 - { 6536 - struct va_format vaf; 6537 - va_list args; 6538 - 6539 - va_start(args, fmt); 6540 - 6541 - vaf.fmt = fmt; 6542 - vaf.va = &args; 6543 - 6544 - if (sata_pmp_attached(link->ap) || link->ap->slave_link) 6545 - printk("%sata%u.%02u: %pV", 6546 - level, link->ap->print_id, link->pmp, &vaf); 6547 - else 6548 - printk("%sata%u: %pV", 6549 - level, link->ap->print_id, &vaf); 6550 - 6551 - va_end(args); 6552 - } 6553 - EXPORT_SYMBOL(ata_link_printk); 6554 - 6555 - void ata_dev_printk(const struct ata_device *dev, const char *level, 6556 - const char *fmt, ...) 6557 - { 6558 - struct va_format vaf; 6559 - va_list args; 6560 - 6561 - va_start(args, fmt); 6562 - 6563 - vaf.fmt = fmt; 6564 - vaf.va = &args; 6565 - 6566 - printk("%sata%u.%02u: %pV", 6567 - level, dev->link->ap->print_id, dev->link->pmp + dev->devno, 6568 - &vaf); 6569 - 6570 - va_end(args); 6571 - } 6572 - EXPORT_SYMBOL(ata_dev_printk); 6573 - 6574 6513 void ata_print_version(const struct device *dev, const char *version) 6575 6514 { 6576 6515 dev_printk(KERN_DEBUG, dev, "version %s\n", version);
+3 -3
drivers/ata/pata_ixp4xx_cf.c
··· 114 114 { 115 115 struct ixp4xx_pata *ixpp = ap->host->private_data; 116 116 117 - ata_dev_printk(adev, KERN_INFO, "configured for PIO%d 8bit\n", 117 + ata_dev_info(adev, "configured for PIO%d 8bit\n", 118 118 adev->pio_mode - XFER_PIO_0); 119 119 ixp4xx_set_8bit_timing(ixpp, adev->pio_mode); 120 120 } ··· 132 132 struct ixp4xx_pata *ixpp = ap->host->private_data; 133 133 unsigned long flags; 134 134 135 - ata_dev_printk(adev, KERN_DEBUG, "%s %d bytes\n", (rw == READ) ? "READ" : "WRITE", 136 - buflen); 135 + ata_dev_dbg(adev, "%s %d bytes\n", (rw == READ) ? "READ" : "WRITE", 136 + buflen); 137 137 spin_lock_irqsave(ap->lock, flags); 138 138 139 139 /* set the expansion bus in 16bit mode and restore
+38 -31
include/linux/libata.h
··· 1489 1489 return link->pmp; 1490 1490 } 1491 1491 1492 - /* 1493 - * printk helpers 1494 - */ 1495 - __printf(3, 4) 1496 - void ata_port_printk(const struct ata_port *ap, const char *level, 1497 - const char *fmt, ...); 1498 - __printf(3, 4) 1499 - void ata_link_printk(const struct ata_link *link, const char *level, 1500 - const char *fmt, ...); 1501 - __printf(3, 4) 1502 - void ata_dev_printk(const struct ata_device *dev, const char *level, 1503 - const char *fmt, ...); 1492 + #define ata_port_printk(level, ap, fmt, ...) \ 1493 + pr_ ## level ("ata%u: " fmt, (ap)->print_id, ##__VA_ARGS__) 1504 1494 1505 1495 #define ata_port_err(ap, fmt, ...) \ 1506 - ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__) 1496 + ata_port_printk(err, ap, fmt, ##__VA_ARGS__) 1507 1497 #define ata_port_warn(ap, fmt, ...) \ 1508 - ata_port_printk(ap, KERN_WARNING, fmt, ##__VA_ARGS__) 1498 + ata_port_printk(warn, ap, fmt, ##__VA_ARGS__) 1509 1499 #define ata_port_notice(ap, fmt, ...) \ 1510 - ata_port_printk(ap, KERN_NOTICE, fmt, ##__VA_ARGS__) 1500 + ata_port_printk(notice, ap, fmt, ##__VA_ARGS__) 1511 1501 #define ata_port_info(ap, fmt, ...) \ 1512 - ata_port_printk(ap, KERN_INFO, fmt, ##__VA_ARGS__) 1502 + ata_port_printk(info, ap, fmt, ##__VA_ARGS__) 1513 1503 #define ata_port_dbg(ap, fmt, ...) \ 1514 - ata_port_printk(ap, KERN_DEBUG, fmt, ##__VA_ARGS__) 1504 + ata_port_printk(debug, ap, fmt, ##__VA_ARGS__) 1505 + 1506 + #define ata_link_printk(level, link, fmt, ...) \ 1507 + do { \ 1508 + if (sata_pmp_attached((link)->ap) || \ 1509 + (link)->ap->slave_link) \ 1510 + pr_ ## level ("ata%u.%02u: " fmt, \ 1511 + (link)->ap->print_id, \ 1512 + (link)->pmp, \ 1513 + ##__VA_ARGS__); \ 1514 + else \ 1515 + pr_ ## level ("ata%u: " fmt, \ 1516 + (link)->ap->print_id, \ 1517 + ##__VA_ARGS__); \ 1518 + } while (0) 1515 1519 1516 1520 #define ata_link_err(link, fmt, ...) \ 1517 - ata_link_printk(link, KERN_ERR, fmt, ##__VA_ARGS__) 1521 + ata_link_printk(err, link, fmt, ##__VA_ARGS__) 1518 1522 #define ata_link_warn(link, fmt, ...) \ 1519 - ata_link_printk(link, KERN_WARNING, fmt, ##__VA_ARGS__) 1523 + ata_link_printk(warn, link, fmt, ##__VA_ARGS__) 1520 1524 #define ata_link_notice(link, fmt, ...) \ 1521 - ata_link_printk(link, KERN_NOTICE, fmt, ##__VA_ARGS__) 1525 + ata_link_printk(notice, link, fmt, ##__VA_ARGS__) 1522 1526 #define ata_link_info(link, fmt, ...) \ 1523 - ata_link_printk(link, KERN_INFO, fmt, ##__VA_ARGS__) 1527 + ata_link_printk(info, link, fmt, ##__VA_ARGS__) 1524 1528 #define ata_link_dbg(link, fmt, ...) \ 1525 - ata_link_printk(link, KERN_DEBUG, fmt, ##__VA_ARGS__) 1529 + ata_link_printk(debug, link, fmt, ##__VA_ARGS__) 1530 + 1531 + #define ata_dev_printk(level, dev, fmt, ...) \ 1532 + pr_ ## level("ata%u.%02u: " fmt, \ 1533 + (dev)->link->ap->print_id, \ 1534 + (dev)->link->pmp + (dev)->devno, \ 1535 + ##__VA_ARGS__) 1526 1536 1527 1537 #define ata_dev_err(dev, fmt, ...) \ 1528 - ata_dev_printk(dev, KERN_ERR, fmt, ##__VA_ARGS__) 1538 + ata_dev_printk(err, dev, fmt, ##__VA_ARGS__) 1529 1539 #define ata_dev_warn(dev, fmt, ...) \ 1530 - ata_dev_printk(dev, KERN_WARNING, fmt, ##__VA_ARGS__) 1540 + ata_dev_printk(warn, dev, fmt, ##__VA_ARGS__) 1531 1541 #define ata_dev_notice(dev, fmt, ...) \ 1532 - ata_dev_printk(dev, KERN_NOTICE, fmt, ##__VA_ARGS__) 1542 + ata_dev_printk(notice, dev, fmt, ##__VA_ARGS__) 1533 1543 #define ata_dev_info(dev, fmt, ...) \ 1534 - ata_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__) 1544 + ata_dev_printk(info, dev, fmt, ##__VA_ARGS__) 1535 1545 #define ata_dev_dbg(dev, fmt, ...) \ 1536 - ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__) 1546 + ata_dev_printk(debug, dev, fmt, ##__VA_ARGS__) 1537 1547 1538 1548 void ata_print_version(const struct device *dev, const char *version); 1539 1549 ··· 2077 2067 { 2078 2068 u8 status = ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 2079 2069 2080 - #ifdef ATA_DEBUG 2081 2070 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) 2082 - ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n", 2083 - status); 2084 - #endif 2071 + ata_port_dbg(ap, "abnormal Status 0x%X\n", status); 2085 2072 2086 2073 return status; 2087 2074 }