summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wavelan.c
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2008-01-13 15:16:34 +0100
committerDavid S. Miller <davem@davemloft.net>2008-01-28 15:09:50 -0800
commit60da481b98082ff5ffd233b18683c3ffe3ab618c (patch)
tree3660cdeef28b88f3fc6997b299ac5a3158654b20 /drivers/net/wireless/wavelan.c
parenteb189d8bc9824bcb2187ffdab27d77ab469264c3 (diff)
downloadblackbird-op-linux-60da481b98082ff5ffd233b18683c3ffe3ab618c.tar.gz
blackbird-op-linux-60da481b98082ff5ffd233b18683c3ffe3ab618c.zip
WAVELAN - compile-time check for struct sizes
Convert optional struct size checks to non-optional compile-time checks. Furthermore BUILD_BUG_ON() which will be optimized away by the compiler. Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wavelan.c')
-rw-r--r--drivers/net/wireless/wavelan.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c
index b343ce2235eb..03384a43186b 100644
--- a/drivers/net/wireless/wavelan.c
+++ b/drivers/net/wireless/wavelan.c
@@ -49,27 +49,6 @@ static int __init wv_psa_to_irq(u8 irqval)
return -1;
}
-#ifdef STRUCT_CHECK
-/*------------------------------------------------------------------*/
-/*
- * Sanity routine to verify the sizes of the various WaveLAN interface
- * structures.
- */
-static char *wv_struct_check(void)
-{
-#define SC(t,s,n) if (sizeof(t) != s) return(n);
-
- SC(psa_t, PSA_SIZE, "psa_t");
- SC(mmw_t, MMW_SIZE, "mmw_t");
- SC(mmr_t, MMR_SIZE, "mmr_t");
- SC(ha_t, HA_SIZE, "ha_t");
-
-#undef SC
-
- return ((char *) NULL);
-} /* wv_struct_check */
-#endif /* STRUCT_CHECK */
-
/********************* HOST ADAPTER SUBROUTINES *********************/
/*
* Useful subroutines to manage the WaveLAN ISA interface
@@ -4215,14 +4194,11 @@ struct net_device * __init wavelan_probe(int unit)
int i;
int r = 0;
-#ifdef STRUCT_CHECK
- if (wv_struct_check() != (char *) NULL) {
- printk(KERN_WARNING
- "%s: wavelan_probe(): structure/compiler botch: \"%s\"\n",
- dev->name, wv_struct_check());
- return -ENODEV;
- }
-#endif /* STRUCT_CHECK */
+ /* compile-time check the sizes of structures */
+ BUILD_BUG_ON(sizeof(psa_t) != PSA_SIZE);
+ BUILD_BUG_ON(sizeof(mmw_t) != MMW_SIZE);
+ BUILD_BUG_ON(sizeof(mmr_t) != MMR_SIZE);
+ BUILD_BUG_ON(sizeof(ha_t) != HA_SIZE);
dev = alloc_etherdev(sizeof(net_local));
if (!dev)
OpenPOWER on IntegriCloud