diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2006-04-20 14:02:04 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-04-24 16:15:58 -0400 |
commit | 921a91ef6adffe066ce80823350b982c647033e7 (patch) | |
tree | b950c18419413d860a8caa7ac0819d0159beed79 /net/ieee80211 | |
parent | 9a1771e86756212041b32d80b850cc4c8063360a (diff) |
[PATCH] softmac: clean up event handling code
This patch cleans up the event handling code in ieee80211softmac_event.c and
makes the module slightly smaller by removing some strings that are not used
any more and consolidating some code.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/ieee80211')
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_event.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/net/ieee80211/softmac/ieee80211softmac_event.c b/net/ieee80211/softmac/ieee80211softmac_event.c index 8cc8f3f0f8e7..4b153f7cc96c 100644 --- a/net/ieee80211/softmac/ieee80211softmac_event.c +++ b/net/ieee80211/softmac/ieee80211softmac_event.c | |||
@@ -38,7 +38,8 @@ | |||
38 | * The event context is private and can only be used from | 38 | * The event context is private and can only be used from |
39 | * within this module. Its meaning varies with the event | 39 | * within this module. Its meaning varies with the event |
40 | * type: | 40 | * type: |
41 | * SCAN_FINISHED: no special meaning | 41 | * SCAN_FINISHED, |
42 | * DISASSOCIATED: NULL | ||
42 | * ASSOCIATED, | 43 | * ASSOCIATED, |
43 | * ASSOCIATE_FAILED, | 44 | * ASSOCIATE_FAILED, |
44 | * ASSOCIATE_TIMEOUT, | 45 | * ASSOCIATE_TIMEOUT, |
@@ -59,15 +60,15 @@ | |||
59 | */ | 60 | */ |
60 | 61 | ||
61 | static char *event_descriptions[IEEE80211SOFTMAC_EVENT_LAST+1] = { | 62 | static char *event_descriptions[IEEE80211SOFTMAC_EVENT_LAST+1] = { |
62 | "scan finished", | 63 | NULL, /* scan finished */ |
63 | "associated", | 64 | NULL, /* associated */ |
64 | "associating failed", | 65 | "associating failed", |
65 | "associating timed out", | 66 | "associating timed out", |
66 | "authenticated", | 67 | "authenticated", |
67 | "authenticating failed", | 68 | "authenticating failed", |
68 | "authenticating timed out", | 69 | "authenticating timed out", |
69 | "associating failed because no suitable network was found", | 70 | "associating failed because no suitable network was found", |
70 | "disassociated", | 71 | NULL, /* disassociated */ |
71 | }; | 72 | }; |
72 | 73 | ||
73 | 74 | ||
@@ -136,30 +137,24 @@ ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int eve | |||
136 | int we_event; | 137 | int we_event; |
137 | char *msg = NULL; | 138 | char *msg = NULL; |
138 | 139 | ||
140 | memset(&wrqu, '\0', sizeof (union iwreq_data)); | ||
141 | |||
139 | switch(event) { | 142 | switch(event) { |
140 | case IEEE80211SOFTMAC_EVENT_ASSOCIATED: | 143 | case IEEE80211SOFTMAC_EVENT_ASSOCIATED: |
141 | network = (struct ieee80211softmac_network *)event_ctx; | 144 | network = (struct ieee80211softmac_network *)event_ctx; |
142 | wrqu.data.length = 0; | ||
143 | wrqu.data.flags = 0; | ||
144 | memcpy(wrqu.ap_addr.sa_data, &network->bssid[0], ETH_ALEN); | 145 | memcpy(wrqu.ap_addr.sa_data, &network->bssid[0], ETH_ALEN); |
145 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 146 | /* fall through */ |
146 | we_event = SIOCGIWAP; | ||
147 | break; | ||
148 | case IEEE80211SOFTMAC_EVENT_DISASSOCIATED: | 147 | case IEEE80211SOFTMAC_EVENT_DISASSOCIATED: |
149 | wrqu.data.length = 0; | ||
150 | wrqu.data.flags = 0; | ||
151 | memset(&wrqu, '\0', sizeof (union iwreq_data)); | ||
152 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 148 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
153 | we_event = SIOCGIWAP; | 149 | we_event = SIOCGIWAP; |
154 | break; | 150 | break; |
155 | case IEEE80211SOFTMAC_EVENT_SCAN_FINISHED: | 151 | case IEEE80211SOFTMAC_EVENT_SCAN_FINISHED: |
156 | wrqu.data.length = 0; | ||
157 | wrqu.data.flags = 0; | ||
158 | memset(&wrqu, '\0', sizeof (union iwreq_data)); | ||
159 | we_event = SIOCGIWSCAN; | 152 | we_event = SIOCGIWSCAN; |
160 | break; | 153 | break; |
161 | default: | 154 | default: |
162 | msg = event_descriptions[event]; | 155 | msg = event_descriptions[event]; |
156 | if (!msg) | ||
157 | msg = "SOFTMAC EVENT BUG"; | ||
163 | wrqu.data.length = strlen(msg); | 158 | wrqu.data.length = strlen(msg); |
164 | we_event = IWEVCUSTOM; | 159 | we_event = IWEVCUSTOM; |
165 | break; | 160 | break; |