aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/zd1211rw/zd_mac.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2008-09-10 02:19:49 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-15 16:48:19 -0400
commite83a1070a1167eac1bf8844b9f08df5e9ea1b5bc (patch)
treeeedd67417236e38bc63e09a735362938459fd1f7 /drivers/net/wireless/zd1211rw/zd_mac.c
parentb2e1b30290539b344cbaff0d9da38012e03aa347 (diff)
zd1211rw: make use of new regulatory_hint()
This cleans up zd1211rw's own regulatory work, and makes use of the new cfg80211 regulatory_hint(). Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/zd1211rw/zd_mac.c')
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index e019102b2285..3005dd1fde42 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -3,7 +3,7 @@
3 * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de> 3 * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
4 * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org> 4 * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
5 * Copyright (C) 2006-2007 Michael Wu <flamingice@sourmilk.net> 5 * Copyright (C) 2006-2007 Michael Wu <flamingice@sourmilk.net>
6 * Copyright (c) 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> 6 * Copyright (C) 2007-2008 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -29,9 +29,23 @@
29#include "zd_def.h" 29#include "zd_def.h"
30#include "zd_chip.h" 30#include "zd_chip.h"
31#include "zd_mac.h" 31#include "zd_mac.h"
32#include "zd_ieee80211.h"
33#include "zd_rf.h" 32#include "zd_rf.h"
34 33
34struct zd_reg_alpha2_map {
35 u32 reg;
36 char alpha2[2];
37};
38
39static struct zd_reg_alpha2_map reg_alpha2_map[] = {
40 { ZD_REGDOMAIN_FCC, "US" },
41 { ZD_REGDOMAIN_IC, "CA" },
42 { ZD_REGDOMAIN_ETSI, "DE" }, /* Generic ETSI, use most restrictive */
43 { ZD_REGDOMAIN_JAPAN, "JP" },
44 { ZD_REGDOMAIN_JAPAN_ADD, "JP" },
45 { ZD_REGDOMAIN_SPAIN, "ES" },
46 { ZD_REGDOMAIN_FRANCE, "FR" },
47};
48
35/* This table contains the hardware specific values for the modulation rates. */ 49/* This table contains the hardware specific values for the modulation rates. */
36static const struct ieee80211_rate zd_rates[] = { 50static const struct ieee80211_rate zd_rates[] = {
37 { .bitrate = 10, 51 { .bitrate = 10,
@@ -95,6 +109,21 @@ static void housekeeping_init(struct zd_mac *mac);
95static void housekeeping_enable(struct zd_mac *mac); 109static void housekeeping_enable(struct zd_mac *mac);
96static void housekeeping_disable(struct zd_mac *mac); 110static void housekeeping_disable(struct zd_mac *mac);
97 111
112static int zd_reg2alpha2(u8 regdomain, char *alpha2)
113{
114 unsigned int i;
115 struct zd_reg_alpha2_map *reg_map;
116 for (i = 0; i < ARRAY_SIZE(reg_alpha2_map); i++) {
117 reg_map = &reg_alpha2_map[i];
118 if (regdomain == reg_map->reg) {
119 alpha2[0] = reg_map->alpha2[0];
120 alpha2[1] = reg_map->alpha2[1];
121 return 0;
122 }
123 }
124 return 1;
125}
126
98int zd_mac_preinit_hw(struct ieee80211_hw *hw) 127int zd_mac_preinit_hw(struct ieee80211_hw *hw)
99{ 128{
100 int r; 129 int r;
@@ -115,6 +144,7 @@ int zd_mac_init_hw(struct ieee80211_hw *hw)
115 int r; 144 int r;
116 struct zd_mac *mac = zd_hw_mac(hw); 145 struct zd_mac *mac = zd_hw_mac(hw);
117 struct zd_chip *chip = &mac->chip; 146 struct zd_chip *chip = &mac->chip;
147 char alpha2[2];
118 u8 default_regdomain; 148 u8 default_regdomain;
119 149
120 r = zd_chip_enable_int(chip); 150 r = zd_chip_enable_int(chip);
@@ -139,7 +169,9 @@ int zd_mac_init_hw(struct ieee80211_hw *hw)
139 if (r) 169 if (r)
140 goto disable_int; 170 goto disable_int;
141 171
142 zd_geo_init(hw, mac->regdomain); 172 r = zd_reg2alpha2(mac->regdomain, alpha2);
173 if (!r)
174 regulatory_hint(hw->wiphy, alpha2, NULL);
143 175
144 r = 0; 176 r = 0;
145disable_int: 177disable_int:
@@ -753,7 +785,7 @@ static int zd_op_config_interface(struct ieee80211_hw *hw,
753 return 0; 785 return 0;
754} 786}
755 787
756void zd_process_intr(struct work_struct *work) 788static void zd_process_intr(struct work_struct *work)
757{ 789{
758 u16 int_status; 790 u16 int_status;
759 struct zd_mac *mac = container_of(work, struct zd_mac, process_intr); 791 struct zd_mac *mac = container_of(work, struct zd_mac, process_intr);