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:
@@ -1108,8 +1108,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
|
||||
/* configure draining */
|
||||
buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL);
|
||||
if (!buf) {
|
||||
ata_dev_printk(dev, KERN_ERR,
|
||||
"drain buffer allocation failed\n");
|
||||
ata_dev_err(dev, "drain buffer allocation failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -1127,7 +1126,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
|
||||
* IDENTIFY_PACKET is executed as ATA_PROT_PIO.
|
||||
*/
|
||||
if (sdev->sector_size > PAGE_SIZE)
|
||||
ata_dev_printk(dev, KERN_WARNING,
|
||||
ata_dev_warn(dev,
|
||||
"sector_size=%u > PAGE_SIZE, PIO may malfunction\n",
|
||||
sdev->sector_size);
|
||||
|
||||
@@ -1784,8 +1783,7 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
|
||||
if (cmd->sc_data_direction == DMA_FROM_DEVICE ||
|
||||
cmd->sc_data_direction == DMA_TO_DEVICE) {
|
||||
if (unlikely(scsi_bufflen(cmd) < 1)) {
|
||||
ata_dev_printk(dev, KERN_WARNING,
|
||||
"WARNING: zero len r/w req\n");
|
||||
ata_dev_warn(dev, "WARNING: zero len r/w req\n");
|
||||
goto err_did;
|
||||
}
|
||||
|
||||
@@ -2969,9 +2967,8 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
|
||||
* with the cached multi_count of libata
|
||||
*/
|
||||
if (multi_count != dev->multi_count)
|
||||
ata_dev_printk(dev, KERN_WARNING,
|
||||
"invalid multi_count %u ignored\n",
|
||||
multi_count);
|
||||
ata_dev_warn(dev, "invalid multi_count %u ignored\n",
|
||||
multi_count);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3466,9 +3463,8 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
|
||||
goto repeat;
|
||||
}
|
||||
|
||||
ata_port_printk(ap, KERN_ERR, "WARNING: synchronous SCSI scan "
|
||||
"failed without making any progress,\n"
|
||||
" switching to async\n");
|
||||
ata_port_err(ap,
|
||||
"WARNING: synchronous SCSI scan failed without making any progress, switching to async\n");
|
||||
}
|
||||
|
||||
queue_delayed_work(system_long_wq, &ap->hotplug_task,
|
||||
@@ -3550,8 +3546,8 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
|
||||
mutex_unlock(&ap->scsi_host->scan_mutex);
|
||||
|
||||
if (sdev) {
|
||||
ata_dev_printk(dev, KERN_INFO, "detaching (SCSI %s)\n",
|
||||
dev_name(&sdev->sdev_gendev));
|
||||
ata_dev_info(dev, "detaching (SCSI %s)\n",
|
||||
dev_name(&sdev->sdev_gendev));
|
||||
|
||||
scsi_remove_device(sdev);
|
||||
scsi_device_put(sdev);
|
||||
|
Reference in New Issue
Block a user