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>
This commit is contained in:
@@ -227,9 +227,9 @@ int ata_sff_busy_sleep(struct ata_port *ap,
|
||||
}
|
||||
|
||||
if (status != 0xff && (status & ATA_BUSY))
|
||||
ata_port_printk(ap, KERN_WARNING,
|
||||
"port is slow to respond, please be patient "
|
||||
"(Status 0x%x)\n", status);
|
||||
ata_port_warn(ap,
|
||||
"port is slow to respond, please be patient (Status 0x%x)\n",
|
||||
status);
|
||||
|
||||
timeout = ata_deadline(timer_start, tmout);
|
||||
while (status != 0xff && (status & ATA_BUSY) &&
|
||||
@@ -242,9 +242,9 @@ int ata_sff_busy_sleep(struct ata_port *ap,
|
||||
return -ENODEV;
|
||||
|
||||
if (status & ATA_BUSY) {
|
||||
ata_port_printk(ap, KERN_ERR, "port failed to respond "
|
||||
"(%lu secs, Status 0x%x)\n",
|
||||
DIV_ROUND_UP(tmout, 1000), status);
|
||||
ata_port_err(ap,
|
||||
"port failed to respond (%lu secs, Status 0x%x)\n",
|
||||
DIV_ROUND_UP(tmout, 1000), status);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
@@ -350,8 +350,8 @@ static void ata_dev_select(struct ata_port *ap, unsigned int device,
|
||||
unsigned int wait, unsigned int can_sleep)
|
||||
{
|
||||
if (ata_msg_probe(ap))
|
||||
ata_port_printk(ap, KERN_INFO, "ata_dev_select: ENTER, "
|
||||
"device %u, wait %u\n", device, wait);
|
||||
ata_port_info(ap, "ata_dev_select: ENTER, device %u, wait %u\n",
|
||||
device, wait);
|
||||
|
||||
if (wait)
|
||||
ata_wait_idle(ap);
|
||||
@@ -1335,7 +1335,7 @@ void ata_sff_flush_pio_task(struct ata_port *ap)
|
||||
ap->hsm_task_state = HSM_ST_IDLE;
|
||||
|
||||
if (ata_msg_ctl(ap))
|
||||
ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __func__);
|
||||
ata_port_dbg(ap, "%s: EXIT\n", __func__);
|
||||
}
|
||||
|
||||
static void ata_sff_pio_task(struct work_struct *work)
|
||||
@@ -1513,7 +1513,7 @@ static unsigned int ata_sff_idle_irq(struct ata_port *ap)
|
||||
ap->ops->sff_check_status(ap);
|
||||
if (ap->ops->sff_irq_clear)
|
||||
ap->ops->sff_irq_clear(ap);
|
||||
ata_port_printk(ap, KERN_WARNING, "irq trap\n");
|
||||
ata_port_warn(ap, "irq trap\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@@ -1711,7 +1711,7 @@ void ata_sff_lost_interrupt(struct ata_port *ap)
|
||||
|
||||
/* There was a command running, we are no longer busy and we have
|
||||
no interrupt. */
|
||||
ata_port_printk(ap, KERN_WARNING, "lost interrupt (Status 0x%x)\n",
|
||||
ata_port_warn(ap, "lost interrupt (Status 0x%x)\n",
|
||||
status);
|
||||
/* Run the host interrupt logic as if the interrupt had not been
|
||||
lost */
|
||||
@@ -1798,8 +1798,9 @@ int ata_sff_prereset(struct ata_link *link, unsigned long deadline)
|
||||
if (!ata_link_offline(link)) {
|
||||
rc = ata_sff_wait_ready(link, deadline);
|
||||
if (rc && rc != -ENODEV) {
|
||||
ata_link_printk(link, KERN_WARNING, "device not ready "
|
||||
"(errno=%d), forcing hardreset\n", rc);
|
||||
ata_link_warn(link,
|
||||
"device not ready (errno=%d), forcing hardreset\n",
|
||||
rc);
|
||||
ehc->i.action |= ATA_EH_HARDRESET;
|
||||
}
|
||||
}
|
||||
@@ -2056,7 +2057,7 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
|
||||
rc = ata_bus_softreset(ap, devmask, deadline);
|
||||
/* if link is occupied, -ENODEV too is an error */
|
||||
if (rc && (rc != -ENODEV || sata_scr_valid(link))) {
|
||||
ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc);
|
||||
ata_link_err(link, "SRST failed (errno=%d)\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2170,8 +2171,7 @@ void ata_sff_drain_fifo(struct ata_queued_cmd *qc)
|
||||
|
||||
/* Can become DEBUG later */
|
||||
if (count)
|
||||
ata_port_printk(ap, KERN_DEBUG,
|
||||
"drained %d bytes to clear DRQ.\n", count);
|
||||
ata_port_dbg(ap, "drained %d bytes to clear DRQ\n", count);
|
||||
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ata_sff_drain_fifo);
|
||||
|
مرجع در شماره جدید
Block a user