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>
This commit is contained in:
Denys Vlasenko 2008-04-01 02:56:32 +02:00 committed by John W. Linville
parent 7b463ced63
commit 2aee82de52
2 changed files with 36 additions and 37 deletions

View file

@ -102,7 +102,7 @@ hacr_write(u_long base,
* Write to card's Host Adapter Command Register. Include a delay for * Write to card's Host Adapter Command Register. Include a delay for
* those times when it is needed. * those times when it is needed.
*/ */
static inline void static void
hacr_write_slow(u_long base, hacr_write_slow(u_long base,
u_char hacr) u_char hacr)
{ {
@ -255,7 +255,7 @@ update_psa_checksum(struct net_device * dev)
/* /*
* Write 1 byte to the MMC. * Write 1 byte to the MMC.
*/ */
static inline void static void
mmc_out(u_long base, mmc_out(u_long base,
u_short o, u_short o,
u_char d) u_char d)
@ -275,7 +275,7 @@ mmc_out(u_long base,
* Routine to write bytes to the Modem Management Controller. * Routine to write bytes to the Modem Management Controller.
* We start by the end because it is the way it should be ! * We start by the end because it is the way it should be !
*/ */
static inline void static void
mmc_write(u_long base, mmc_write(u_long base,
u_char o, u_char o,
u_char * b, u_char * b,
@ -293,7 +293,7 @@ mmc_write(u_long base,
* Read 1 byte from the MMC. * Read 1 byte from the MMC.
* Optimised version for 1 byte, avoid using memory... * Optimised version for 1 byte, avoid using memory...
*/ */
static inline u_char static u_char
mmc_in(u_long base, mmc_in(u_long base,
u_short o) u_short o)
{ {
@ -318,7 +318,7 @@ mmc_in(u_long base,
* (code has just been moved in the above function) * (code has just been moved in the above function)
* We start by the end because it is the way it should be ! * We start by the end because it is the way it should be !
*/ */
static inline void static void
mmc_read(u_long base, mmc_read(u_long base,
u_char o, u_char o,
u_char * b, u_char * b,
@ -350,9 +350,8 @@ mmc_encr(u_long base) /* i/o port of the card */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/* /*
* Wait for the frequency EEprom to complete a command... * Wait for the frequency EEprom to complete a command...
* I hope this one will be optimally inlined...
*/ */
static inline void static void
fee_wait(u_long base, /* i/o port of the card */ fee_wait(u_long base, /* i/o port of the card */
int delay, /* Base delay to wait for */ int delay, /* Base delay to wait for */
int number) /* Number of time to wait */ int number) /* Number of time to wait */
@ -738,9 +737,9 @@ static void wv_roam_handover(wavepoint_history *wavepoint, net_local *lp)
} }
/* Called when a WavePoint beacon is received */ /* Called when a WavePoint beacon is received */
static inline void wl_roam_gather(struct net_device * dev, static void wl_roam_gather(struct net_device * dev,
u_char * hdr, /* Beacon header */ u_char * hdr, /* Beacon header */
u_char * stats) /* SNR, Signal quality u_char * stats) /* SNR, Signal quality
of packet */ of packet */
{ {
wavepoint_beacon *beacon= (wavepoint_beacon *)hdr; /* Rcvd. Beacon */ wavepoint_beacon *beacon= (wavepoint_beacon *)hdr; /* Rcvd. Beacon */
@ -794,7 +793,7 @@ out:
static inline int WAVELAN_BEACON(unsigned char *data) static inline int WAVELAN_BEACON(unsigned char *data)
{ {
wavepoint_beacon *beacon= (wavepoint_beacon *)data; wavepoint_beacon *beacon= (wavepoint_beacon *)data;
static wavepoint_beacon beacon_template={0xaa,0xaa,0x03,0x08,0x00,0x0e,0x20,0x03,0x00}; static const wavepoint_beacon beacon_template={0xaa,0xaa,0x03,0x08,0x00,0x0e,0x20,0x03,0x00};
if(memcmp(beacon,&beacon_template,9)==0) if(memcmp(beacon,&beacon_template,9)==0)
return 1; return 1;
@ -980,7 +979,7 @@ read_ringbuf(struct net_device * dev,
* wavelan_interrupt is not an option...), so you may experience * wavelan_interrupt is not an option...), so you may experience
* some delay sometime... * some delay sometime...
*/ */
static inline void static void
wv_82593_reconfig(struct net_device * dev) wv_82593_reconfig(struct net_device * dev)
{ {
net_local * lp = netdev_priv(dev); net_local * lp = netdev_priv(dev);
@ -1233,7 +1232,7 @@ wv_local_show(struct net_device * dev)
/* /*
* Dump packet header (and content if necessary) on the screen * Dump packet header (and content if necessary) on the screen
*/ */
static inline void static void
wv_packet_info(u_char * p, /* Packet to dump */ wv_packet_info(u_char * p, /* Packet to dump */
int length, /* Length of the packet */ int length, /* Length of the packet */
char * msg1, /* Name of the device */ char * msg1, /* Name of the device */
@ -1272,7 +1271,7 @@ wv_packet_info(u_char * p, /* Packet to dump */
* This is the information which is displayed by the driver at startup * This is the information which is displayed by the driver at startup
* There is a lot of flag to configure it at your will... * There is a lot of flag to configure it at your will...
*/ */
static inline void static void
wv_init_info(struct net_device * dev) wv_init_info(struct net_device * dev)
{ {
unsigned int base = dev->base_addr; unsigned int base = dev->base_addr;
@ -1509,7 +1508,7 @@ wavelan_set_mac_address(struct net_device * dev,
* Frequency setting (for hardware able of it) * Frequency setting (for hardware able of it)
* It's a bit complicated and you don't really want to look into it... * It's a bit complicated and you don't really want to look into it...
*/ */
static inline int static int
wv_set_frequency(u_long base, /* i/o port of the card */ wv_set_frequency(u_long base, /* i/o port of the card */
iw_freq * frequency) iw_freq * frequency)
{ {
@ -1706,7 +1705,7 @@ wv_set_frequency(u_long base, /* i/o port of the card */
/* /*
* Give the list of available frequencies * Give the list of available frequencies
*/ */
static inline int static int
wv_frequency_list(u_long base, /* i/o port of the card */ wv_frequency_list(u_long base, /* i/o port of the card */
iw_freq * list, /* List of frequency to fill */ iw_freq * list, /* List of frequency to fill */
int max) /* Maximum number of frequencies */ int max) /* Maximum number of frequencies */
@ -2759,7 +2758,7 @@ wavelan_get_wireless_stats(struct net_device * dev)
* frame pointer and verify that the frame seem correct * frame pointer and verify that the frame seem correct
* (called by wv_packet_rcv()) * (called by wv_packet_rcv())
*/ */
static inline int static int
wv_start_of_frame(struct net_device * dev, wv_start_of_frame(struct net_device * dev,
int rfp, /* end of frame */ int rfp, /* end of frame */
int wrap) /* start of buffer */ int wrap) /* start of buffer */
@ -2821,7 +2820,7 @@ wv_start_of_frame(struct net_device * dev,
* Note: if any errors occur, the packet is "dropped on the floor" * Note: if any errors occur, the packet is "dropped on the floor"
* (called by wv_packet_rcv()) * (called by wv_packet_rcv())
*/ */
static inline void static void
wv_packet_read(struct net_device * dev, wv_packet_read(struct net_device * dev,
int fd_p, int fd_p,
int sksize) int sksize)
@ -2922,7 +2921,7 @@ wv_packet_read(struct net_device * dev,
* (called by wavelan_interrupt()) * (called by wavelan_interrupt())
* Note : the spinlock is already grabbed for us and irq are disabled. * Note : the spinlock is already grabbed for us and irq are disabled.
*/ */
static inline void static void
wv_packet_rcv(struct net_device * dev) wv_packet_rcv(struct net_device * dev)
{ {
unsigned int base = dev->base_addr; unsigned int base = dev->base_addr;
@ -3056,7 +3055,7 @@ wv_packet_rcv(struct net_device * dev)
* the transmit. * the transmit.
* (called in wavelan_packet_xmit()) * (called in wavelan_packet_xmit())
*/ */
static inline void static void
wv_packet_write(struct net_device * dev, wv_packet_write(struct net_device * dev,
void * buf, void * buf,
short length) short length)
@ -3180,7 +3179,7 @@ wavelan_packet_xmit(struct sk_buff * skb,
* Routine to initialize the Modem Management Controller. * Routine to initialize the Modem Management Controller.
* (called by wv_hw_config()) * (called by wv_hw_config())
*/ */
static inline int static int
wv_mmc_init(struct net_device * dev) wv_mmc_init(struct net_device * dev)
{ {
unsigned int base = dev->base_addr; unsigned int base = dev->base_addr;
@ -3699,7 +3698,7 @@ wv_82593_config(struct net_device * dev)
* wavelan. * wavelan.
* (called by wv_config()) * (called by wv_config())
*/ */
static inline int static int
wv_pcmcia_reset(struct net_device * dev) wv_pcmcia_reset(struct net_device * dev)
{ {
int i; int i;
@ -3864,7 +3863,7 @@ wv_hw_config(struct net_device * dev)
* 2. Start the LAN controller's receive unit * 2. Start the LAN controller's receive unit
* (called by wavelan_event(), wavelan_watchdog() and wavelan_open()) * (called by wavelan_event(), wavelan_watchdog() and wavelan_open())
*/ */
static inline void static void
wv_hw_reset(struct net_device * dev) wv_hw_reset(struct net_device * dev)
{ {
net_local * lp = netdev_priv(dev); net_local * lp = netdev_priv(dev);
@ -3895,7 +3894,7 @@ wv_hw_reset(struct net_device * dev)
* device available to the system. * device available to the system.
* (called by wavelan_event()) * (called by wavelan_event())
*/ */
static inline int static int
wv_pcmcia_config(struct pcmcia_device * link) wv_pcmcia_config(struct pcmcia_device * link)
{ {
struct net_device * dev = (struct net_device *) link->priv; struct net_device * dev = (struct net_device *) link->priv;

View file

@ -637,7 +637,7 @@ struct net_local
/* ----------------- MODEM MANAGEMENT SUBROUTINES ----------------- */ /* ----------------- MODEM MANAGEMENT SUBROUTINES ----------------- */
static inline u_char /* data */ static inline u_char /* data */
hasr_read(u_long); /* Read the host interface : base address */ hasr_read(u_long); /* Read the host interface : base address */
static inline void static void
hacr_write(u_long, /* Write to host interface : base address */ hacr_write(u_long, /* Write to host interface : base address */
u_char), /* data */ u_char), /* data */
hacr_write_slow(u_long, hacr_write_slow(u_long,
@ -651,7 +651,7 @@ static void
int, /* Offset in psa */ int, /* Offset in psa */
u_char *, /* Buffer in memory */ u_char *, /* Buffer in memory */
int); /* Length of buffer */ int); /* Length of buffer */
static inline void static void
mmc_out(u_long, /* Write 1 byte to the Modem Manag Control */ mmc_out(u_long, /* Write 1 byte to the Modem Manag Control */
u_short, u_short,
u_char), u_char),
@ -659,10 +659,10 @@ static inline void
u_char, u_char,
u_char *, u_char *,
int); int);
static inline u_char /* Read 1 byte from the MMC */ static u_char /* Read 1 byte from the MMC */
mmc_in(u_long, mmc_in(u_long,
u_short); u_short);
static inline void static void
mmc_read(u_long, /* Read n bytes from the MMC */ mmc_read(u_long, /* Read n bytes from the MMC */
u_char, u_char,
u_char *, u_char *,
@ -688,10 +688,10 @@ static int
int, int,
char *, char *,
int); int);
static inline void static void
wv_82593_reconfig(struct net_device *); /* Reconfigure the controller */ wv_82593_reconfig(struct net_device *); /* Reconfigure the controller */
/* ------------------- DEBUG & INFO SUBROUTINES ------------------- */ /* ------------------- DEBUG & INFO SUBROUTINES ------------------- */
static inline void static void
wv_init_info(struct net_device *); /* display startup info */ wv_init_info(struct net_device *); /* display startup info */
/* ------------------- IOCTL, STATS & RECONFIG ------------------- */ /* ------------------- IOCTL, STATS & RECONFIG ------------------- */
static en_stats * static en_stats *
@ -699,17 +699,17 @@ static en_stats *
static iw_stats * static iw_stats *
wavelan_get_wireless_stats(struct net_device *); wavelan_get_wireless_stats(struct net_device *);
/* ----------------------- PACKET RECEPTION ----------------------- */ /* ----------------------- PACKET RECEPTION ----------------------- */
static inline int static int
wv_start_of_frame(struct net_device *, /* Seek beggining of current frame */ wv_start_of_frame(struct net_device *, /* Seek beggining of current frame */
int, /* end of frame */ int, /* end of frame */
int); /* start of buffer */ int); /* start of buffer */
static inline void static void
wv_packet_read(struct net_device *, /* Read a packet from a frame */ wv_packet_read(struct net_device *, /* Read a packet from a frame */
int, int,
int), int),
wv_packet_rcv(struct net_device *); /* Read all packets waiting */ wv_packet_rcv(struct net_device *); /* Read all packets waiting */
/* --------------------- PACKET TRANSMISSION --------------------- */ /* --------------------- PACKET TRANSMISSION --------------------- */
static inline void static void
wv_packet_write(struct net_device *, /* Write a packet to the Tx buffer */ wv_packet_write(struct net_device *, /* Write a packet to the Tx buffer */
void *, void *,
short); short);
@ -717,20 +717,20 @@ static int
wavelan_packet_xmit(struct sk_buff *, /* Send a packet */ wavelan_packet_xmit(struct sk_buff *, /* Send a packet */
struct net_device *); struct net_device *);
/* -------------------- HARDWARE CONFIGURATION -------------------- */ /* -------------------- HARDWARE CONFIGURATION -------------------- */
static inline int static int
wv_mmc_init(struct net_device *); /* Initialize the modem */ wv_mmc_init(struct net_device *); /* Initialize the modem */
static int static int
wv_ru_stop(struct net_device *), /* Stop the i82593 receiver unit */ wv_ru_stop(struct net_device *), /* Stop the i82593 receiver unit */
wv_ru_start(struct net_device *); /* Start the i82593 receiver unit */ wv_ru_start(struct net_device *); /* Start the i82593 receiver unit */
static int static int
wv_82593_config(struct net_device *); /* Configure the i82593 */ wv_82593_config(struct net_device *); /* Configure the i82593 */
static inline int static int
wv_pcmcia_reset(struct net_device *); /* Reset the pcmcia interface */ wv_pcmcia_reset(struct net_device *); /* Reset the pcmcia interface */
static int static int
wv_hw_config(struct net_device *); /* Reset & configure the whole hardware */ wv_hw_config(struct net_device *); /* Reset & configure the whole hardware */
static inline void static void
wv_hw_reset(struct net_device *); /* Same, + start receiver unit */ wv_hw_reset(struct net_device *); /* Same, + start receiver unit */
static inline int static int
wv_pcmcia_config(struct pcmcia_device *); /* Configure the pcmcia interface */ wv_pcmcia_config(struct pcmcia_device *); /* Configure the pcmcia interface */
static void static void
wv_pcmcia_release(struct pcmcia_device *);/* Remove a device */ wv_pcmcia_release(struct pcmcia_device *);/* Remove a device */