relayd: update to the latest version, fixes some issues found by Coverity
[openwrt.git] / package / kernel / mac80211 / patches / 307-mac80211-Deinline-drv_sta_state.patch
1 From: Denys Vlasenko <dvlasenk@redhat.com>
2 Date: Wed, 15 Jul 2015 14:56:05 +0200
3 Subject: [PATCH] mac80211: Deinline drv_sta_state
4
5 With this .config: http://busybox.net/~vda/kernel_config,
6 after deinlining the function size is 3132 bytes and there are
7 7 callsites.
8
9 Total size reduction: about 20 kbytes.
10
11 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 CC: John Linville <linville@tuxdriver.com>
13 CC: Michal Kazior <michal.kazior@tieto.com>
14 Cc: Johannes Berg <johannes.berg@intel.com>
15 Cc: linux-wireless@vger.kernel.org
16 Cc: netdev@vger.kernel.org
17 CC: linux-kernel@vger.kernel.org
18 ---
19  create mode 100644 net/mac80211/driver-ops.c
20
21 --- a/net/mac80211/Makefile
22 +++ b/net/mac80211/Makefile
23 @@ -3,6 +3,7 @@ obj-$(CPTCFG_MAC80211) += mac80211.o
24  # mac80211 objects
25  mac80211-y := \
26         main.o status.o \
27 +       driver-ops.o \
28         sta_info.o \
29         wep.o \
30         wpa.o \
31 --- /dev/null
32 +++ b/net/mac80211/driver-ops.c
33 @@ -0,0 +1,41 @@
34 +/*
35 + * This program is free software; you can redistribute it and/or modify
36 + * it under the terms of the GNU General Public License version 2 as
37 + * published by the Free Software Foundation.
38 + */
39 +#include <net/mac80211.h>
40 +#include "ieee80211_i.h"
41 +#include "trace.h"
42 +#include "driver-ops.h"
43 +
44 +__must_check
45 +int drv_sta_state(struct ieee80211_local *local,
46 +                 struct ieee80211_sub_if_data *sdata,
47 +                 struct sta_info *sta,
48 +                 enum ieee80211_sta_state old_state,
49 +                 enum ieee80211_sta_state new_state)
50 +{
51 +       int ret = 0;
52 +
53 +       might_sleep();
54 +
55 +       sdata = get_bss_sdata(sdata);
56 +       if (!check_sdata_in_driver(sdata))
57 +               return -EIO;
58 +
59 +       trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
60 +       if (local->ops->sta_state) {
61 +               ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
62 +                                           old_state, new_state);
63 +       } else if (old_state == IEEE80211_STA_AUTH &&
64 +                  new_state == IEEE80211_STA_ASSOC) {
65 +               ret = drv_sta_add(local, sdata, &sta->sta);
66 +               if (ret == 0)
67 +                       sta->uploaded = true;
68 +       } else if (old_state == IEEE80211_STA_ASSOC &&
69 +                  new_state == IEEE80211_STA_AUTH) {
70 +               drv_sta_remove(local, sdata, &sta->sta);
71 +       }
72 +       trace_drv_return_int(local, ret);
73 +       return ret;
74 +}
75 --- a/net/mac80211/driver-ops.h
76 +++ b/net/mac80211/driver-ops.h
77 @@ -573,37 +573,12 @@ static inline void drv_sta_pre_rcu_remov
78         trace_drv_return_void(local);
79  }
80  
81 -static inline __must_check
82 +__must_check
83  int drv_sta_state(struct ieee80211_local *local,
84                   struct ieee80211_sub_if_data *sdata,
85                   struct sta_info *sta,
86                   enum ieee80211_sta_state old_state,
87 -                 enum ieee80211_sta_state new_state)
88 -{
89 -       int ret = 0;
90 -
91 -       might_sleep();
92 -
93 -       sdata = get_bss_sdata(sdata);
94 -       if (!check_sdata_in_driver(sdata))
95 -               return -EIO;
96 -
97 -       trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
98 -       if (local->ops->sta_state) {
99 -               ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
100 -                                           old_state, new_state);
101 -       } else if (old_state == IEEE80211_STA_AUTH &&
102 -                  new_state == IEEE80211_STA_ASSOC) {
103 -               ret = drv_sta_add(local, sdata, &sta->sta);
104 -               if (ret == 0)
105 -                       sta->uploaded = true;
106 -       } else if (old_state == IEEE80211_STA_ASSOC &&
107 -                  new_state == IEEE80211_STA_AUTH) {
108 -               drv_sta_remove(local, sdata, &sta->sta);
109 -       }
110 -       trace_drv_return_int(local, ret);
111 -       return ret;
112 -}
113 +                 enum ieee80211_sta_state new_state);
114  
115  static inline void drv_sta_rc_update(struct ieee80211_local *local,
116                                      struct ieee80211_sub_if_data *sdata,