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/libata-acpi.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/libata-acpi.c')
-rw-r--r-- | drivers/ata/libata-acpi.c | 66 |
1 files changed, 28 insertions, 38 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index a791b8ce6294..e0a5b555cee1 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -332,25 +332,22 @@ int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *gtm) | |||
332 | 332 | ||
333 | rc = -EINVAL; | 333 | rc = -EINVAL; |
334 | if (ACPI_FAILURE(status)) { | 334 | if (ACPI_FAILURE(status)) { |
335 | ata_port_printk(ap, KERN_ERR, | 335 | ata_port_err(ap, "ACPI get timing mode failed (AE 0x%x)\n", |
336 | "ACPI get timing mode failed (AE 0x%x)\n", | 336 | status); |
337 | status); | ||
338 | goto out_free; | 337 | goto out_free; |
339 | } | 338 | } |
340 | 339 | ||
341 | out_obj = output.pointer; | 340 | out_obj = output.pointer; |
342 | if (out_obj->type != ACPI_TYPE_BUFFER) { | 341 | if (out_obj->type != ACPI_TYPE_BUFFER) { |
343 | ata_port_printk(ap, KERN_WARNING, | 342 | ata_port_warn(ap, "_GTM returned unexpected object type 0x%x\n", |
344 | "_GTM returned unexpected object type 0x%x\n", | 343 | out_obj->type); |
345 | out_obj->type); | ||
346 | 344 | ||
347 | goto out_free; | 345 | goto out_free; |
348 | } | 346 | } |
349 | 347 | ||
350 | if (out_obj->buffer.length != sizeof(struct ata_acpi_gtm)) { | 348 | if (out_obj->buffer.length != sizeof(struct ata_acpi_gtm)) { |
351 | ata_port_printk(ap, KERN_ERR, | 349 | ata_port_err(ap, "_GTM returned invalid length %d\n", |
352 | "_GTM returned invalid length %d\n", | 350 | out_obj->buffer.length); |
353 | out_obj->buffer.length); | ||
354 | goto out_free; | 351 | goto out_free; |
355 | } | 352 | } |
356 | 353 | ||
@@ -402,8 +399,8 @@ int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm) | |||
402 | if (status == AE_NOT_FOUND) | 399 | if (status == AE_NOT_FOUND) |
403 | return -ENOENT; | 400 | return -ENOENT; |
404 | if (ACPI_FAILURE(status)) { | 401 | if (ACPI_FAILURE(status)) { |
405 | ata_port_printk(ap, KERN_ERR, | 402 | ata_port_err(ap, "ACPI set timing mode failed (status=0x%x)\n", |
406 | "ACPI set timing mode failed (status=0x%x)\n", status); | 403 | status); |
407 | return -EINVAL; | 404 | return -EINVAL; |
408 | } | 405 | } |
409 | return 0; | 406 | return 0; |
@@ -450,8 +447,8 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf) | |||
450 | output.pointer = NULL; /* ACPI-CA sets this; save/free it later */ | 447 | output.pointer = NULL; /* ACPI-CA sets this; save/free it later */ |
451 | 448 | ||
452 | if (ata_msg_probe(ap)) | 449 | if (ata_msg_probe(ap)) |
453 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", | 450 | ata_dev_dbg(dev, "%s: ENTER: port#: %d\n", |
454 | __func__, ap->port_no); | 451 | __func__, ap->port_no); |
455 | 452 | ||
456 | /* _GTF has no input parameters */ | 453 | /* _GTF has no input parameters */ |
457 | status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output); | 454 | status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output); |
@@ -459,9 +456,8 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf) | |||
459 | 456 | ||
460 | if (ACPI_FAILURE(status)) { | 457 | if (ACPI_FAILURE(status)) { |
461 | if (status != AE_NOT_FOUND) { | 458 | if (status != AE_NOT_FOUND) { |
462 | ata_dev_printk(dev, KERN_WARNING, | 459 | ata_dev_warn(dev, "_GTF evaluation failed (AE 0x%x)\n", |
463 | "_GTF evaluation failed (AE 0x%x)\n", | 460 | status); |
464 | status); | ||
465 | rc = -EINVAL; | 461 | rc = -EINVAL; |
466 | } | 462 | } |
467 | goto out_free; | 463 | goto out_free; |
@@ -469,27 +465,24 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf) | |||
469 | 465 | ||
470 | if (!output.length || !output.pointer) { | 466 | if (!output.length || !output.pointer) { |
471 | if (ata_msg_probe(ap)) | 467 | if (ata_msg_probe(ap)) |
472 | ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " | 468 | ata_dev_dbg(dev, "%s: Run _GTF: length or ptr is NULL (0x%llx, 0x%p)\n", |
473 | "length or ptr is NULL (0x%llx, 0x%p)\n", | 469 | __func__, |
474 | __func__, | 470 | (unsigned long long)output.length, |
475 | (unsigned long long)output.length, | 471 | output.pointer); |
476 | output.pointer); | ||
477 | rc = -EINVAL; | 472 | rc = -EINVAL; |
478 | goto out_free; | 473 | goto out_free; |
479 | } | 474 | } |
480 | 475 | ||
481 | if (out_obj->type != ACPI_TYPE_BUFFER) { | 476 | if (out_obj->type != ACPI_TYPE_BUFFER) { |
482 | ata_dev_printk(dev, KERN_WARNING, | 477 | ata_dev_warn(dev, "_GTF unexpected object type 0x%x\n", |
483 | "_GTF unexpected object type 0x%x\n", | 478 | out_obj->type); |
484 | out_obj->type); | ||
485 | rc = -EINVAL; | 479 | rc = -EINVAL; |
486 | goto out_free; | 480 | goto out_free; |
487 | } | 481 | } |
488 | 482 | ||
489 | if (out_obj->buffer.length % REGS_PER_GTF) { | 483 | if (out_obj->buffer.length % REGS_PER_GTF) { |
490 | ata_dev_printk(dev, KERN_WARNING, | 484 | ata_dev_warn(dev, "unexpected _GTF length (%d)\n", |
491 | "unexpected _GTF length (%d)\n", | 485 | out_obj->buffer.length); |
492 | out_obj->buffer.length); | ||
493 | rc = -EINVAL; | 486 | rc = -EINVAL; |
494 | goto out_free; | 487 | goto out_free; |
495 | } | 488 | } |
@@ -499,9 +492,8 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf) | |||
499 | if (gtf) { | 492 | if (gtf) { |
500 | *gtf = (void *)out_obj->buffer.pointer; | 493 | *gtf = (void *)out_obj->buffer.pointer; |
501 | if (ata_msg_probe(ap)) | 494 | if (ata_msg_probe(ap)) |
502 | ata_dev_printk(dev, KERN_DEBUG, | 495 | ata_dev_dbg(dev, "%s: returning gtf=%p, gtf_count=%d\n", |
503 | "%s: returning gtf=%p, gtf_count=%d\n", | 496 | __func__, *gtf, rc); |
504 | __func__, *gtf, rc); | ||
505 | } | 497 | } |
506 | return rc; | 498 | return rc; |
507 | 499 | ||
@@ -811,8 +803,8 @@ static int ata_acpi_push_id(struct ata_device *dev) | |||
811 | union acpi_object in_params[1]; | 803 | union acpi_object in_params[1]; |
812 | 804 | ||
813 | if (ata_msg_probe(ap)) | 805 | if (ata_msg_probe(ap)) |
814 | ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", | 806 | ata_dev_dbg(dev, "%s: ix = %d, port#: %d\n", |
815 | __func__, dev->devno, ap->port_no); | 807 | __func__, dev->devno, ap->port_no); |
816 | 808 | ||
817 | /* Give the drive Identify data to the drive via the _SDD method */ | 809 | /* Give the drive Identify data to the drive via the _SDD method */ |
818 | /* _SDD: set up input parameters */ | 810 | /* _SDD: set up input parameters */ |
@@ -832,8 +824,7 @@ static int ata_acpi_push_id(struct ata_device *dev) | |||
832 | return -ENOENT; | 824 | return -ENOENT; |
833 | 825 | ||
834 | if (ACPI_FAILURE(status)) { | 826 | if (ACPI_FAILURE(status)) { |
835 | ata_dev_printk(dev, KERN_WARNING, | 827 | ata_dev_warn(dev, "ACPI _SDD failed (AE 0x%x)\n", status); |
836 | "ACPI _SDD failed (AE 0x%x)\n", status); | ||
837 | return -EIO; | 828 | return -EIO; |
838 | } | 829 | } |
839 | 830 | ||
@@ -983,8 +974,8 @@ int ata_acpi_on_devcfg(struct ata_device *dev) | |||
983 | if (nr_executed) { | 974 | if (nr_executed) { |
984 | rc = ata_dev_reread_id(dev, 0); | 975 | rc = ata_dev_reread_id(dev, 0); |
985 | if (rc < 0) { | 976 | if (rc < 0) { |
986 | ata_dev_printk(dev, KERN_ERR, "failed to IDENTIFY " | 977 | ata_dev_err(dev, |
987 | "after ACPI commands\n"); | 978 | "failed to IDENTIFY after ACPI commands\n"); |
988 | return rc; | 979 | return rc; |
989 | } | 980 | } |
990 | } | 981 | } |
@@ -1002,8 +993,7 @@ int ata_acpi_on_devcfg(struct ata_device *dev) | |||
1002 | return rc; | 993 | return rc; |
1003 | } | 994 | } |
1004 | 995 | ||
1005 | ata_dev_printk(dev, KERN_WARNING, | 996 | ata_dev_warn(dev, "ACPI: failed the second time, disabled\n"); |
1006 | "ACPI: failed the second time, disabled\n"); | ||
1007 | dev->acpi_handle = NULL; | 997 | dev->acpi_handle = NULL; |
1008 | 998 | ||
1009 | /* We can safely continue if no _GTF command has been executed | 999 | /* We can safely continue if no _GTF command has been executed |