diff options
author | Joe Perches <joe@perches.com> | 2011-04-15 18:51:59 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2011-07-23 17:57:36 -0400 |
commit | a9a79dfec239568bdbf778242f8fcd10bcc5b9e2 (patch) | |
tree | 620648585f89cdb589d1625431f8c21ef70a9258 /drivers/ata/libahci.c | |
parent | a44fec1fce5d5d14cc3ac4545b8da346394de666 (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/libahci.c')
-rw-r--r-- | drivers/ata/libahci.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 39761f50a3e2..c102d7d64282 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -286,10 +286,10 @@ static ssize_t ahci_read_em_buffer(struct device *dev, | |||
286 | /* the count should not be larger than PAGE_SIZE */ | 286 | /* the count should not be larger than PAGE_SIZE */ |
287 | if (count > PAGE_SIZE) { | 287 | if (count > PAGE_SIZE) { |
288 | if (printk_ratelimit()) | 288 | if (printk_ratelimit()) |
289 | ata_port_printk(ap, KERN_WARNING, | 289 | ata_port_warn(ap, |
290 | "EM read buffer size too large: " | 290 | "EM read buffer size too large: " |
291 | "buffer size %u, page size %lu\n", | 291 | "buffer size %u, page size %lu\n", |
292 | hpriv->em_buf_sz, PAGE_SIZE); | 292 | hpriv->em_buf_sz, PAGE_SIZE); |
293 | count = PAGE_SIZE; | 293 | count = PAGE_SIZE; |
294 | } | 294 | } |
295 | 295 | ||
@@ -1124,8 +1124,8 @@ static void ahci_dev_config(struct ata_device *dev) | |||
1124 | 1124 | ||
1125 | if (hpriv->flags & AHCI_HFLAG_SECT255) { | 1125 | if (hpriv->flags & AHCI_HFLAG_SECT255) { |
1126 | dev->max_sectors = 255; | 1126 | dev->max_sectors = 255; |
1127 | ata_dev_printk(dev, KERN_INFO, | 1127 | ata_dev_info(dev, |
1128 | "SB600 AHCI: limiting to 255 sectors per cmd\n"); | 1128 | "SB600 AHCI: limiting to 255 sectors per cmd\n"); |
1129 | } | 1129 | } |
1130 | } | 1130 | } |
1131 | 1131 | ||
@@ -1249,8 +1249,7 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
1249 | /* prepare for SRST (AHCI-1.1 10.4.1) */ | 1249 | /* prepare for SRST (AHCI-1.1 10.4.1) */ |
1250 | rc = ahci_kick_engine(ap); | 1250 | rc = ahci_kick_engine(ap); |
1251 | if (rc && rc != -EOPNOTSUPP) | 1251 | if (rc && rc != -EOPNOTSUPP) |
1252 | ata_link_printk(link, KERN_WARNING, | 1252 | ata_link_warn(link, "failed to reset engine (errno=%d)\n", rc); |
1253 | "failed to reset engine (errno=%d)\n", rc); | ||
1254 | 1253 | ||
1255 | ata_tf_init(link->device, &tf); | 1254 | ata_tf_init(link->device, &tf); |
1256 | 1255 | ||
@@ -1283,8 +1282,7 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
1283 | * be trusted. Treat device readiness timeout as link | 1282 | * be trusted. Treat device readiness timeout as link |
1284 | * offline. | 1283 | * offline. |
1285 | */ | 1284 | */ |
1286 | ata_link_printk(link, KERN_INFO, | 1285 | ata_link_info(link, "device not ready, treating as offline\n"); |
1287 | "device not ready, treating as offline\n"); | ||
1288 | *class = ATA_DEV_NONE; | 1286 | *class = ATA_DEV_NONE; |
1289 | } else if (rc) { | 1287 | } else if (rc) { |
1290 | /* link occupied, -ENODEV too is an error */ | 1288 | /* link occupied, -ENODEV too is an error */ |
@@ -1297,7 +1295,7 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
1297 | return 0; | 1295 | return 0; |
1298 | 1296 | ||
1299 | fail: | 1297 | fail: |
1300 | ata_link_printk(link, KERN_ERR, "softreset failed (%s)\n", reason); | 1298 | ata_link_err(link, "softreset failed (%s)\n", reason); |
1301 | return rc; | 1299 | return rc; |
1302 | } | 1300 | } |
1303 | 1301 | ||
@@ -1966,7 +1964,7 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) | |||
1966 | if (rc == 0) | 1964 | if (rc == 0) |
1967 | ahci_power_down(ap); | 1965 | ahci_power_down(ap); |
1968 | else { | 1966 | else { |
1969 | ata_port_printk(ap, KERN_ERR, "%s (%d)\n", emsg, rc); | 1967 | ata_port_err(ap, "%s (%d)\n", emsg, rc); |
1970 | ahci_start_port(ap); | 1968 | ahci_start_port(ap); |
1971 | } | 1969 | } |
1972 | 1970 | ||
@@ -2061,7 +2059,7 @@ static void ahci_port_stop(struct ata_port *ap) | |||
2061 | /* de-initialize port */ | 2059 | /* de-initialize port */ |
2062 | rc = ahci_deinit_port(ap, &emsg); | 2060 | rc = ahci_deinit_port(ap, &emsg); |
2063 | if (rc) | 2061 | if (rc) |
2064 | ata_port_printk(ap, KERN_WARNING, "%s (%d)\n", emsg, rc); | 2062 | ata_port_warn(ap, "%s (%d)\n", emsg, rc); |
2065 | } | 2063 | } |
2066 | 2064 | ||
2067 | void ahci_print_info(struct ata_host *host, const char *scc_s) | 2065 | void ahci_print_info(struct ata_host *host, const char *scc_s) |