aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-03-18 03:37:55 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-18 03:37:55 -0400
commit577f99c1d08cf9cbdafd4e858dd13ff04d855090 (patch)
tree0f726bbda9b18d311d4c95198bbd96cb7ac01db0 /drivers/net/wireless/rt2x00
parent26c0f03f6b77c513cb7bc37b73a06819bdbb791b (diff)
parent2f633928cbba8a5858bb39b11e7219a41b0fbef5 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/wireless/rt2x00/rt2x00dev.c net/8021q/vlan_dev.c
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h3
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c39
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h20
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00rfkill.c116
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c5
6 files changed, 111 insertions, 76 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index dfd0af0e0a16..c016bfe1defd 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -671,6 +671,9 @@ struct rt2x00_dev {
671 * This will only be compiled in when required. 671 * This will only be compiled in when required.
672 */ 672 */
673#ifdef CONFIG_RT2X00_LIB_RFKILL 673#ifdef CONFIG_RT2X00_LIB_RFKILL
674unsigned long rfkill_state;
675#define RFKILL_STATE_ALLOCATED 1
676#define RFKILL_STATE_REGISTERED 2
674 struct rfkill *rfkill; 677 struct rfkill *rfkill;
675 struct input_polled_dev *poll_dev; 678 struct input_polled_dev *poll_dev;
676#endif /* CONFIG_RT2X00_LIB_RFKILL */ 679#endif /* CONFIG_RT2X00_LIB_RFKILL */
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index b81efc9b058d..acf4d67ba43d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -994,7 +994,7 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
994 return; 994 return;
995 995
996 /* 996 /*
997 * Unregister rfkill. 997 * Unregister extra components.
998 */ 998 */
999 rt2x00rfkill_unregister(rt2x00dev); 999 rt2x00rfkill_unregister(rt2x00dev);
1000 1000
@@ -1033,11 +1033,9 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
1033 __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); 1033 __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags);
1034 1034
1035 /* 1035 /*
1036 * Register the rfkill handler. 1036 * Register the extra components.
1037 */ 1037 */
1038 status = rt2x00rfkill_register(rt2x00dev); 1038 rt2x00rfkill_register(rt2x00dev);
1039 if (status)
1040 goto exit;
1041 1039
1042 return 0; 1040 return 0;
1043 1041
@@ -1151,20 +1149,10 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1151 } 1149 }
1152 1150
1153 /* 1151 /*
1154 * Register LED. 1152 * Register extra components.
1155 */ 1153 */
1156 rt2x00leds_register(rt2x00dev); 1154 rt2x00leds_register(rt2x00dev);
1157 1155 rt2x00rfkill_allocate(rt2x00dev);
1158 /*
1159 * Allocatie rfkill.
1160 */
1161 retval = rt2x00rfkill_allocate(rt2x00dev);
1162 if (retval)
1163 goto exit;
1164
1165 /*
1166 * Open the debugfs entry.
1167 */
1168 rt2x00debug_register(rt2x00dev); 1156 rt2x00debug_register(rt2x00dev);
1169 1157
1170 __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); 1158 __set_bit(DEVICE_PRESENT, &rt2x00dev->flags);
@@ -1193,13 +1181,9 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
1193 rt2x00lib_uninitialize(rt2x00dev); 1181 rt2x00lib_uninitialize(rt2x00dev);
1194 1182
1195 /* 1183 /*
1196 * Close debugfs entry. 1184 * Free extra components
1197 */ 1185 */
1198 rt2x00debug_deregister(rt2x00dev); 1186 rt2x00debug_deregister(rt2x00dev);
1199
1200 /*
1201 * Free rfkill
1202 */
1203 rt2x00rfkill_free(rt2x00dev); 1187 rt2x00rfkill_free(rt2x00dev);
1204 1188
1205 /* 1189 /*
@@ -1243,12 +1227,16 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)
1243 __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); 1227 __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags);
1244 1228
1245 /* 1229 /*
1246 * Disable radio and unitialize all items 1230 * Disable radio.
1247 * that must be recreated on resume.
1248 */ 1231 */
1249 rt2x00lib_stop(rt2x00dev); 1232 rt2x00lib_stop(rt2x00dev);
1250 rt2x00lib_uninitialize(rt2x00dev); 1233 rt2x00lib_uninitialize(rt2x00dev);
1234
1235 /*
1236 * Suspend/disable extra components.
1237 */
1251 rt2x00leds_suspend(rt2x00dev); 1238 rt2x00leds_suspend(rt2x00dev);
1239 rt2x00rfkill_suspend(rt2x00dev);
1252 rt2x00debug_deregister(rt2x00dev); 1240 rt2x00debug_deregister(rt2x00dev);
1253 1241
1254exit: 1242exit:
@@ -1292,9 +1280,10 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
1292 NOTICE(rt2x00dev, "Waking up.\n"); 1280 NOTICE(rt2x00dev, "Waking up.\n");
1293 1281
1294 /* 1282 /*
1295 * Open the debugfs entry and restore led handling. 1283 * Restore/enable extra components.
1296 */ 1284 */
1297 rt2x00debug_register(rt2x00dev); 1285 rt2x00debug_register(rt2x00dev);
1286 rt2x00rfkill_resume(rt2x00dev);
1298 rt2x00leds_resume(rt2x00dev); 1287 rt2x00leds_resume(rt2x00dev);
1299 1288
1300 /* 1289 /*
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index e4b4dd23d611..64fae7e3f73b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -148,28 +148,36 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
148 * RFkill handlers. 148 * RFkill handlers.
149 */ 149 */
150#ifdef CONFIG_RT2X00_LIB_RFKILL 150#ifdef CONFIG_RT2X00_LIB_RFKILL
151int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev); 151void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev);
152void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev); 152void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev);
153int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev); 153void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev);
154void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev); 154void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev);
155void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev);
156void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev);
155#else 157#else
156static inline int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) 158static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
157{ 159{
158 return 0;
159} 160}
160 161
161static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) 162static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
162{ 163{
163} 164}
164 165
165static inline int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) 166static inline void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
166{ 167{
167 return 0;
168} 168}
169 169
170static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) 170static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
171{ 171{
172} 172}
173
174static inline void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev)
175{
176}
177
178static inline void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev)
179{
180}
173#endif /* CONFIG_RT2X00_LIB_RFKILL */ 181#endif /* CONFIG_RT2X00_LIB_RFKILL */
174 182
175/* 183/*
diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
index 67121427a5bd..fcef9885ab5e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c
+++ b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
@@ -69,56 +69,81 @@ static void rt2x00rfkill_poll(struct input_polled_dev *poll_dev)
69 } 69 }
70} 70}
71 71
72int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) 72void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
73{ 73{
74 int retval; 74 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
75 75 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
76 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 76 return;
77 return 0;
78 77
79 retval = rfkill_register(rt2x00dev->rfkill); 78 if (rfkill_register(rt2x00dev->rfkill)) {
80 if (retval) {
81 ERROR(rt2x00dev, "Failed to register rfkill handler.\n"); 79 ERROR(rt2x00dev, "Failed to register rfkill handler.\n");
82 return retval; 80 return;
83 } 81 }
84 82
85 retval = input_register_polled_device(rt2x00dev->poll_dev); 83 if (input_register_polled_device(rt2x00dev->poll_dev)) {
86 if (retval) {
87 ERROR(rt2x00dev, "Failed to register polled device.\n"); 84 ERROR(rt2x00dev, "Failed to register polled device.\n");
88 rfkill_unregister(rt2x00dev->rfkill); 85 rfkill_unregister(rt2x00dev->rfkill);
89 return retval; 86 return;
90 } 87 }
91 88
89 __set_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state);
90
92 /* 91 /*
93 * Force initial poll which will detect the initial device state, 92 * Force initial poll which will detect the initial device state,
94 * and correctly sends the signal to the rfkill layer about this 93 * and correctly sends the signal to the rfkill layer about this
95 * state. 94 * state.
96 */ 95 */
97 rt2x00rfkill_poll(rt2x00dev->poll_dev); 96 rt2x00rfkill_poll(rt2x00dev->poll_dev);
98
99 return 0;
100} 97}
101 98
102void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) 99void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
103{ 100{
104 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 101 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
102 !test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state))
105 return; 103 return;
106 104
107 input_unregister_polled_device(rt2x00dev->poll_dev); 105 input_unregister_polled_device(rt2x00dev->poll_dev);
108 rfkill_unregister(rt2x00dev->rfkill); 106 rfkill_unregister(rt2x00dev->rfkill);
107
108 __clear_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state);
109} 109}
110 110
111int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) 111static struct input_polled_dev *
112rt2x00rfkill_allocate_polldev(struct rt2x00_dev *rt2x00dev)
112{ 113{
113 struct device *device = wiphy_dev(rt2x00dev->hw->wiphy); 114 struct input_polled_dev *poll_dev;
115
116 poll_dev = input_allocate_polled_device();
117 if (!poll_dev)
118 return NULL;
119
120 poll_dev->private = rt2x00dev;
121 poll_dev->poll = rt2x00rfkill_poll;
122 poll_dev->poll_interval = RFKILL_POLL_INTERVAL;
123
124 poll_dev->input->name = rt2x00dev->ops->name;
125 poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy);
126 poll_dev->input->id.bustype = BUS_HOST;
127 poll_dev->input->id.vendor = 0x1814;
128 poll_dev->input->id.product = rt2x00dev->chip.rt;
129 poll_dev->input->id.version = rt2x00dev->chip.rev;
130 poll_dev->input->dev.parent = wiphy_dev(rt2x00dev->hw->wiphy);
131 poll_dev->input->evbit[0] = BIT(EV_KEY);
132 set_bit(KEY_WLAN, poll_dev->input->keybit);
133
134 return poll_dev;
135}
114 136
137void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
138{
115 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 139 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
116 return 0; 140 return;
117 141
118 rt2x00dev->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); 142 rt2x00dev->rfkill =
143 rfkill_allocate(wiphy_dev(rt2x00dev->hw->wiphy), RFKILL_TYPE_WLAN);
119 if (!rt2x00dev->rfkill) { 144 if (!rt2x00dev->rfkill) {
120 ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n"); 145 ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n");
121 goto exit; 146 return;
122 } 147 }
123 148
124 rt2x00dev->rfkill->name = rt2x00dev->ops->name; 149 rt2x00dev->rfkill->name = rt2x00dev->ops->name;
@@ -126,40 +151,49 @@ int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
126 rt2x00dev->rfkill->state = -1; 151 rt2x00dev->rfkill->state = -1;
127 rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio; 152 rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio;
128 153
129 rt2x00dev->poll_dev = input_allocate_polled_device(); 154 rt2x00dev->poll_dev = rt2x00rfkill_allocate_polldev(rt2x00dev);
130 if (!rt2x00dev->poll_dev) { 155 if (!rt2x00dev->poll_dev) {
131 ERROR(rt2x00dev, "Failed to allocate polled device.\n"); 156 ERROR(rt2x00dev, "Failed to allocate polled device.\n");
132 goto exit_free_rfkill; 157 rfkill_free(rt2x00dev->rfkill);
158 rt2x00dev->rfkill = NULL;
159 return;
133 } 160 }
134 161
135 rt2x00dev->poll_dev->private = rt2x00dev; 162 return;
136 rt2x00dev->poll_dev->poll = rt2x00rfkill_poll; 163}
137 rt2x00dev->poll_dev->poll_interval = RFKILL_POLL_INTERVAL;
138 164
139 rt2x00dev->poll_dev->input->name = rt2x00dev->ops->name; 165void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
140 rt2x00dev->poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy); 166{
141 rt2x00dev->poll_dev->input->id.bustype = BUS_HOST; 167 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
142 rt2x00dev->poll_dev->input->id.vendor = 0x1814; 168 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
143 rt2x00dev->poll_dev->input->id.product = rt2x00dev->chip.rt; 169 return;
144 rt2x00dev->poll_dev->input->id.version = rt2x00dev->chip.rev;
145 rt2x00dev->poll_dev->input->dev.parent = device;
146 rt2x00dev->poll_dev->input->evbit[0] = BIT(EV_KEY);
147 set_bit(KEY_WLAN, rt2x00dev->poll_dev->input->keybit);
148 170
149 return 0; 171 input_free_polled_device(rt2x00dev->poll_dev);
172 rt2x00dev->poll_dev = NULL;
150 173
151exit_free_rfkill:
152 rfkill_free(rt2x00dev->rfkill); 174 rfkill_free(rt2x00dev->rfkill);
153 175 rt2x00dev->rfkill = NULL;
154exit:
155 return -ENOMEM;
156} 176}
157 177
158void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) 178void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev)
159{ 179{
160 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) 180 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
181 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
161 return; 182 return;
162 183
163 input_free_polled_device(rt2x00dev->poll_dev); 184 input_free_polled_device(rt2x00dev->poll_dev);
164 rfkill_free(rt2x00dev->rfkill); 185 rt2x00dev->poll_dev = NULL;
186}
187
188void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev)
189{
190 if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) ||
191 !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
192 return;
193
194 rt2x00dev->poll_dev = rt2x00rfkill_allocate_polldev(rt2x00dev);
195 if (!rt2x00dev->poll_dev) {
196 ERROR(rt2x00dev, "Failed to allocate polled device.\n");
197 return;
198 }
165} 199}
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 4baa916b80cf..babb240cef3d 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2306,9 +2306,9 @@ static void rt61pci_configure_filter(struct ieee80211_hw *hw,
2306 * Apply some rules to the filters: 2306 * Apply some rules to the filters:
2307 * - Some filters imply different filters to be set. 2307 * - Some filters imply different filters to be set.
2308 * - Some things we can't filter out at all. 2308 * - Some things we can't filter out at all.
2309 * - Multicast filter seems to kill broadcast traffic so never use it.
2309 */ 2310 */
2310 if (mc_count) 2311 *total_flags |= FIF_ALLMULTI;
2311 *total_flags |= FIF_ALLMULTI;
2312 if (*total_flags & FIF_OTHER_BSS || 2312 if (*total_flags & FIF_OTHER_BSS ||
2313 *total_flags & FIF_PROMISC_IN_BSS) 2313 *total_flags & FIF_PROMISC_IN_BSS)
2314 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; 2314 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 48938819ee2f..46b040bf62de 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1906,9 +1906,9 @@ static void rt73usb_configure_filter(struct ieee80211_hw *hw,
1906 * Apply some rules to the filters: 1906 * Apply some rules to the filters:
1907 * - Some filters imply different filters to be set. 1907 * - Some filters imply different filters to be set.
1908 * - Some things we can't filter out at all. 1908 * - Some things we can't filter out at all.
1909 * - Multicast filter seems to kill broadcast traffic so never use it.
1909 */ 1910 */
1910 if (mc_count) 1911 *total_flags |= FIF_ALLMULTI;
1911 *total_flags |= FIF_ALLMULTI;
1912 if (*total_flags & FIF_OTHER_BSS || 1912 if (*total_flags & FIF_OTHER_BSS ||
1913 *total_flags & FIF_PROMISC_IN_BSS) 1913 *total_flags & FIF_PROMISC_IN_BSS)
1914 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; 1914 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
@@ -2163,6 +2163,7 @@ static struct usb_device_id rt73usb_device_table[] = {
2163 /* D-Link */ 2163 /* D-Link */
2164 { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) }, 2164 { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) },
2165 { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) }, 2165 { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) },
2166 { USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) },
2166 /* Gemtek */ 2167 /* Gemtek */
2167 { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) }, 2168 { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) },
2168 /* Gigabyte */ 2169 /* Gigabyte */