aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wavelan.c
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2008-01-13 09:16:34 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:50 -0500
commit60da481b98082ff5ffd233b18683c3ffe3ab618c (patch)
tree3660cdeef28b88f3fc6997b299ac5a3158654b20 /drivers/net/wireless/wavelan.c
parenteb189d8bc9824bcb2187ffdab27d77ab469264c3 (diff)
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)
49 return -1; 49 return -1;
50} 50}
51 51
52#ifdef STRUCT_CHECK
53/*------------------------------------------------------------------*/
54/*
55 * Sanity routine to verify the sizes of the various WaveLAN interface
56 * structures.
57 */
58static char *wv_struct_check(void)
59{
60#define SC(t,s,n) if (sizeof(t) != s) return(n);
61
62 SC(psa_t, PSA_SIZE, "psa_t");
63 SC(mmw_t, MMW_SIZE, "mmw_t");
64 SC(mmr_t, MMR_SIZE, "mmr_t");
65 SC(ha_t, HA_SIZE, "ha_t");
66
67#undef SC
68
69 return ((char *) NULL);
70} /* wv_struct_check */
71#endif /* STRUCT_CHECK */
72
73/********************* HOST ADAPTER SUBROUTINES *********************/ 52/********************* HOST ADAPTER SUBROUTINES *********************/
74/* 53/*
75 * Useful subroutines to manage the WaveLAN ISA interface 54 * Useful subroutines to manage the WaveLAN ISA interface
@@ -4215,14 +4194,11 @@ struct net_device * __init wavelan_probe(int unit)
4215 int i; 4194 int i;
4216 int r = 0; 4195 int r = 0;
4217 4196
4218#ifdef STRUCT_CHECK 4197 /* compile-time check the sizes of structures */
4219 if (wv_struct_check() != (char *) NULL) { 4198 BUILD_BUG_ON(sizeof(psa_t) != PSA_SIZE);
4220 printk(KERN_WARNING 4199 BUILD_BUG_ON(sizeof(mmw_t) != MMW_SIZE);
4221 "%s: wavelan_probe(): structure/compiler botch: \"%s\"\n", 4200 BUILD_BUG_ON(sizeof(mmr_t) != MMR_SIZE);
4222 dev->name, wv_struct_check()); 4201 BUILD_BUG_ON(sizeof(ha_t) != HA_SIZE);
4223 return -ENODEV;
4224 }
4225#endif /* STRUCT_CHECK */
4226 4202
4227 dev = alloc_etherdev(sizeof(net_local)); 4203 dev = alloc_etherdev(sizeof(net_local));
4228 if (!dev) 4204 if (!dev)