aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_nv.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-04-15 18:51:59 -0400
committerJeff Garzik <jgarzik@pobox.com>2011-07-23 17:57:36 -0400
commita9a79dfec239568bdbf778242f8fcd10bcc5b9e2 (patch)
tree620648585f89cdb589d1625431f8c21ef70a9258 /drivers/ata/sata_nv.c
parenta44fec1fce5d5d14cc3ac4545b8da346394de666 (diff)
ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level>
Saves text by removing nearly duplicated text format strings by creating ata_<foo>_printk functions and printf extension %pV. ata defconfig size shrinks ~5% (~8KB), allyesconfig ~2.5% (~13KB) Format string duplication comes from: #define ata_link_printk(link, lv, fmt, args...) do { \ if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \ printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ (link)->pmp , ##args); \ else \ printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \ } while(0) Coalesce long formats. $ size drivers/ata/built-in.* text data bss dec hex filename 544969 73893 116584 735446 b38d6 drivers/ata/built-in.allyesconfig.ata.o 558429 73893 117864 750186 b726a drivers/ata/built-in.allyesconfig.dev_level.o 141328 14689 4220 160237 271ed drivers/ata/built-in.defconfig.ata.o 149567 14689 4220 168476 2921c drivers/ata/built-in.defconfig.dev_level.o Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/ata/sata_nv.c')
-rw-r--r--drivers/ata/sata_nv.c69
1 files changed, 33 insertions, 36 deletions
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index f215e10c11cf..b33f525df0f5 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -620,9 +620,8 @@ static void nv_adma_register_mode(struct ata_port *ap)
620 count++; 620 count++;
621 } 621 }
622 if (count == 20) 622 if (count == 20)
623 ata_port_printk(ap, KERN_WARNING, 623 ata_port_warn(ap, "timeout waiting for ADMA IDLE, stat=0x%hx\n",
624 "timeout waiting for ADMA IDLE, stat=0x%hx\n", 624 status);
625 status);
626 625
627 tmp = readw(mmio + NV_ADMA_CTL); 626 tmp = readw(mmio + NV_ADMA_CTL);
628 writew(tmp & ~NV_ADMA_CTL_GO, mmio + NV_ADMA_CTL); 627 writew(tmp & ~NV_ADMA_CTL_GO, mmio + NV_ADMA_CTL);
@@ -635,9 +634,9 @@ static void nv_adma_register_mode(struct ata_port *ap)
635 count++; 634 count++;
636 } 635 }
637 if (count == 20) 636 if (count == 20)
638 ata_port_printk(ap, KERN_WARNING, 637 ata_port_warn(ap,
639 "timeout waiting for ADMA LEGACY, stat=0x%hx\n", 638 "timeout waiting for ADMA LEGACY, stat=0x%hx\n",
640 status); 639 status);
641 640
642 pp->flags |= NV_ADMA_PORT_REGISTER_MODE; 641 pp->flags |= NV_ADMA_PORT_REGISTER_MODE;
643} 642}
@@ -665,7 +664,7 @@ static void nv_adma_mode(struct ata_port *ap)
665 count++; 664 count++;
666 } 665 }
667 if (count == 20) 666 if (count == 20)
668 ata_port_printk(ap, KERN_WARNING, 667 ata_port_warn(ap,
669 "timeout waiting for ADMA LEGACY clear and IDLE, stat=0x%hx\n", 668 "timeout waiting for ADMA LEGACY clear and IDLE, stat=0x%hx\n",
670 status); 669 status);
671 670
@@ -772,10 +771,10 @@ static int nv_adma_slave_config(struct scsi_device *sdev)
772 771
773 blk_queue_segment_boundary(sdev->request_queue, segment_boundary); 772 blk_queue_segment_boundary(sdev->request_queue, segment_boundary);
774 blk_queue_max_segments(sdev->request_queue, sg_tablesize); 773 blk_queue_max_segments(sdev->request_queue, sg_tablesize);
775 ata_port_printk(ap, KERN_INFO, 774 ata_port_info(ap,
776 "DMA mask 0x%llX, segment boundary 0x%lX, hw segs %hu\n", 775 "DMA mask 0x%llX, segment boundary 0x%lX, hw segs %hu\n",
777 (unsigned long long)*ap->host->dev->dma_mask, 776 (unsigned long long)*ap->host->dev->dma_mask,
778 segment_boundary, sg_tablesize); 777 segment_boundary, sg_tablesize);
779 778
780 spin_unlock_irqrestore(ap->lock, flags); 779 spin_unlock_irqrestore(ap->lock, flags);
781 780
@@ -1443,8 +1442,7 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)
1443 existing commands. */ 1442 existing commands. */
1444 if (unlikely(qc->tf.protocol == ATA_PROT_NCQ && 1443 if (unlikely(qc->tf.protocol == ATA_PROT_NCQ &&
1445 (qc->flags & ATA_QCFLAG_RESULT_TF))) { 1444 (qc->flags & ATA_QCFLAG_RESULT_TF))) {
1446 ata_dev_printk(qc->dev, KERN_ERR, 1445 ata_dev_err(qc->dev, "NCQ w/ RESULT_TF not allowed\n");
1447 "NCQ w/ RESULT_TF not allowed\n");
1448 return AC_ERR_SYSTEM; 1446 return AC_ERR_SYSTEM;
1449 } 1447 }
1450 1448
@@ -1581,15 +1579,15 @@ static int nv_hardreset(struct ata_link *link, unsigned int *class,
1581 int rc; 1579 int rc;
1582 1580
1583 if (!(ehc->i.flags & ATA_EHI_QUIET)) 1581 if (!(ehc->i.flags & ATA_EHI_QUIET))
1584 ata_link_printk(link, KERN_INFO, "nv: skipping " 1582 ata_link_info(link,
1585 "hardreset on occupied port\n"); 1583 "nv: skipping hardreset on occupied port\n");
1586 1584
1587 /* make sure the link is online */ 1585 /* make sure the link is online */
1588 rc = sata_link_resume(link, timing, deadline); 1586 rc = sata_link_resume(link, timing, deadline);
1589 /* whine about phy resume failure but proceed */ 1587 /* whine about phy resume failure but proceed */
1590 if (rc && rc != -EOPNOTSUPP) 1588 if (rc && rc != -EOPNOTSUPP)
1591 ata_link_printk(link, KERN_WARNING, "failed to resume " 1589 ata_link_warn(link, "failed to resume link (errno=%d)\n",
1592 "link (errno=%d)\n", rc); 1590 rc);
1593 } 1591 }
1594 1592
1595 /* device signature acquisition is unreliable */ 1593 /* device signature acquisition is unreliable */
@@ -1686,7 +1684,7 @@ static void nv_adma_error_handler(struct ata_port *ap)
1686 u8 cpb_count = readb(mmio + NV_ADMA_CPB_COUNT); 1684 u8 cpb_count = readb(mmio + NV_ADMA_CPB_COUNT);
1687 u8 next_cpb_idx = readb(mmio + NV_ADMA_NEXT_CPB_IDX); 1685 u8 next_cpb_idx = readb(mmio + NV_ADMA_NEXT_CPB_IDX);
1688 1686
1689 ata_port_printk(ap, KERN_ERR, 1687 ata_port_err(ap,
1690 "EH in ADMA mode, notifier 0x%X " 1688 "EH in ADMA mode, notifier 0x%X "
1691 "notifier_error 0x%X gen_ctl 0x%X status 0x%X " 1689 "notifier_error 0x%X gen_ctl 0x%X status 0x%X "
1692 "next cpb count 0x%X next cpb idx 0x%x\n", 1690 "next cpb count 0x%X next cpb idx 0x%x\n",
@@ -1697,7 +1695,7 @@ static void nv_adma_error_handler(struct ata_port *ap)
1697 struct nv_adma_cpb *cpb = &pp->cpb[i]; 1695 struct nv_adma_cpb *cpb = &pp->cpb[i];
1698 if ((ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) || 1696 if ((ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) ||
1699 ap->link.sactive & (1 << i)) 1697 ap->link.sactive & (1 << i))
1700 ata_port_printk(ap, KERN_ERR, 1698 ata_port_err(ap,
1701 "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n", 1699 "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n",
1702 i, cpb->ctl_flags, cpb->resp_flags); 1700 i, cpb->ctl_flags, cpb->resp_flags);
1703 } 1701 }
@@ -1799,23 +1797,22 @@ static void nv_swncq_ncq_stop(struct ata_port *ap)
1799 u32 sactive; 1797 u32 sactive;
1800 u32 done_mask; 1798 u32 done_mask;
1801 1799
1802 ata_port_printk(ap, KERN_ERR, 1800 ata_port_err(ap, "EH in SWNCQ mode,QC:qc_active 0x%X sactive 0x%X\n",
1803 "EH in SWNCQ mode,QC:qc_active 0x%X sactive 0x%X\n", 1801 ap->qc_active, ap->link.sactive);
1804 ap->qc_active, ap->link.sactive); 1802 ata_port_err(ap,
1805 ata_port_printk(ap, KERN_ERR,
1806 "SWNCQ:qc_active 0x%X defer_bits 0x%X last_issue_tag 0x%x\n " 1803 "SWNCQ:qc_active 0x%X defer_bits 0x%X last_issue_tag 0x%x\n "
1807 "dhfis 0x%X dmafis 0x%X sdbfis 0x%X\n", 1804 "dhfis 0x%X dmafis 0x%X sdbfis 0x%X\n",
1808 pp->qc_active, pp->defer_queue.defer_bits, pp->last_issue_tag, 1805 pp->qc_active, pp->defer_queue.defer_bits, pp->last_issue_tag,
1809 pp->dhfis_bits, pp->dmafis_bits, pp->sdbfis_bits); 1806 pp->dhfis_bits, pp->dmafis_bits, pp->sdbfis_bits);
1810 1807
1811 ata_port_printk(ap, KERN_ERR, "ATA_REG 0x%X ERR_REG 0x%X\n", 1808 ata_port_err(ap, "ATA_REG 0x%X ERR_REG 0x%X\n",
1812 ap->ops->sff_check_status(ap), 1809 ap->ops->sff_check_status(ap),
1813 ioread8(ap->ioaddr.error_addr)); 1810 ioread8(ap->ioaddr.error_addr));
1814 1811
1815 sactive = readl(pp->sactive_block); 1812 sactive = readl(pp->sactive_block);
1816 done_mask = pp->qc_active ^ sactive; 1813 done_mask = pp->qc_active ^ sactive;
1817 1814
1818 ata_port_printk(ap, KERN_ERR, "tag : dhfis dmafis sdbfis sacitve\n"); 1815 ata_port_err(ap, "tag : dhfis dmafis sdbfis sactive\n");
1819 for (i = 0; i < ATA_MAX_QUEUE; i++) { 1816 for (i = 0; i < ATA_MAX_QUEUE; i++) {
1820 u8 err = 0; 1817 u8 err = 0;
1821 if (pp->qc_active & (1 << i)) 1818 if (pp->qc_active & (1 << i))
@@ -1825,13 +1822,13 @@ static void nv_swncq_ncq_stop(struct ata_port *ap)
1825 else 1822 else
1826 continue; 1823 continue;
1827 1824
1828 ata_port_printk(ap, KERN_ERR, 1825 ata_port_err(ap,
1829 "tag 0x%x: %01x %01x %01x %01x %s\n", i, 1826 "tag 0x%x: %01x %01x %01x %01x %s\n", i,
1830 (pp->dhfis_bits >> i) & 0x1, 1827 (pp->dhfis_bits >> i) & 0x1,
1831 (pp->dmafis_bits >> i) & 0x1, 1828 (pp->dmafis_bits >> i) & 0x1,
1832 (pp->sdbfis_bits >> i) & 0x1, 1829 (pp->sdbfis_bits >> i) & 0x1,
1833 (sactive >> i) & 0x1, 1830 (sactive >> i) & 0x1,
1834 (err ? "error! tag doesn't exit" : " ")); 1831 (err ? "error! tag doesn't exit" : " "));
1835 } 1832 }
1836 1833
1837 nv_swncq_pp_reinit(ap); 1834 nv_swncq_pp_reinit(ap);
@@ -1956,8 +1953,8 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)
1956 1953
1957 if (strncmp(model_num, "Maxtor", 6) == 0) { 1954 if (strncmp(model_num, "Maxtor", 6) == 0) {
1958 ata_scsi_change_queue_depth(sdev, 1, SCSI_QDEPTH_DEFAULT); 1955 ata_scsi_change_queue_depth(sdev, 1, SCSI_QDEPTH_DEFAULT);
1959 ata_dev_printk(dev, KERN_NOTICE, 1956 ata_dev_notice(dev, "Disabling SWNCQ mode (depth %x)\n",
1960 "Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth); 1957 sdev->queue_depth);
1961 } 1958 }
1962 1959
1963 return rc; 1960 return rc;