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

wavelan_cs: stop inlining largish static functions

Hi John,

Can you please take a look at this patch?

drivers/net/wireless/wavelan_cs.c has unusually large number
of static inline functions - 27.

I looked through them and 20 of them do not seem to warrant inlining.
Some are really big; others call mdelay(1) or busy-wait for a bit
to be set in a hardware register - it's pointless
to optimize such functions for speed.

This patch removes "inline" from these static function
(regardless of number of callsites - gcc nowadays auto-inlines
statics with one callsite).

Size difference for 32bit x86:

text data bss dec hex filename
17020 372 8 17400 43f8 linux-2.6-ALLYES/drivers/net/wireless/wavelan_cs.o
14032 356 8 14396 383c linux-2.6.inline-ALLYES/drivers/net/wireless/wavelan_cs.o

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
--
vda
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Denys Vlasenko and committed by
John W. Linville
2aee82de 7b463ced

+36 -37
+23 -24
drivers/net/wireless/wavelan_cs.c
··· 102 102 * Write to card's Host Adapter Command Register. Include a delay for 103 103 * those times when it is needed. 104 104 */ 105 - static inline void 105 + static void 106 106 hacr_write_slow(u_long base, 107 107 u_char hacr) 108 108 { ··· 255 255 /* 256 256 * Write 1 byte to the MMC. 257 257 */ 258 - static inline void 258 + static void 259 259 mmc_out(u_long base, 260 260 u_short o, 261 261 u_char d) ··· 275 275 * Routine to write bytes to the Modem Management Controller. 276 276 * We start by the end because it is the way it should be ! 277 277 */ 278 - static inline void 278 + static void 279 279 mmc_write(u_long base, 280 280 u_char o, 281 281 u_char * b, ··· 293 293 * Read 1 byte from the MMC. 294 294 * Optimised version for 1 byte, avoid using memory... 295 295 */ 296 - static inline u_char 296 + static u_char 297 297 mmc_in(u_long base, 298 298 u_short o) 299 299 { ··· 318 318 * (code has just been moved in the above function) 319 319 * We start by the end because it is the way it should be ! 320 320 */ 321 - static inline void 321 + static void 322 322 mmc_read(u_long base, 323 323 u_char o, 324 324 u_char * b, ··· 350 350 /*------------------------------------------------------------------*/ 351 351 /* 352 352 * Wait for the frequency EEprom to complete a command... 353 - * I hope this one will be optimally inlined... 354 353 */ 355 - static inline void 354 + static void 356 355 fee_wait(u_long base, /* i/o port of the card */ 357 356 int delay, /* Base delay to wait for */ 358 357 int number) /* Number of time to wait */ ··· 737 738 } 738 739 739 740 /* Called when a WavePoint beacon is received */ 740 - static inline void wl_roam_gather(struct net_device * dev, 741 - u_char * hdr, /* Beacon header */ 742 - u_char * stats) /* SNR, Signal quality 741 + static void wl_roam_gather(struct net_device * dev, 742 + u_char * hdr, /* Beacon header */ 743 + u_char * stats) /* SNR, Signal quality 743 744 of packet */ 744 745 { 745 746 wavepoint_beacon *beacon= (wavepoint_beacon *)hdr; /* Rcvd. Beacon */ ··· 793 794 static inline int WAVELAN_BEACON(unsigned char *data) 794 795 { 795 796 wavepoint_beacon *beacon= (wavepoint_beacon *)data; 796 - static wavepoint_beacon beacon_template={0xaa,0xaa,0x03,0x08,0x00,0x0e,0x20,0x03,0x00}; 797 + static const wavepoint_beacon beacon_template={0xaa,0xaa,0x03,0x08,0x00,0x0e,0x20,0x03,0x00}; 797 798 798 799 if(memcmp(beacon,&beacon_template,9)==0) 799 800 return 1; ··· 979 980 * wavelan_interrupt is not an option...), so you may experience 980 981 * some delay sometime... 981 982 */ 982 - static inline void 983 + static void 983 984 wv_82593_reconfig(struct net_device * dev) 984 985 { 985 986 net_local * lp = netdev_priv(dev); ··· 1232 1233 /* 1233 1234 * Dump packet header (and content if necessary) on the screen 1234 1235 */ 1235 - static inline void 1236 + static void 1236 1237 wv_packet_info(u_char * p, /* Packet to dump */ 1237 1238 int length, /* Length of the packet */ 1238 1239 char * msg1, /* Name of the device */ ··· 1271 1272 * This is the information which is displayed by the driver at startup 1272 1273 * There is a lot of flag to configure it at your will... 1273 1274 */ 1274 - static inline void 1275 + static void 1275 1276 wv_init_info(struct net_device * dev) 1276 1277 { 1277 1278 unsigned int base = dev->base_addr; ··· 1508 1509 * Frequency setting (for hardware able of it) 1509 1510 * It's a bit complicated and you don't really want to look into it... 1510 1511 */ 1511 - static inline int 1512 + static int 1512 1513 wv_set_frequency(u_long base, /* i/o port of the card */ 1513 1514 iw_freq * frequency) 1514 1515 { ··· 1705 1706 /* 1706 1707 * Give the list of available frequencies 1707 1708 */ 1708 - static inline int 1709 + static int 1709 1710 wv_frequency_list(u_long base, /* i/o port of the card */ 1710 1711 iw_freq * list, /* List of frequency to fill */ 1711 1712 int max) /* Maximum number of frequencies */ ··· 2758 2759 * frame pointer and verify that the frame seem correct 2759 2760 * (called by wv_packet_rcv()) 2760 2761 */ 2761 - static inline int 2762 + static int 2762 2763 wv_start_of_frame(struct net_device * dev, 2763 2764 int rfp, /* end of frame */ 2764 2765 int wrap) /* start of buffer */ ··· 2820 2821 * Note: if any errors occur, the packet is "dropped on the floor" 2821 2822 * (called by wv_packet_rcv()) 2822 2823 */ 2823 - static inline void 2824 + static void 2824 2825 wv_packet_read(struct net_device * dev, 2825 2826 int fd_p, 2826 2827 int sksize) ··· 2921 2922 * (called by wavelan_interrupt()) 2922 2923 * Note : the spinlock is already grabbed for us and irq are disabled. 2923 2924 */ 2924 - static inline void 2925 + static void 2925 2926 wv_packet_rcv(struct net_device * dev) 2926 2927 { 2927 2928 unsigned int base = dev->base_addr; ··· 3055 3056 * the transmit. 3056 3057 * (called in wavelan_packet_xmit()) 3057 3058 */ 3058 - static inline void 3059 + static void 3059 3060 wv_packet_write(struct net_device * dev, 3060 3061 void * buf, 3061 3062 short length) ··· 3179 3180 * Routine to initialize the Modem Management Controller. 3180 3181 * (called by wv_hw_config()) 3181 3182 */ 3182 - static inline int 3183 + static int 3183 3184 wv_mmc_init(struct net_device * dev) 3184 3185 { 3185 3186 unsigned int base = dev->base_addr; ··· 3698 3699 * wavelan. 3699 3700 * (called by wv_config()) 3700 3701 */ 3701 - static inline int 3702 + static int 3702 3703 wv_pcmcia_reset(struct net_device * dev) 3703 3704 { 3704 3705 int i; ··· 3863 3864 * 2. Start the LAN controller's receive unit 3864 3865 * (called by wavelan_event(), wavelan_watchdog() and wavelan_open()) 3865 3866 */ 3866 - static inline void 3867 + static void 3867 3868 wv_hw_reset(struct net_device * dev) 3868 3869 { 3869 3870 net_local * lp = netdev_priv(dev); ··· 3894 3895 * device available to the system. 3895 3896 * (called by wavelan_event()) 3896 3897 */ 3897 - static inline int 3898 + static int 3898 3899 wv_pcmcia_config(struct pcmcia_device * link) 3899 3900 { 3900 3901 struct net_device * dev = (struct net_device *) link->priv;
+13 -13
drivers/net/wireless/wavelan_cs.p.h
··· 637 637 /* ----------------- MODEM MANAGEMENT SUBROUTINES ----------------- */ 638 638 static inline u_char /* data */ 639 639 hasr_read(u_long); /* Read the host interface : base address */ 640 - static inline void 640 + static void 641 641 hacr_write(u_long, /* Write to host interface : base address */ 642 642 u_char), /* data */ 643 643 hacr_write_slow(u_long, ··· 651 651 int, /* Offset in psa */ 652 652 u_char *, /* Buffer in memory */ 653 653 int); /* Length of buffer */ 654 - static inline void 654 + static void 655 655 mmc_out(u_long, /* Write 1 byte to the Modem Manag Control */ 656 656 u_short, 657 657 u_char), ··· 659 659 u_char, 660 660 u_char *, 661 661 int); 662 - static inline u_char /* Read 1 byte from the MMC */ 662 + static u_char /* Read 1 byte from the MMC */ 663 663 mmc_in(u_long, 664 664 u_short); 665 - static inline void 665 + static void 666 666 mmc_read(u_long, /* Read n bytes from the MMC */ 667 667 u_char, 668 668 u_char *, ··· 688 688 int, 689 689 char *, 690 690 int); 691 - static inline void 691 + static void 692 692 wv_82593_reconfig(struct net_device *); /* Reconfigure the controller */ 693 693 /* ------------------- DEBUG & INFO SUBROUTINES ------------------- */ 694 - static inline void 694 + static void 695 695 wv_init_info(struct net_device *); /* display startup info */ 696 696 /* ------------------- IOCTL, STATS & RECONFIG ------------------- */ 697 697 static en_stats * ··· 699 699 static iw_stats * 700 700 wavelan_get_wireless_stats(struct net_device *); 701 701 /* ----------------------- PACKET RECEPTION ----------------------- */ 702 - static inline int 702 + static int 703 703 wv_start_of_frame(struct net_device *, /* Seek beggining of current frame */ 704 704 int, /* end of frame */ 705 705 int); /* start of buffer */ 706 - static inline void 706 + static void 707 707 wv_packet_read(struct net_device *, /* Read a packet from a frame */ 708 708 int, 709 709 int), 710 710 wv_packet_rcv(struct net_device *); /* Read all packets waiting */ 711 711 /* --------------------- PACKET TRANSMISSION --------------------- */ 712 - static inline void 712 + static void 713 713 wv_packet_write(struct net_device *, /* Write a packet to the Tx buffer */ 714 714 void *, 715 715 short); ··· 717 717 wavelan_packet_xmit(struct sk_buff *, /* Send a packet */ 718 718 struct net_device *); 719 719 /* -------------------- HARDWARE CONFIGURATION -------------------- */ 720 - static inline int 720 + static int 721 721 wv_mmc_init(struct net_device *); /* Initialize the modem */ 722 722 static int 723 723 wv_ru_stop(struct net_device *), /* Stop the i82593 receiver unit */ 724 724 wv_ru_start(struct net_device *); /* Start the i82593 receiver unit */ 725 725 static int 726 726 wv_82593_config(struct net_device *); /* Configure the i82593 */ 727 - static inline int 727 + static int 728 728 wv_pcmcia_reset(struct net_device *); /* Reset the pcmcia interface */ 729 729 static int 730 730 wv_hw_config(struct net_device *); /* Reset & configure the whole hardware */ 731 - static inline void 731 + static void 732 732 wv_hw_reset(struct net_device *); /* Same, + start receiver unit */ 733 - static inline int 733 + static int 734 734 wv_pcmcia_config(struct pcmcia_device *); /* Configure the pcmcia interface */ 735 735 static void 736 736 wv_pcmcia_release(struct pcmcia_device *);/* Remove a device */