summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2005-06-17 12:51:09 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2005-06-17 12:51:09 +0000
commit98d299fb3163226547d144ab4bf2290abe7bf7c7 (patch)
tree9a8ed54ef721a757c63cf8c926f676977e154447 /sys
parentf2f366716efad9da250389bf6f4ce3671d75b2b0 (diff)
remove non-constant array initializers which is a GNU extension.
suggested by anil some time ago.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/ar5210.c8
-rw-r--r--sys/dev/ic/ar5211.c8
-rw-r--r--sys/dev/ic/ar5212.c8
-rw-r--r--sys/dev/ic/ar5xxx.c12
4 files changed, 20 insertions, 16 deletions
diff --git a/sys/dev/ic/ar5210.c b/sys/dev/ic/ar5210.c
index 73ad8c7ddc4..b57bfb47587 100644
--- a/sys/dev/ic/ar5210.c
+++ b/sys/dev/ic/ar5210.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5210.c,v 1.25 2005/05/27 11:42:51 reyk Exp $ */
+/* $OpenBSD: ar5210.c,v 1.26 2005/06/17 12:51:08 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -1931,8 +1931,8 @@ ar5k_ar5210_set_key(hal, entry, keyval, mac, xor_notused)
const u_int8_t *mac;
int xor_notused;
{
- int elements = AR5K_AR5210_KEYCACHE_SIZE - 2, i;
- u_int32_t key_v[elements];
+ int i;
+ u_int32_t key_v[AR5K_AR5210_KEYCACHE_SIZE - 2];
AR5K_ASSERT_ENTRY(entry, AR5K_AR5210_KEYTABLE_SIZE);
@@ -1968,7 +1968,7 @@ ar5k_ar5210_set_key(hal, entry, keyval, mac, xor_notused)
return (AH_FALSE);
}
- for (i = 0; i < elements; i++)
+ for (i = 0; i < AR5K_ELEMENTS(key_v); i++)
AR5K_REG_WRITE(AR5K_AR5210_KEYTABLE_OFF(entry, i), key_v[i]);
return (ar5k_ar5210_set_key_lladdr(hal, entry, mac));
diff --git a/sys/dev/ic/ar5211.c b/sys/dev/ic/ar5211.c
index 649c60487bb..f54da0006fc 100644
--- a/sys/dev/ic/ar5211.c
+++ b/sys/dev/ic/ar5211.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5211.c,v 1.17 2005/05/28 23:45:09 reyk Exp $ */
+/* $OpenBSD: ar5211.c,v 1.18 2005/06/17 12:51:08 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -2021,8 +2021,8 @@ ar5k_ar5211_set_key(hal, entry, keyval, mac, xor_notused)
const u_int8_t *mac;
int xor_notused;
{
- int elements = AR5K_AR5211_KEYCACHE_SIZE - 2, i;
- u_int32_t key_v[elements];
+ int i;
+ u_int32_t key_v[AR5K_AR5211_KEYCACHE_SIZE - 2];
AR5K_ASSERT_ENTRY(entry, AR5K_AR5211_KEYTABLE_SIZE);
@@ -2058,7 +2058,7 @@ ar5k_ar5211_set_key(hal, entry, keyval, mac, xor_notused)
return (AH_FALSE);
}
- for (i = 0; i < elements; i++)
+ for (i = 0; i < AR5K_ELEMENTS(key_v); i++)
AR5K_REG_WRITE(AR5K_AR5211_KEYTABLE_OFF(entry, i), key_v[i]);
return (ar5k_ar5211_set_key_lladdr(hal, entry, mac));
diff --git a/sys/dev/ic/ar5212.c b/sys/dev/ic/ar5212.c
index 611a363f3d5..2caf3f13470 100644
--- a/sys/dev/ic/ar5212.c
+++ b/sys/dev/ic/ar5212.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5212.c,v 1.21 2005/05/28 23:45:09 reyk Exp $ */
+/* $OpenBSD: ar5212.c,v 1.22 2005/06/17 12:51:08 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -2333,8 +2333,8 @@ ar5k_ar5212_set_key(hal, entry, keyval, mac, xor_notused)
const u_int8_t *mac;
int xor_notused;
{
- int elements = AR5K_AR5212_KEYCACHE_SIZE - 2, i;
- u_int32_t key_v[elements];
+ int i;
+ u_int32_t key_v[AR5K_AR5212_KEYCACHE_SIZE - 2];
AR5K_ASSERT_ENTRY(entry, AR5K_AR5212_KEYTABLE_SIZE);
@@ -2370,7 +2370,7 @@ ar5k_ar5212_set_key(hal, entry, keyval, mac, xor_notused)
return (AH_FALSE);
}
- for (i = 0; i < elements; i++)
+ for (i = 0; i < AR5K_ELEMENTS(key_v); i++)
AR5K_REG_WRITE(AR5K_AR5212_KEYTABLE_OFF(entry, i), key_v[i]);
return (ar5k_ar5212_set_key_lladdr(hal, entry, mac));
diff --git a/sys/dev/ic/ar5xxx.c b/sys/dev/ic/ar5xxx.c
index 0266e9261b8..eb098d676f5 100644
--- a/sys/dev/ic/ar5xxx.c
+++ b/sys/dev/ic/ar5xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ar5xxx.c,v 1.25 2005/05/28 23:45:10 reyk Exp $ */
+/* $OpenBSD: ar5xxx.c,v 1.26 2005/06/17 12:51:08 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
@@ -408,7 +408,11 @@ ath_hal_init_channels(hal, channels, max_channels, channels_size, country, mode,
u_int i, c;
u_int32_t domain_current;
u_int domain_5ghz, domain_2ghz;
- HAL_CHANNEL all_channels[max_channels];
+ HAL_CHANNEL *all_channels;
+
+ if ((all_channels = malloc(sizeof(HAL_CHANNEL) * max_channels,
+ M_TEMP, M_NOWAIT)) == NULL)
+ return (AH_FALSE);
i = c = 0;
domain_current = hal->ah_get_regdomain(hal);
@@ -520,9 +524,9 @@ ath_hal_init_channels(hal, channels, max_channels, channels_size, country, mode,
}
done:
- bcopy(all_channels, channels, sizeof(all_channels));
+ bcopy(all_channels, channels, sizeof(HAL_CHANNEL) * max_channels);
*channels_size = c;
-
+ free(all_channels, M_TEMP);
return (AH_TRUE);
}