Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sb1000.c: make const arrays static

This patch replaces automatic constant arrays a-la

const unsigned char Command0[6] = {0x80, 0x16, 0x00, 0x00, 0x00, 0x00};

with static ones. Size difference for 32bit x86:

text data bss dec hex filename
5418 129 0 5547 15ab linux-2.6.inline-ALLYES/drivers/net/sb1000.o
5396 129 0 5525 1595 linux-2.6.followup-ALLYES/drivers/net/sb1000.o

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

authored by

Denys Vlasenko and committed by
Jeff Garzik
7dd73bbc a8d06342

+29 -18
+29 -18
drivers/net/sb1000.c
··· 437 437 static void 438 438 sb1000_issue_read_command(const int ioaddr[], const char* name) 439 439 { 440 - const unsigned char Command0[6] = {0x20, 0x00, 0x00, 0x01, 0x00, 0x00}; 440 + static const unsigned char Command0[6] = {0x20, 0x00, 0x00, 0x01, 0x00, 0x00}; 441 441 442 442 sb1000_wait_for_ready_clear(ioaddr, name); 443 443 outb(0xa0, ioaddr[0] + 6); ··· 453 453 static int 454 454 sb1000_reset(const int ioaddr[], const char* name) 455 455 { 456 + static const unsigned char Command0[6] = {0x80, 0x16, 0x00, 0x00, 0x00, 0x00}; 457 + 456 458 unsigned char st[7]; 457 459 int port, status; 458 - const unsigned char Command0[6] = {0x80, 0x16, 0x00, 0x00, 0x00, 0x00}; 459 460 460 461 port = ioaddr[1] + 6; 461 462 outb(0x4, port); ··· 483 482 static int 484 483 sb1000_check_CRC(const int ioaddr[], const char* name) 485 484 { 485 + static const unsigned char Command0[6] = {0x80, 0x1f, 0x00, 0x00, 0x00, 0x00}; 486 + 486 487 unsigned char st[7]; 487 488 int crc, status; 488 - const unsigned char Command0[6] = {0x80, 0x1f, 0x00, 0x00, 0x00, 0x00}; 489 489 490 490 /* check CRC */ 491 491 if ((status = card_send_command(ioaddr, name, Command0, st))) ··· 500 498 static inline int 501 499 sb1000_start_get_set_command(const int ioaddr[], const char* name) 502 500 { 501 + static const unsigned char Command0[6] = {0x80, 0x1b, 0x00, 0x00, 0x00, 0x00}; 502 + 503 503 unsigned char st[7]; 504 - const unsigned char Command0[6] = {0x80, 0x1b, 0x00, 0x00, 0x00, 0x00}; 505 504 506 505 return card_send_command(ioaddr, name, Command0, st); 507 506 } ··· 510 507 static int 511 508 sb1000_end_get_set_command(const int ioaddr[], const char* name) 512 509 { 510 + static const unsigned char Command0[6] = {0x80, 0x1b, 0x02, 0x00, 0x00, 0x00}; 511 + static const unsigned char Command1[6] = {0x20, 0x00, 0x00, 0x00, 0x00, 0x00}; 512 + 513 513 unsigned char st[7]; 514 514 int status; 515 - const unsigned char Command0[6] = {0x80, 0x1b, 0x02, 0x00, 0x00, 0x00}; 516 - const unsigned char Command1[6] = {0x20, 0x00, 0x00, 0x00, 0x00, 0x00}; 517 515 518 516 if ((status = card_send_command(ioaddr, name, Command0, st))) 519 517 return status; ··· 524 520 static int 525 521 sb1000_activate(const int ioaddr[], const char* name) 526 522 { 523 + static const unsigned char Command0[6] = {0x80, 0x11, 0x00, 0x00, 0x00, 0x00}; 524 + static const unsigned char Command1[6] = {0x80, 0x16, 0x00, 0x00, 0x00, 0x00}; 525 + 527 526 unsigned char st[7]; 528 527 int status; 529 - const unsigned char Command0[6] = {0x80, 0x11, 0x00, 0x00, 0x00, 0x00}; 530 - const unsigned char Command1[6] = {0x80, 0x16, 0x00, 0x00, 0x00, 0x00}; 531 528 532 529 ssleep(1); 533 530 if ((status = card_send_command(ioaddr, name, Command0, st))) ··· 549 544 sb1000_get_firmware_version(const int ioaddr[], const char* name, 550 545 unsigned char version[], int do_end) 551 546 { 547 + static const unsigned char Command0[6] = {0x80, 0x23, 0x00, 0x00, 0x00, 0x00}; 548 + 552 549 unsigned char st[7]; 553 550 int status; 554 - const unsigned char Command0[6] = {0x80, 0x23, 0x00, 0x00, 0x00, 0x00}; 555 551 556 552 if ((status = sb1000_start_get_set_command(ioaddr, name))) 557 553 return status; ··· 572 566 static int 573 567 sb1000_get_frequency(const int ioaddr[], const char* name, int* frequency) 574 568 { 569 + static const unsigned char Command0[6] = {0x80, 0x44, 0x00, 0x00, 0x00, 0x00}; 570 + 575 571 unsigned char st[7]; 576 572 int status; 577 - const unsigned char Command0[6] = {0x80, 0x44, 0x00, 0x00, 0x00, 0x00}; 578 573 579 574 udelay(1000); 580 575 if ((status = sb1000_start_get_set_command(ioaddr, name))) ··· 620 613 static int 621 614 sb1000_get_PIDs(const int ioaddr[], const char* name, short PID[]) 622 615 { 616 + static const unsigned char Command0[6] = {0x80, 0x40, 0x00, 0x00, 0x00, 0x00}; 617 + static const unsigned char Command1[6] = {0x80, 0x41, 0x00, 0x00, 0x00, 0x00}; 618 + static const unsigned char Command2[6] = {0x80, 0x42, 0x00, 0x00, 0x00, 0x00}; 619 + static const unsigned char Command3[6] = {0x80, 0x43, 0x00, 0x00, 0x00, 0x00}; 620 + 623 621 unsigned char st[7]; 624 622 int status; 625 - const unsigned char Command0[6] = {0x80, 0x40, 0x00, 0x00, 0x00, 0x00}; 626 - const unsigned char Command1[6] = {0x80, 0x41, 0x00, 0x00, 0x00, 0x00}; 627 - const unsigned char Command2[6] = {0x80, 0x42, 0x00, 0x00, 0x00, 0x00}; 628 - const unsigned char Command3[6] = {0x80, 0x43, 0x00, 0x00, 0x00, 0x00}; 629 623 630 624 udelay(1000); 631 625 if ((status = sb1000_start_get_set_command(ioaddr, name))) ··· 655 647 static int 656 648 sb1000_set_PIDs(const int ioaddr[], const char* name, const short PID[]) 657 649 { 650 + static const unsigned char Command4[6] = {0x80, 0x2e, 0x00, 0x00, 0x00, 0x00}; 651 + 658 652 unsigned char st[7]; 659 653 short p; 660 654 int status; ··· 664 654 unsigned char Command1[6] = {0x80, 0x32, 0x00, 0x00, 0x00, 0x00}; 665 655 unsigned char Command2[6] = {0x80, 0x33, 0x00, 0x00, 0x00, 0x00}; 666 656 unsigned char Command3[6] = {0x80, 0x34, 0x00, 0x00, 0x00, 0x00}; 667 - const unsigned char Command4[6] = {0x80, 0x2e, 0x00, 0x00, 0x00, 0x00}; 668 657 669 658 udelay(1000); 670 659 if ((status = sb1000_start_get_set_command(ioaddr, name))) ··· 900 891 static void 901 892 sb1000_error_dpc(struct net_device *dev) 902 893 { 894 + static const unsigned char Command0[6] = {0x80, 0x26, 0x00, 0x00, 0x00, 0x00}; 895 + 903 896 char *name; 904 897 unsigned char st[5]; 905 898 int ioaddr[2]; 906 899 struct sb1000_private *lp = netdev_priv(dev); 907 - const unsigned char Command0[6] = {0x80, 0x26, 0x00, 0x00, 0x00, 0x00}; 908 900 const int ErrorDpcCounterInitialize = 200; 909 901 910 902 ioaddr[0] = dev->base_addr; ··· 1087 1077 /* SB1000 interrupt handler. */ 1088 1078 static irqreturn_t sb1000_interrupt(int irq, void *dev_id) 1089 1079 { 1080 + static const unsigned char Command0[6] = {0x80, 0x2c, 0x00, 0x00, 0x00, 0x00}; 1081 + static const unsigned char Command1[6] = {0x80, 0x2e, 0x00, 0x00, 0x00, 0x00}; 1082 + 1090 1083 char *name; 1091 1084 unsigned char st; 1092 1085 int ioaddr[2]; 1093 1086 struct net_device *dev = dev_id; 1094 1087 struct sb1000_private *lp = netdev_priv(dev); 1095 1088 1096 - const unsigned char Command0[6] = {0x80, 0x2c, 0x00, 0x00, 0x00, 0x00}; 1097 - const unsigned char Command1[6] = {0x80, 0x2e, 0x00, 0x00, 0x00, 0x00}; 1098 1089 const int MaxRxErrorCount = 6; 1099 1090 1100 1091 ioaddr[0] = dev->base_addr;