2014-04-09 01:28:48

by Zhao, Gang

[permalink] [raw]
Subject: [PATCH 1/8] cfg80211: fix possible compile warning in wext-compat.h

Function cfg80211_wext_freq() is declared in wext-compat.h, but its
parameter struct wiphy's declaration is not included there. Actually
the parameter is not used in this function, so change it to normal
net_device.

The compile warning doesn't show up due to duplicate including, but
it's worth fixing it.

net/wireless/wext-compat.h:53:52: warning: ‘struct wiphy’ declared inside parameter list [enabled by default]
int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq);
^
net/wireless/wext-compat.h:53:52: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

Signed-off-by: Zhao, Gang <[email protected]>
---
net/wireless/ibss.c | 2 +-
net/wireless/scan.c | 6 +++++-
net/wireless/wext-compat.c | 8 ++++----
net/wireless/wext-compat.h | 2 +-
net/wireless/wext-sme.c | 2 +-
5 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 071e99c..407f413 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -322,7 +322,7 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
if (!rdev->ops->join_ibss)
return -EOPNOTSUPP;

- freq = cfg80211_wext_freq(wdev->wiphy, wextfreq);
+ freq = cfg80211_wext_freq(dev, wextfreq);
if (freq < 0)
return freq;

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 7d09a71..d526d65 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -1147,7 +1147,11 @@ int cfg80211_wext_siwscan(struct net_device *dev,
int k;
int wiphy_freq = wiphy->bands[band]->channels[j].center_freq;
for (k = 0; k < wreq->num_channels; k++) {
- int wext_freq = cfg80211_wext_freq(wiphy, &wreq->channel_list[k]);
+ struct iw_freq *freq =
+ &wreq->channel_list[k];
+
+ int wext_freq =
+ cfg80211_wext_freq(dev, freq);
if (wext_freq == wiphy_freq)
goto wext_freq_found;
}
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 5661a54..9984d2f 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -253,12 +253,12 @@ EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange);

/**
* cfg80211_wext_freq - get wext frequency for non-"auto"
- * @wiphy: the wiphy
+ * @dev: the net device
* @freq: the wext freq encoding
*
* Returns a frequency, or a negative error code, or 0 for auto.
*/
-int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq)
+int cfg80211_wext_freq(struct net_device *dev, struct iw_freq *freq)
{
/*
* Parse frequency - return 0 for auto and
@@ -787,7 +787,7 @@ static int cfg80211_wext_siwfreq(struct net_device *dev,
case NL80211_IFTYPE_ADHOC:
return cfg80211_ibss_wext_siwfreq(dev, info, wextfreq, extra);
case NL80211_IFTYPE_MONITOR:
- freq = cfg80211_wext_freq(wdev->wiphy, wextfreq);
+ freq = cfg80211_wext_freq(dev, wextfreq);
if (freq < 0)
return freq;
if (freq == 0)
@@ -798,7 +798,7 @@ static int cfg80211_wext_siwfreq(struct net_device *dev,
return -EINVAL;
return cfg80211_set_monitor_channel(rdev, &chandef);
case NL80211_IFTYPE_MESH_POINT:
- freq = cfg80211_wext_freq(wdev->wiphy, wextfreq);
+ freq = cfg80211_wext_freq(dev, wextfreq);
if (freq < 0)
return freq;
if (freq == 0)
diff --git a/net/wireless/wext-compat.h b/net/wireless/wext-compat.h
index 5d766b0..bd6aa81 100644
--- a/net/wireless/wext-compat.h
+++ b/net/wireless/wext-compat.h
@@ -50,7 +50,7 @@ int cfg80211_wext_siwgenie(struct net_device *dev,
struct iw_point *data, char *extra);


-int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq);
+int cfg80211_wext_freq(struct net_device *dev, struct iw_freq *freq);


extern const struct iw_handler_def cfg80211_wext_handler;
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index 86c331a..765e37b 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -75,7 +75,7 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION))
return -EINVAL;

- freq = cfg80211_wext_freq(wdev->wiphy, wextfreq);
+ freq = cfg80211_wext_freq(dev, wextfreq);
if (freq < 0)
return freq;

--
1.9.0



2014-04-09 01:28:58

by Zhao, Gang

[permalink] [raw]
Subject: [PATCH 5/8] cfg80211: remove unnecessary include clauses (cfg80211.h)

<linux/if_ether.h> is included by <linux/ieee80211.h>;
<linux/skbuff.h> is included by <linux/if_ether.h>;
<linux/bug.h> and <linux/net.h> is included by <linux/skbuff.h>.

So just remove them.

Signed-off-by: Zhao, Gang <[email protected]>
---
include/net/cfg80211.h | 4 ----
1 file changed, 4 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index fb8afce..6e32623 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -13,13 +13,9 @@
#include <linux/netdevice.h>
#include <linux/debugfs.h>
#include <linux/list.h>
-#include <linux/bug.h>
#include <linux/netlink.h>
-#include <linux/skbuff.h>
#include <linux/nl80211.h>
-#include <linux/if_ether.h>
#include <linux/ieee80211.h>
-#include <linux/net.h>
#include <net/regulatory.h>

/**
--
1.9.0


2014-04-09 12:47:49

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 3/8] mac80211: fix possible compile warning in michael.h

On Wed, 2014-04-09 at 09:28 +0800, Zhao, Gang wrote:
> The warning doesn't show up due to duplicate including, but it's worth
> fixing it.
>
> net/mac80211//michael.h:22:4: warning: ‘struct ieee80211_hdr’ declared inside parameter list [enabled by default]
> const u8 *data, size_t data_len, u8 *mic);
> ^
> net/mac80211//michael.h:22:4: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
>
> Signed-off-by: Zhao, Gang <[email protected]>
> ---
> net/mac80211/michael.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/mac80211/michael.h b/net/mac80211/michael.h
> index 3b848da..b259547 100644
> --- a/net/mac80211/michael.h
> +++ b/net/mac80211/michael.h
> @@ -10,7 +10,7 @@
> #ifndef MICHAEL_H
> #define MICHAEL_H
>
> -#include <linux/types.h>
> +#include <linux/ieee80211.h>

This should probably include both now though.

johannes


2014-04-09 01:28:51

by Zhao, Gang

[permalink] [raw]
Subject: [PATCH 2/8] mac80211: fix possible compile warning in debugfs.h

The warning doesn't show up due to duplicate including, but it's worth
fixing it.

net/mac80211/debugfs.h:5:28: warning: ‘struct ieee80211_local’ declared inside parameter list [enabled by default]
void debugfs_hw_add(struct ieee80211_local *local);
^
net/mac80211/debugfs.h:5:28: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

Signed-off-by: Zhao, Gang <[email protected]>
---
net/mac80211/debugfs.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/mac80211/debugfs.h b/net/mac80211/debugfs.h
index 214ed4e..60c35af 100644
--- a/net/mac80211/debugfs.h
+++ b/net/mac80211/debugfs.h
@@ -1,6 +1,8 @@
#ifndef __MAC80211_DEBUGFS_H
#define __MAC80211_DEBUGFS_H

+#include "ieee80211_i.h"
+
#ifdef CONFIG_MAC80211_DEBUGFS
void debugfs_hw_add(struct ieee80211_local *local);
int __printf(4, 5) mac80211_format_buffer(char __user *userbuf, size_t count,
--
1.9.0


2014-04-11 00:27:30

by Zhao, Gang

[permalink] [raw]
Subject: Re: [PATCH 1/8] cfg80211: fix possible compile warning in wext-compat.h

On Thu, 2014-04-10 at 10:09:36 +0200, Johannes Berg wrote:
> On Wed, 2014-04-09 at 09:28 +0800, Zhao, Gang wrote:
>> Function cfg80211_wext_freq() is declared in wext-compat.h, but its
>> parameter struct wiphy's declaration is not included there. Actually
>> the parameter is not used in this function, so change it to normal
>> net_device.
>
> I applied this, but the netdev argument is also unused so I just removed
> it entirely.

I added netdev argument just to be consistent with other functions. It's
OK to remove it.

>
> johannes

2014-04-09 01:29:07

by Zhao, Gang

[permalink] [raw]
Subject: [PATCH 8/8] cfg80211: remove unnecessary include clauses

Signed-off-by: Zhao, Gang <[email protected]>
---
net/wireless/ap.c | 5 -----
net/wireless/chan.c | 3 ---
net/wireless/core.c | 14 +-------------
net/wireless/core.h | 8 +++-----
net/wireless/debugfs.c | 1 -
net/wireless/ethtool.c | 3 +--
net/wireless/ibss.c | 5 +----
net/wireless/mesh.c | 4 ----
net/wireless/mlme.c | 10 +---------
net/wireless/nl80211.c | 17 +----------------
net/wireless/radiotap.c | 3 ---
net/wireless/rdev-ops.h | 3 ---
net/wireless/reg.c | 9 +--------
net/wireless/scan.c | 11 ++---------
net/wireless/sme.c | 9 +--------
net/wireless/sysfs.c | 7 -------
net/wireless/trace.c | 3 +--
net/wireless/trace.h | 2 --
net/wireless/util.c | 10 ++--------
net/wireless/wext-compat.c | 8 +-------
net/wireless/wext-compat.h | 1 -
net/wireless/wext-sme.c | 4 +---
22 files changed, 17 insertions(+), 123 deletions(-)

diff --git a/net/wireless/ap.c b/net/wireless/ap.c
index 3e02ade..f53cf30 100644
--- a/net/wireless/ap.c
+++ b/net/wireless/ap.c
@@ -1,11 +1,6 @@
-#include <linux/ieee80211.h>
-#include <linux/export.h>
-#include <net/cfg80211.h>
#include "nl80211.h"
-#include "core.h"
#include "rdev-ops.h"

-
static int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
struct net_device *dev, bool notify)
{
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 7908dc2..9407b24 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -6,9 +6,6 @@
* Copyright 2009 Johannes Berg <[email protected]>
*/

-#include <linux/export.h>
-#include <net/cfg80211.h>
-#include "core.h"
#include "rdev-ops.h"

void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 5fc0df0..509b000 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -6,22 +6,10 @@

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

-#include <linux/if.h>
#include <linux/module.h>
-#include <linux/err.h>
-#include <linux/list.h>
-#include <linux/slab.h>
-#include <linux/nl80211.h>
-#include <linux/debugfs.h>
-#include <linux/notifier.h>
-#include <linux/device.h>
#include <linux/etherdevice.h>
-#include <linux/rtnetlink.h>
-#include <linux/sched.h>
-#include <net/genetlink.h>
-#include <net/cfg80211.h>
+
#include "nl80211.h"
-#include "core.h"
#include "sysfs.h"
#include "debugfs.h"
#include "wext-compat.h"
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 5bee6cc..bfb1afd 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -3,19 +3,17 @@
*
* Copyright 2006-2010 Johannes Berg <[email protected]>
*/
+
#ifndef __NET_WIRELESS_CORE_H
#define __NET_WIRELESS_CORE_H
-#include <linux/list.h>
-#include <linux/netdevice.h>
+
#include <linux/rbtree.h>
-#include <linux/debugfs.h>
#include <linux/rfkill.h>
-#include <linux/workqueue.h>
#include <linux/rtnetlink.h>
#include <net/genetlink.h>
#include <net/cfg80211.h>
-#include "reg.h"

+#include "reg.h"

#define WIPHY_IDX_INVALID -1

diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c
index 4541577..879a779 100644
--- a/net/wireless/debugfs.c
+++ b/net/wireless/debugfs.c
@@ -9,7 +9,6 @@
* published by the Free Software Foundation.
*/

-#include <linux/slab.h>
#include "core.h"
#include "debugfs.h"

diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c
index e37862f..7926224 100644
--- a/net/wireless/ethtool.c
+++ b/net/wireless/ethtool.c
@@ -1,6 +1,5 @@
#include <linux/utsname.h>
-#include <net/cfg80211.h>
-#include "core.h"
+
#include "ethtool.h"
#include "rdev-ops.h"

diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 407f413..9d91f78 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -6,14 +6,11 @@

#include <linux/etherdevice.h>
#include <linux/if_arp.h>
-#include <linux/slab.h>
-#include <linux/export.h>
-#include <net/cfg80211.h>
+
#include "wext-compat.h"
#include "nl80211.h"
#include "rdev-ops.h"

-
void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
struct ieee80211_channel *channel)
{
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index 3ddfb7c..95c1ae2 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -1,8 +1,4 @@
-#include <linux/ieee80211.h>
-#include <linux/export.h>
-#include <net/cfg80211.h>
#include "nl80211.h"
-#include "core.h"
#include "rdev-ops.h"

/* Default values, timeouts in ms */
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 4b4ba70..48dbb3f 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -4,20 +4,12 @@
* Copyright (c) 2009, Jouni Malinen <[email protected]>
*/

-#include <linux/kernel.h>
-#include <linux/module.h>
#include <linux/etherdevice.h>
-#include <linux/netdevice.h>
-#include <linux/nl80211.h>
-#include <linux/slab.h>
-#include <linux/wireless.h>
-#include <net/cfg80211.h>
#include <net/iw_handler.h>
-#include "core.h"
+
#include "nl80211.h"
#include "rdev-ops.h"

-
void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss,
const u8 *buf, size_t len)
{
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 232d15c..3d53a91 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4,25 +4,10 @@
* Copyright 2006-2010 Johannes Berg <[email protected]>
*/

-#include <linux/if.h>
-#include <linux/module.h>
-#include <linux/err.h>
-#include <linux/slab.h>
-#include <linux/list.h>
-#include <linux/if_ether.h>
-#include <linux/ieee80211.h>
-#include <linux/nl80211.h>
-#include <linux/rtnetlink.h>
-#include <linux/netlink.h>
#include <linux/etherdevice.h>
-#include <net/net_namespace.h>
-#include <net/genetlink.h>
-#include <net/cfg80211.h>
-#include <net/sock.h>
#include <net/inet_connection_sock.h>
-#include "core.h"
+
#include "nl80211.h"
-#include "reg.h"
#include "rdev-ops.h"

static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
diff --git a/net/wireless/radiotap.c b/net/wireless/radiotap.c
index 722da61..f3e04e4 100644
--- a/net/wireless/radiotap.c
+++ b/net/wireless/radiotap.c
@@ -14,11 +14,8 @@
* See COPYING for more details.
*/

-#include <linux/kernel.h>
-#include <linux/export.h>
#include <net/cfg80211.h>
#include <net/ieee80211_radiotap.h>
-#include <asm/unaligned.h>

/* function prototypes and related defs are in include/net/cfg80211.h */

diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 74d97d3..3a8bace 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1,9 +1,6 @@
#ifndef __CFG80211_RDEV_OPS
#define __CFG80211_RDEV_OPS

-#include <linux/rtnetlink.h>
-#include <net/cfg80211.h>
-#include "core.h"
#include "trace.h"

static inline int rdev_suspend(struct cfg80211_registered_device *rdev,
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 3ebce75..e571ea6 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -44,17 +44,10 @@

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

-#include <linux/kernel.h>
-#include <linux/export.h>
-#include <linux/slab.h>
-#include <linux/list.h>
#include <linux/ctype.h>
-#include <linux/nl80211.h>
#include <linux/platform_device.h>
#include <linux/moduleparam.h>
-#include <net/cfg80211.h>
-#include "core.h"
-#include "reg.h"
+
#include "regdb.h"
#include "nl80211.h"

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index d526d65..bd64517 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -3,18 +3,11 @@
*
* Copyright 2008 Johannes Berg <[email protected]>
*/
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/netdevice.h>
-#include <linux/wireless.h>
-#include <linux/nl80211.h>
+
#include <linux/etherdevice.h>
#include <net/arp.h>
-#include <net/cfg80211.h>
#include <net/cfg80211-wext.h>
-#include <net/iw_handler.h>
-#include "core.h"
+
#include "nl80211.h"
#include "wext-compat.h"
#include "rdev-ops.h"
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 998674f..6e549ff 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -7,17 +7,10 @@
* Copyright (C) 2009 Intel Corporation. All rights reserved.
*/

-#include <linux/etherdevice.h>
#include <linux/if_arp.h>
-#include <linux/slab.h>
-#include <linux/workqueue.h>
-#include <linux/wireless.h>
-#include <linux/export.h>
#include <net/iw_handler.h>
-#include <net/cfg80211.h>
-#include <net/rtnetlink.h>
+
#include "nl80211.h"
-#include "reg.h"
#include "rdev-ops.h"

/*
diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index 9ee6bc1..43d35d9 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -8,14 +8,7 @@
* This file is GPLv2 as found in COPYING.
*/

-#include <linux/device.h>
-#include <linux/module.h>
-#include <linux/netdevice.h>
-#include <linux/nl80211.h>
-#include <linux/rtnetlink.h>
-#include <net/cfg80211.h>
#include "sysfs.h"
-#include "core.h"
#include "rdev-ops.h"

static inline struct cfg80211_registered_device *dev_to_rdev(
diff --git a/net/wireless/trace.c b/net/wireless/trace.c
index 95f997f..e9f7a99 100644
--- a/net/wireless/trace.c
+++ b/net/wireless/trace.c
@@ -1,7 +1,6 @@
-#include <linux/module.h>
-
#ifndef __CHECKER__
#define CREATE_TRACE_POINTS
+
#include "trace.h"

#endif
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 47b499f..cb04787 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -6,8 +6,6 @@

#include <linux/tracepoint.h>

-#include <linux/rtnetlink.h>
-#include <net/cfg80211.h>
#include "core.h"

#define MAC_ENTRY(entry_mac) __array(u8, entry_mac, ETH_ALEN)
diff --git a/net/wireless/util.c b/net/wireless/util.c
index c5d0208..d865356 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -3,17 +3,11 @@
*
* Copyright 2007-2009 Johannes Berg <[email protected]>
*/
-#include <linux/export.h>
-#include <linux/bitops.h>
-#include <linux/etherdevice.h>
-#include <linux/slab.h>
-#include <net/cfg80211.h>
-#include <net/ip.h>
+
#include <net/dsfield.h>
#include <linux/if_vlan.h>
-#include "core.h"
-#include "rdev-ops.h"

+#include "rdev-ops.h"

struct ieee80211_rate *
ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 9984d2f..d53faa58 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -8,17 +8,11 @@
* Copyright 2008-2009 Johannes Berg <[email protected]>
*/

-#include <linux/export.h>
-#include <linux/wireless.h>
-#include <linux/nl80211.h>
#include <linux/if_arp.h>
#include <linux/etherdevice.h>
-#include <linux/slab.h>
-#include <net/iw_handler.h>
-#include <net/cfg80211.h>
#include <net/cfg80211-wext.h>
+
#include "wext-compat.h"
-#include "core.h"
#include "rdev-ops.h"

int cfg80211_wext_giwname(struct net_device *dev,
diff --git a/net/wireless/wext-compat.h b/net/wireless/wext-compat.h
index bd6aa81..4d643f4 100644
--- a/net/wireless/wext-compat.h
+++ b/net/wireless/wext-compat.h
@@ -2,7 +2,6 @@
#define __WEXT_COMPAT

#include <net/iw_handler.h>
-#include <linux/wireless.h>

int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
struct iw_request_info *info,
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index 765e37b..0c46790 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -5,12 +5,10 @@
* Copyright (C) 2009 Intel Corporation. All rights reserved.
*/

-#include <linux/export.h>
#include <linux/etherdevice.h>
#include <linux/if_arp.h>
-#include <linux/slab.h>
-#include <net/cfg80211.h>
#include <net/cfg80211-wext.h>
+
#include "wext-compat.h"
#include "nl80211.h"

--
1.9.0


2014-04-09 12:25:32

by Zhao, Gang

[permalink] [raw]
Subject: Re: [PATCH 8/8] cfg80211: remove unnecessary include clauses

On Wed, 2014-04-09 at 09:49:30 +0200, Johannes Berg wrote:
> I don't like those last four patches, I'd rather have more includes than
> rely on other headers including headers that we need - that could change
> after all.

As I said in commit log, duplicate including could hide some warnings.

In theory, the possibility of change is equal, either it's a directly
included header or a indirectly included header, and it's more likely to
change to include more, not less. So the change may not cause any
problem.

In other way, the local directory header files may change more
frequently than the header files in include/ directory. Whether it's a
total win to apply the last four patches may be a question, but it's
just amusing to see that lots of lines can be deleted. :-)

>
> johannes

2014-04-09 12:43:34

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 8/8] cfg80211: remove unnecessary include clauses

On Wed, 2014-04-09 at 14:36 +0200, Johannes Berg wrote:

> At the current point in time. If some of the headers that you rely on
> including something no longer does in the future because it no longer
> needs that, then you just broke everything.

Take the first of those patches for example. You say

<linux/bug.h> and <linux/net.h> is included by <linux/skbuff.h>.

However, this is a side effect of some implementation detail in
skbuff.h. If, in the future, some function in skbuff.h is no longer
inlined, then skbuff.h will no longer have to include bug.h and can
remove it. That change would break the build due to your patches.

The way you should think about this isn't the mechanic include chain,
it's the API that each file defines. skbuff.h includes bug.h due to an
implementation detail, but it doesn't intentionally re-export all the
bug.h API, that's not the purpose of skbuff.h. The purpose of skbuff.h
is to capture the SKB related APIs and structures, so that's the only
thing you should rely on getting from it.

Similarly, you should include bug.h if you need the APIs from that,
rather than relying on it being included more or less accidentally
through something else.

Obviously, the lack of namespaces etc. in the compiler makes it
impossible to actually enforce this, and as a result we often *miss*
includes that should be there, which sometimes gets found later when
things change or on different platforms if the recursive include was
platform specific, but we shouldn't exacerbate this problem by actively
removing correct includes.

Now, of course, if you find includes that aren't actually *needed* (e.g.
bug.h in a file that doesn't use BUG() or WARN() variants) then those
should be removed.

johannes


2014-04-09 01:28:56

by Zhao, Gang

[permalink] [raw]
Subject: [PATCH 4/8] mac80211: fix possible compile warning in debugfs_netdev.h

The warning doesn't show up due to duplicate including, but it's worth
fixing it.

net/mac80211//debugfs_netdev.h:7:42: warning: ‘struct ieee80211_sub_if_data’ declared inside parameter list [enabled by default]
void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata);
^
net/mac80211//debugfs_netdev.h:7:42: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

Signed-off-by: Zhao, Gang <[email protected]>
---
net/mac80211/debugfs_netdev.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/mac80211/debugfs_netdev.h b/net/mac80211/debugfs_netdev.h
index 79025e7..9f5501a 100644
--- a/net/mac80211/debugfs_netdev.h
+++ b/net/mac80211/debugfs_netdev.h
@@ -3,6 +3,8 @@
#ifndef __IEEE80211_DEBUGFS_NETDEV_H
#define __IEEE80211_DEBUGFS_NETDEV_H

+#include "ieee80211_i.h"
+
#ifdef CONFIG_MAC80211_DEBUGFS
void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata);
void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata);
--
1.9.0


2014-04-09 01:28:53

by Zhao, Gang

[permalink] [raw]
Subject: [PATCH 3/8] mac80211: fix possible compile warning in michael.h

The warning doesn't show up due to duplicate including, but it's worth
fixing it.

net/mac80211//michael.h:22:4: warning: ‘struct ieee80211_hdr’ declared inside parameter list [enabled by default]
const u8 *data, size_t data_len, u8 *mic);
^
net/mac80211//michael.h:22:4: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

Signed-off-by: Zhao, Gang <[email protected]>
---
net/mac80211/michael.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/michael.h b/net/mac80211/michael.h
index 3b848da..b259547 100644
--- a/net/mac80211/michael.h
+++ b/net/mac80211/michael.h
@@ -10,7 +10,7 @@
#ifndef MICHAEL_H
#define MICHAEL_H

-#include <linux/types.h>
+#include <linux/ieee80211.h>

#define MICHAEL_MIC_LEN 8

--
1.9.0


2014-04-09 01:29:01

by Zhao, Gang

[permalink] [raw]
Subject: [PATCH 6/8] mac80211: remove unnecessary include clauses (mac80211.h)

<linux/bug.h>, <linux/kernel.h>, <linux/if_ether.h>, <linux/skbuff.h>
and <linux/ieee80211.h> are all directly or indirectly included by
<net/cfg80211.h>.

So just remove them.

Signed-off-by: Zhao, Gang <[email protected]>
---
include/net/mac80211.h | 5 -----
1 file changed, 5 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 604e279..7d7d828 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -13,11 +13,6 @@
#ifndef MAC80211_H
#define MAC80211_H

-#include <linux/bug.h>
-#include <linux/kernel.h>
-#include <linux/if_ether.h>
-#include <linux/skbuff.h>
-#include <linux/ieee80211.h>
#include <net/cfg80211.h>
#include <asm/unaligned.h>

--
1.9.0


2014-04-09 12:50:31

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 4/8] mac80211: fix possible compile warning in debugfs_netdev.h

On Wed, 2014-04-09 at 09:28 +0800, Zhao, Gang wrote:
> The warning doesn't show up due to duplicate including, but it's worth
> fixing it.

I've applied patches 2-4 as a single squashed patch. I'm definitely
dropping 5-8, and still considering patch 1.

johannes


2014-04-09 12:37:18

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 8/8] cfg80211: remove unnecessary include clauses

On Wed, 2014-04-09 at 20:25 +0800, Zhao, Gang wrote:
> On Wed, 2014-04-09 at 09:49:30 +0200, Johannes Berg wrote:
> > I don't like those last four patches, I'd rather have more includes than
> > rely on other headers including headers that we need - that could change
> > after all.
>
> As I said in commit log, duplicate including could hide some warnings.

Well, the commit logs for these patches didn't have any such
information, but that's not really the point. Besides, what does "could
hide some warnings" even mean? This isn't a meaningful thing, if you
include the right headers then you should get what you need, and you
should include the headers for what you need.

> In theory, the possibility of change is equal, either it's a directly
> included header or a indirectly included header, and it's more likely to
> change to include more, not less. So the change may not cause any
> problem.

At the current point in time. If some of the headers that you rely on
including something no longer does in the future because it no longer
needs that, then you just broke everything. That's the point you
seemingly didn't consider, and I think it's much better to include what
you need rather than rely on somebody else doing it for you. The latter
can even be architecture-specific.

> In other way, the local directory header files may change more
> frequently than the header files in include/ directory. Whether it's a
> total win to apply the last four patches may be a question, but it's
> just amusing to see that lots of lines can be deleted. :-)

# of lines isn't a relevant metric though. If you were removing includes
that we didn't need that's certainly a useful thing, but removing
includes because they're indirectly already included is IMHO practically
always bad.

johannes


2014-04-09 12:47:08

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/8] cfg80211: fix possible compile warning in wext-compat.h

On Wed, 2014-04-09 at 09:28 +0800, Zhao, Gang wrote:
> Function cfg80211_wext_freq() is declared in wext-compat.h, but its
> parameter struct wiphy's declaration is not included there. Actually
> the parameter is not used in this function, so change it to normal
> net_device.
>
> The compile warning doesn't show up due to duplicate including, but
> it's worth fixing it.

Why not just include the right file here?

johannes


2014-04-10 02:37:48

by Zhao, Gang

[permalink] [raw]
Subject: Re: [PATCH 8/8] cfg80211: remove unnecessary include clauses

On Wed, 2014-04-09 at 14:43:20 +0200, Johannes Berg wrote:
> On Wed, 2014-04-09 at 14:36 +0200, Johannes Berg wrote:
>
>> At the current point in time. If some of the headers that you rely on
>> including something no longer does in the future because it no longer
>> needs that, then you just broke everything.
>
> Take the first of those patches for example. You say
>
> <linux/bug.h> and <linux/net.h> is included by <linux/skbuff.h>.
>
> However, this is a side effect of some implementation detail in
> skbuff.h. If, in the future, some function in skbuff.h is no longer
> inlined, then skbuff.h will no longer have to include bug.h and can
> remove it. That change would break the build due to your patches.
>
> The way you should think about this isn't the mechanic include chain,
> it's the API that each file defines. skbuff.h includes bug.h due to an
> implementation detail, but it doesn't intentionally re-export all the
> bug.h API, that's not the purpose of skbuff.h. The purpose of skbuff.h
> is to capture the SKB related APIs and structures, so that's the only
> thing you should rely on getting from it.
>
> Similarly, you should include bug.h if you need the APIs from that,
> rather than relying on it being included more or less accidentally
> through something else.
>
> Obviously, the lack of namespaces etc. in the compiler makes it
> impossible to actually enforce this, and as a result we often *miss*
> includes that should be there, which sometimes gets found later when
> things change or on different platforms if the recursive include was
> platform specific, but we shouldn't exacerbate this problem by actively
> removing correct includes.
>
> Now, of course, if you find includes that aren't actually *needed* (e.g.
> bug.h in a file that doesn't use BUG() or WARN() variants) then those
> should be removed.

I just want to reduce the possibility that duplicate including could
hide some warnings which I explained in anoother thread. The current way
I use may be too aggressive as you said. I will try to use your
suggestion to remove duplicate including, so the last four patches can
be dropped.

BTW, after I explained why I changed the parameter type in the first
patch, do you still think that is not appropriate ?

>
> johannes

2014-04-09 01:29:04

by Zhao, Gang

[permalink] [raw]
Subject: [PATCH 7/8] mac80211: remove unnecessary include clauses

Signed-off-by: Zhao, Gang <[email protected]>
---
net/mac80211/aes_ccm.c | 5 -----
net/mac80211/aes_cmac.c | 11 -----------
net/mac80211/agg-rx.c | 5 -----
net/mac80211/agg-tx.c | 5 -----
net/mac80211/cfg.c | 10 ----------
net/mac80211/chan.c | 5 +----
net/mac80211/debugfs.c | 4 +---
net/mac80211/debugfs_key.c | 3 ---
net/mac80211/debugfs_netdev.c | 13 +------------
net/mac80211/debugfs_sta.c | 4 ----
net/mac80211/driver-ops.h | 2 --
net/mac80211/event.c | 2 +-
net/mac80211/ht.c | 4 ----
net/mac80211/ibss.c | 11 -----------
net/mac80211/ieee80211_i.h | 14 +-------------
net/mac80211/iface.c | 10 ++--------
net/mac80211/key.c | 10 +---------
net/mac80211/key.h | 2 --
net/mac80211/led.c | 4 ----
net/mac80211/led.h | 3 +--
net/mac80211/main.c | 14 --------------
net/mac80211/mesh.c | 3 ---
net/mac80211/mesh.h | 3 +--
net/mac80211/mesh_hwmp.c | 3 ---
net/mac80211/mesh_pathtbl.c | 8 --------
net/mac80211/mesh_plink.c | 5 +----
net/mac80211/mesh_ps.c | 1 -
net/mac80211/mesh_sync.c | 1 -
net/mac80211/michael.c | 4 +---
net/mac80211/mlme.c | 13 -------------
net/mac80211/offchannel.c | 4 +---
net/mac80211/pm.c | 4 ----
net/mac80211/rate.c | 5 +----
net/mac80211/rate.h | 6 ------
net/mac80211/rc80211_minstrel.c | 9 +--------
net/mac80211/rc80211_minstrel_debugfs.c | 9 ++-------
net/mac80211/rc80211_minstrel_ht.c | 8 +-------
net/mac80211/rc80211_minstrel_ht_debugfs.c | 8 ++------
net/mac80211/rc80211_pid_algo.c | 7 -------
net/mac80211/rc80211_pid_debugfs.c | 9 ---------
net/mac80211/rx.c | 14 --------------
net/mac80211/scan.c | 8 --------
net/mac80211/spectmgmt.c | 5 -----
net/mac80211/sta_info.c | 15 ---------------
net/mac80211/sta_info.h | 5 +----
net/mac80211/status.c | 7 -------
net/mac80211/tkip.c | 10 +---------
net/mac80211/tkip.h | 2 --
net/mac80211/trace.c | 4 ----
net/mac80211/trace.h | 2 +-
net/mac80211/tx.c | 16 ----------------
net/mac80211/util.c | 13 -------------
net/mac80211/vht.c | 5 -----
net/mac80211/wep.c | 15 +--------------
net/mac80211/wep.h | 3 ---
net/mac80211/wme.c | 10 ----------
net/mac80211/wme.h | 1 -
net/mac80211/wpa.c | 9 ---------
net/mac80211/wpa.h | 2 --
59 files changed, 24 insertions(+), 373 deletions(-)

diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c
index ec24378..0baa18ab 100644
--- a/net/mac80211/aes_ccm.c
+++ b/net/mac80211/aes_ccm.c
@@ -9,13 +9,8 @@
* published by the Free Software Foundation.
*/

-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/crypto.h>
-#include <linux/err.h>
#include <crypto/aes.h>

-#include <net/mac80211.h>
#include "key.h"
#include "aes_ccm.h"

diff --git a/net/mac80211/aes_cmac.c b/net/mac80211/aes_cmac.c
index 9b9009f..5cc25c2 100644
--- a/net/mac80211/aes_cmac.c
+++ b/net/mac80211/aes_cmac.c
@@ -7,14 +7,8 @@
* published by the Free Software Foundation.
*/

-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/crypto.h>
-#include <linux/export.h>
-#include <linux/err.h>
#include <crypto/aes.h>

-#include <net/mac80211.h>
#include "key.h"
#include "aes_cmac.h"

@@ -22,7 +16,6 @@
#define CMAC_TLEN 8 /* CMAC TLen = 64 bits (8 octets) */
#define AAD_LEN 20

-
static void gf_mulx(u8 *pad)
{
int i, carry;
@@ -35,7 +28,6 @@ static void gf_mulx(u8 *pad)
pad[AES_BLOCK_SIZE - 1] ^= 0x87;
}

-
static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
const u8 *addr[], const size_t *len, u8 *mac)
{
@@ -91,7 +83,6 @@ static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
memcpy(mac, pad, CMAC_TLEN);
}

-
void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad,
const u8 *data, size_t data_len, u8 *mic)
{
@@ -110,7 +101,6 @@ void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad,
aes_128_cmac_vector(tfm, 3, addr, len, mic);
}

-
struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[])
{
struct crypto_cipher *tfm;
@@ -122,7 +112,6 @@ struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[])
return tfm;
}

-
void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm)
{
crypto_free_cipher(tfm);
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 31bf258..d9cf88b 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -36,11 +36,6 @@
* call must not fail.
*/

-#include <linux/ieee80211.h>
-#include <linux/slab.h>
-#include <linux/export.h>
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
#include "driver-ops.h"

static void ieee80211_free_tid_rx(struct rcu_head *h)
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index ce9633a..da44fb7 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -13,11 +13,6 @@
* published by the Free Software Foundation.
*/

-#include <linux/ieee80211.h>
-#include <linux/slab.h>
-#include <linux/export.h>
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
#include "driver-ops.h"
#include "wme.h"

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index aa39381..debf07f 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -6,16 +6,6 @@
* This file is GPLv2 as found in COPYING.
*/

-#include <linux/ieee80211.h>
-#include <linux/nl80211.h>
-#include <linux/rtnetlink.h>
-#include <linux/slab.h>
-#include <net/net_namespace.h>
-#include <linux/rcupdate.h>
-#include <linux/if_ether.h>
-#include <net/cfg80211.h>
-#include "ieee80211_i.h"
-#include "driver-ops.h"
#include "cfg.h"
#include "rate.h"
#include "mesh.h"
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 122033d..f0be1c4d 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -2,11 +2,8 @@
* mac80211 - channel management
*/

-#include <linux/nl80211.h>
-#include <linux/export.h>
#include <linux/rtnetlink.h>
-#include <net/cfg80211.h>
-#include "ieee80211_i.h"
+
#include "driver-ops.h"

static enum nl80211_chan_width ieee80211_get_sta_bw(struct ieee80211_sta *sta)
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 0e963bc1..83f483d 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -8,10 +8,8 @@
*
*/

-#include <linux/debugfs.h>
#include <linux/rtnetlink.h>
-#include "ieee80211_i.h"
-#include "driver-ops.h"
+
#include "rate.h"
#include "debugfs.h"

diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index 1521cab..129072e 100644
--- a/net/mac80211/debugfs_key.c
+++ b/net/mac80211/debugfs_key.c
@@ -8,10 +8,7 @@
* published by the Free Software Foundation.
*/

-#include <linux/kobject.h>
-#include <linux/slab.h>
#include "ieee80211_i.h"
-#include "key.h"
#include "debugfs.h"
#include "debugfs_key.h"

diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 40a6489..037471b 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -7,22 +7,11 @@
* published by the Free Software Foundation.
*/

-#include <linux/kernel.h>
-#include <linux/device.h>
-#include <linux/if.h>
-#include <linux/if_ether.h>
-#include <linux/interrupt.h>
-#include <linux/netdevice.h>
#include <linux/rtnetlink.h>
-#include <linux/slab.h>
-#include <linux/notifier.h>
-#include <net/mac80211.h>
-#include <net/cfg80211.h>
-#include "ieee80211_i.h"
+
#include "rate.h"
#include "debugfs.h"
#include "debugfs_netdev.h"
-#include "driver-ops.h"

static ssize_t ieee80211_if_read(
struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 2ecb4de..eb4e5f3 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -8,12 +8,8 @@
* published by the Free Software Foundation.
*/

-#include <linux/debugfs.h>
-#include <linux/ieee80211.h>
-#include "ieee80211_i.h"
#include "debugfs.h"
#include "debugfs_sta.h"
-#include "sta_info.h"
#include "driver-ops.h"

/* sta attributtes */
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 5331582..ead6394 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1,8 +1,6 @@
#ifndef __MAC80211_DRIVER_OPS
#define __MAC80211_DRIVER_OPS

-#include <net/mac80211.h>
-#include "ieee80211_i.h"
#include "trace.h"

static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
diff --git a/net/mac80211/event.c b/net/mac80211/event.c
index 01ae759..269bc2f 100644
--- a/net/mac80211/event.c
+++ b/net/mac80211/event.c
@@ -7,7 +7,7 @@
*
* mac80211 - events
*/
-#include <net/cfg80211.h>
+
#include "ieee80211_i.h"

/*
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index c150b68..80186e7 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -13,10 +13,6 @@
* published by the Free Software Foundation.
*/

-#include <linux/ieee80211.h>
-#include <linux/export.h>
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
#include "rate.h"

static void __check_htcap_disable(struct ieee80211_ht_cap *ht_capa,
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index ff4d415..20e1a2f 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -12,17 +12,6 @@
* published by the Free Software Foundation.
*/

-#include <linux/delay.h>
-#include <linux/slab.h>
-#include <linux/if_ether.h>
-#include <linux/skbuff.h>
-#include <linux/if_arp.h>
-#include <linux/etherdevice.h>
-#include <linux/rtnetlink.h>
-#include <net/mac80211.h>
-
-#include "ieee80211_i.h"
-#include "driver-ops.h"
#include "rate.h"

#define IEEE80211_SCAN_INTERVAL (2 * HZ)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 3b73c3e..86dcf23 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -12,23 +12,11 @@
#ifndef IEEE80211_I_H
#define IEEE80211_I_H

-#include <linux/kernel.h>
-#include <linux/device.h>
-#include <linux/if_ether.h>
#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/workqueue.h>
-#include <linux/types.h>
-#include <linux/spinlock.h>
-#include <linux/etherdevice.h>
#include <linux/leds.h>
#include <linux/idr.h>
#include <net/ieee80211_radiotap.h>
-#include <net/cfg80211.h>
-#include <net/mac80211.h>
-#include "key.h"
+
#include "sta_info.h"
#include "debug.h"

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 359e14b..6a4f2b2 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -10,19 +10,13 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <linux/slab.h>
-#include <linux/kernel.h>
+
#include <linux/if_arp.h>
-#include <linux/netdevice.h>
#include <linux/rtnetlink.h>
-#include <net/mac80211.h>
-#include <net/ieee80211_radiotap.h>
-#include "ieee80211_i.h"
-#include "sta_info.h"
+
#include "debugfs_netdev.h"
#include "mesh.h"
#include "led.h"
-#include "driver-ops.h"
#include "wme.h"
#include "rate.h"

diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 6ff65a1..4977f9d 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -9,16 +9,8 @@
* published by the Free Software Foundation.
*/

-#include <linux/if_ether.h>
-#include <linux/etherdevice.h>
-#include <linux/list.h>
-#include <linux/rcupdate.h>
#include <linux/rtnetlink.h>
-#include <linux/slab.h>
-#include <linux/export.h>
-#include <net/mac80211.h>
-#include <asm/unaligned.h>
-#include "ieee80211_i.h"
+
#include "driver-ops.h"
#include "debugfs_key.h"
#include "aes_ccm.h"
diff --git a/net/mac80211/key.h b/net/mac80211/key.h
index 19db686..d9dcb4f 100644
--- a/net/mac80211/key.h
+++ b/net/mac80211/key.h
@@ -10,8 +10,6 @@
#ifndef IEEE80211_KEY_H
#define IEEE80211_KEY_H

-#include <linux/types.h>
-#include <linux/list.h>
#include <linux/crypto.h>
#include <linux/rcupdate.h>
#include <net/mac80211.h>
diff --git a/net/mac80211/led.c b/net/mac80211/led.c
index e2b8364..85ae58e 100644
--- a/net/mac80211/led.c
+++ b/net/mac80211/led.c
@@ -6,10 +6,6 @@
* published by the Free Software Foundation.
*/

-/* just for IFNAMSIZ */
-#include <linux/if.h>
-#include <linux/slab.h>
-#include <linux/export.h>
#include "led.h"

#define MAC80211_BLINK_DELAY 50 /* ms */
diff --git a/net/mac80211/led.h b/net/mac80211/led.h
index 89f4344..67f2c14 100644
--- a/net/mac80211/led.h
+++ b/net/mac80211/led.h
@@ -6,9 +6,8 @@
* published by the Free Software Foundation.
*/

-#include <linux/list.h>
-#include <linux/spinlock.h>
#include <linux/leds.h>
+
#include "ieee80211_i.h"

#ifdef CONFIG_MAC80211_LEDS
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index b055f6a5..1a0b206 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -8,25 +8,11 @@
* published by the Free Software Foundation.
*/

-#include <net/mac80211.h>
#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/skbuff.h>
-#include <linux/etherdevice.h>
-#include <linux/if_arp.h>
#include <linux/rtnetlink.h>
-#include <linux/bitmap.h>
-#include <linux/pm_qos.h>
#include <linux/inetdevice.h>
-#include <net/net_namespace.h>
-#include <net/cfg80211.h>
#include <net/addrconf.h>

-#include "ieee80211_i.h"
-#include "driver-ops.h"
#include "rate.h"
#include "mesh.h"
#include "wep.h"
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 9d29237..9692866 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -8,9 +8,6 @@
* published by the Free Software Foundation.
*/

-#include <linux/slab.h>
-#include <asm/unaligned.h>
-#include "ieee80211_i.h"
#include "mesh.h"
#include "driver-ops.h"

diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index f39a19f..aeb5f06 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -11,10 +11,9 @@
#ifndef IEEE80211S_H
#define IEEE80211S_H

-#include <linux/types.h>
#include <linux/jhash.h>
-#include "ieee80211_i.h"

+#include "ieee80211_i.h"

/* Data structures */

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index f951468..188e8a0 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -7,9 +7,6 @@
* published by the Free Software Foundation.
*/

-#include <linux/slab.h>
-#include <linux/etherdevice.h>
-#include <asm/unaligned.h>
#include "wme.h"
#include "mesh.h"

diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 7d050ed..a4db8c3 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -7,15 +7,7 @@
* published by the Free Software Foundation.
*/

-#include <linux/etherdevice.h>
-#include <linux/list.h>
-#include <linux/random.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>
-#include <linux/string.h>
-#include <net/mac80211.h>
#include "wme.h"
-#include "ieee80211_i.h"
#include "mesh.h"

/* There will be initially 2^INIT_PATHS_SIZE_ORDER buckets */
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index e8f60aa..280c066 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -6,10 +6,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <linux/gfp.h>
-#include <linux/kernel.h>
-#include <linux/random.h>
-#include "ieee80211_i.h"
+
#include "rate.h"
#include "mesh.h"

diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c
index 2802f9d..502814e 100644
--- a/net/mac80211/mesh_ps.c
+++ b/net/mac80211/mesh_ps.c
@@ -10,7 +10,6 @@
#include "mesh.h"
#include "wme.h"

-
/* mesh PS management */

/**
diff --git a/net/mac80211/mesh_sync.c b/net/mac80211/mesh_sync.c
index 2bc5dc2..b320d97 100644
--- a/net/mac80211/mesh_sync.c
+++ b/net/mac80211/mesh_sync.c
@@ -8,7 +8,6 @@
* published by the Free Software Foundation.
*/

-#include "ieee80211_i.h"
#include "mesh.h"
#include "driver-ops.h"

diff --git a/net/mac80211/michael.c b/net/mac80211/michael.c
index 408649bd..9aa3df7 100644
--- a/net/mac80211/michael.c
+++ b/net/mac80211/michael.c
@@ -6,9 +6,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <linux/types.h>
-#include <linux/bitops.h>
-#include <linux/ieee80211.h>
+
#include <asm/unaligned.h>

#include "michael.h"
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index bbc2175..6181685 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -11,22 +11,9 @@
* published by the Free Software Foundation.
*/

-#include <linux/delay.h>
-#include <linux/if_ether.h>
-#include <linux/skbuff.h>
-#include <linux/if_arp.h>
-#include <linux/etherdevice.h>
#include <linux/moduleparam.h>
-#include <linux/rtnetlink.h>
-#include <linux/pm_qos.h>
#include <linux/crc32.h>
-#include <linux/slab.h>
-#include <linux/export.h>
-#include <net/mac80211.h>
-#include <asm/unaligned.h>

-#include "ieee80211_i.h"
-#include "driver-ops.h"
#include "rate.h"
#include "led.h"

diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index 6fb3855..66c16bc 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -12,9 +12,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <linux/export.h>
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
+
#include "driver-ops.h"

/*
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index d478b88..8a1284f 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -1,7 +1,3 @@
-#include <net/mac80211.h>
-#include <net/rtnetlink.h>
-
-#include "ieee80211_i.h"
#include "mesh.h"
#include "driver-ops.h"
#include "led.h"
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 8fdadfd..1dd6d18 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -8,13 +8,10 @@
* published by the Free Software Foundation.
*/

-#include <linux/kernel.h>
#include <linux/rtnetlink.h>
#include <linux/module.h>
-#include <linux/slab.h>
+
#include "rate.h"
-#include "ieee80211_i.h"
-#include "debugfs.h"

struct rate_control_alg {
struct list_head list;
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h
index 9aa2a11..cfdfac5 100644
--- a/net/mac80211/rate.h
+++ b/net/mac80211/rate.h
@@ -11,12 +11,6 @@
#ifndef IEEE80211_RATE_H
#define IEEE80211_RATE_H

-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/types.h>
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
-#include "sta_info.h"
#include "driver-ops.h"

struct rate_control_ref {
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 26fd94f..3117694 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -44,14 +44,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*/
-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/skbuff.h>
-#include <linux/debugfs.h>
-#include <linux/random.h>
-#include <linux/ieee80211.h>
-#include <linux/slab.h>
-#include <net/mac80211.h>
+
#include "rate.h"
#include "rc80211_minstrel.h"

diff --git a/net/mac80211/rc80211_minstrel_debugfs.c b/net/mac80211/rc80211_minstrel_debugfs.c
index fd0b9ca..a0162c3 100644
--- a/net/mac80211/rc80211_minstrel_debugfs.c
+++ b/net/mac80211/rc80211_minstrel_debugfs.c
@@ -44,14 +44,9 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES.
*/
-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/skbuff.h>
-#include <linux/debugfs.h>
-#include <linux/ieee80211.h>
-#include <linux/slab.h>
-#include <linux/export.h>
+
#include <net/mac80211.h>
+
#include "rc80211_minstrel.h"

int
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index bccaf85..08e7823 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -5,13 +5,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/skbuff.h>
-#include <linux/debugfs.h>
-#include <linux/random.h>
-#include <linux/ieee80211.h>
-#include <net/mac80211.h>
+
#include "rate.h"
#include "rc80211_minstrel.h"
#include "rc80211_minstrel_ht.h"
diff --git a/net/mac80211/rc80211_minstrel_ht_debugfs.c b/net/mac80211/rc80211_minstrel_ht_debugfs.c
index 3e7d793..9d757a5 100644
--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
@@ -5,13 +5,9 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/skbuff.h>
-#include <linux/debugfs.h>
-#include <linux/ieee80211.h>
-#include <linux/export.h>
+
#include <net/mac80211.h>
+
#include "rc80211_minstrel.h"
#include "rc80211_minstrel_ht.h"

diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index d0da2a7..2ce284d 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -9,17 +9,10 @@
* published by the Free Software Foundation.
*/

-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/skbuff.h>
-#include <linux/debugfs.h>
-#include <linux/slab.h>
-#include <net/mac80211.h>
#include "rate.h"
#include "mesh.h"
#include "rc80211_pid.h"

-
/* This is an implementation of a TX rate control algorithm that uses a PID
* controller. Given a target failed frames rate, the controller decides about
* TX rate changes to meet the target failed frames rate.
diff --git a/net/mac80211/rc80211_pid_debugfs.c b/net/mac80211/rc80211_pid_debugfs.c
index 6ff1346..ba55647 100644
--- a/net/mac80211/rc80211_pid_debugfs.c
+++ b/net/mac80211/rc80211_pid_debugfs.c
@@ -6,18 +6,9 @@
* published by the Free Software Foundation.
*/

-#include <linux/sched.h>
-#include <linux/spinlock.h>
#include <linux/poll.h>
-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/skbuff.h>
-#include <linux/slab.h>
-#include <linux/export.h>

-#include <net/mac80211.h>
#include "rate.h"
-
#include "rc80211_pid.h"

static void rate_control_pid_event(struct rc_pid_event_buffer *buf,
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index ac83228..e04c98d 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -9,20 +9,6 @@
* published by the Free Software Foundation.
*/

-#include <linux/jiffies.h>
-#include <linux/slab.h>
-#include <linux/kernel.h>
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/rcupdate.h>
-#include <linux/export.h>
-#include <net/mac80211.h>
-#include <net/ieee80211_radiotap.h>
-#include <asm/unaligned.h>
-
-#include "ieee80211_i.h"
-#include "driver-ops.h"
#include "led.h"
#include "mesh.h"
#include "wep.h"
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 28185c8..1d606f8 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -12,16 +12,8 @@
* published by the Free Software Foundation.
*/

-#include <linux/if_arp.h>
-#include <linux/etherdevice.h>
-#include <linux/rtnetlink.h>
-#include <linux/pm_qos.h>
#include <net/sch_generic.h>
-#include <linux/slab.h>
-#include <linux/export.h>
-#include <net/mac80211.h>

-#include "ieee80211_i.h"
#include "driver-ops.h"
#include "mesh.h"

diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c
index 6ab0090..44291a7 100644
--- a/net/mac80211/spectmgmt.c
+++ b/net/mac80211/spectmgmt.c
@@ -14,11 +14,6 @@
* published by the Free Software Foundation.
*/

-#include <linux/ieee80211.h>
-#include <net/cfg80211.h>
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
-#include "sta_info.h"
#include "wme.h"

int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index decd30c..0b31ef3 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -7,22 +7,7 @@
* published by the Free Software Foundation.
*/

-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/etherdevice.h>
-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/skbuff.h>
-#include <linux/if_arp.h>
-#include <linux/timer.h>
-#include <linux/rtnetlink.h>
-
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
-#include "driver-ops.h"
#include "rate.h"
-#include "sta_info.h"
#include "debugfs_sta.h"
#include "mesh.h"
#include "wme.h"
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index d4d85de..29b7a2f 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -9,12 +9,9 @@
#ifndef STA_INFO_H
#define STA_INFO_H

-#include <linux/list.h>
-#include <linux/types.h>
-#include <linux/if_ether.h>
-#include <linux/workqueue.h>
#include <linux/average.h>
#include <linux/etherdevice.h>
+
#include "key.h"

/**
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index e6e574a..afe53bc 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -9,18 +9,11 @@
* published by the Free Software Foundation.
*/

-#include <linux/export.h>
-#include <linux/etherdevice.h>
-#include <linux/time.h>
-#include <net/mac80211.h>
-#include <asm/unaligned.h>
-#include "ieee80211_i.h"
#include "rate.h"
#include "mesh.h"
#include "led.h"
#include "wme.h"

-
void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
struct sk_buff *skb)
{
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
index 0ae2077..256f319 100644
--- a/net/mac80211/tkip.c
+++ b/net/mac80211/tkip.c
@@ -6,16 +6,8 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <linux/kernel.h>
-#include <linux/bitops.h>
-#include <linux/types.h>
-#include <linux/netdevice.h>
-#include <linux/export.h>
-#include <asm/unaligned.h>
-
-#include <net/mac80211.h>
+
#include "driver-ops.h"
-#include "key.h"
#include "tkip.h"
#include "wep.h"

diff --git a/net/mac80211/tkip.h b/net/mac80211/tkip.h
index e3ecb65..e314846 100644
--- a/net/mac80211/tkip.h
+++ b/net/mac80211/tkip.h
@@ -9,8 +9,6 @@
#ifndef TKIP_H
#define TKIP_H

-#include <linux/types.h>
-#include <linux/crypto.h>
#include "key.h"

u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key);
diff --git a/net/mac80211/trace.c b/net/mac80211/trace.c
index 386e45d..73aa416 100644
--- a/net/mac80211/trace.c
+++ b/net/mac80211/trace.c
@@ -1,9 +1,5 @@
-/* bug in tracepoint.h, it should include this */
-#include <linux/module.h>
-
/* sparse isn't too happy with all macros... */
#ifndef __CHECKER__
-#include <net/cfg80211.h>
#include "driver-ops.h"
#include "debug.h"
#define CREATE_TRACE_POINTS
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index a0b0aea..085c680 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -2,7 +2,7 @@
#define __MAC80211_DRIVER_TRACE

#include <linux/tracepoint.h>
-#include <net/mac80211.h>
+
#include "ieee80211_i.h"

#undef TRACE_SYSTEM
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 6200b07..b94444d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -12,22 +12,6 @@
* Transmit and frame generation functions.
*/

-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/skbuff.h>
-#include <linux/etherdevice.h>
-#include <linux/bitmap.h>
-#include <linux/rcupdate.h>
-#include <linux/export.h>
-#include <linux/time.h>
-#include <net/net_namespace.h>
-#include <net/ieee80211_radiotap.h>
-#include <net/cfg80211.h>
-#include <net/mac80211.h>
-#include <asm/unaligned.h>
-
-#include "ieee80211_i.h"
-#include "driver-ops.h"
#include "led.h"
#include "mesh.h"
#include "wep.h"
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 639bc13..00b5e88 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -11,22 +11,9 @@
* utilities for mac80211
*/

-#include <net/mac80211.h>
-#include <linux/netdevice.h>
-#include <linux/export.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/skbuff.h>
-#include <linux/etherdevice.h>
-#include <linux/if_arp.h>
-#include <linux/bitmap.h>
#include <linux/crc32.h>
-#include <net/net_namespace.h>
-#include <net/cfg80211.h>
#include <net/rtnetlink.h>

-#include "ieee80211_i.h"
-#include "driver-ops.h"
#include "rate.h"
#include "mesh.h"
#include "wme.h"
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index e9e36a2..7139caf 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -6,13 +6,8 @@
* published by the Free Software Foundation.
*/

-#include <linux/ieee80211.h>
-#include <linux/export.h>
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
#include "rate.h"

-
static void __check_vhtcap_disable(struct ieee80211_sub_if_data *sdata,
struct ieee80211_sta_vht_cap *vht_cap,
u32 flag)
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 6ee2b58..be6f8ce 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -8,22 +8,9 @@
* published by the Free Software Foundation.
*/

-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/random.h>
-#include <linux/compiler.h>
#include <linux/crc32.h>
-#include <linux/crypto.h>
-#include <linux/err.h>
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-#include <linux/slab.h>
-#include <asm/unaligned.h>
-
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
-#include "wep.h"

+#include "wep.h"

int ieee80211_wep_init(struct ieee80211_local *local)
{
diff --git a/net/mac80211/wep.h b/net/mac80211/wep.h
index 9615749..2a0370d 100644
--- a/net/mac80211/wep.h
+++ b/net/mac80211/wep.h
@@ -11,10 +11,7 @@
#ifndef WEP_H
#define WEP_H

-#include <linux/skbuff.h>
-#include <linux/types.h>
#include "ieee80211_i.h"
-#include "key.h"

int ieee80211_wep_init(struct ieee80211_local *local);
void ieee80211_wep_free(struct ieee80211_local *local);
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 21211c6..89371ee 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -6,16 +6,6 @@
* published by the Free Software Foundation.
*/

-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/module.h>
-#include <linux/if_arp.h>
-#include <linux/types.h>
-#include <net/ip.h>
-#include <net/pkt_sched.h>
-
-#include <net/mac80211.h>
-#include "ieee80211_i.h"
#include "wme.h"

/* Default mapping in classifier to work with default
diff --git a/net/mac80211/wme.h b/net/mac80211/wme.h
index 7fea4bb..4a3b759 100644
--- a/net/mac80211/wme.h
+++ b/net/mac80211/wme.h
@@ -10,7 +10,6 @@
#ifndef _WME_H
#define _WME_H

-#include <linux/netdevice.h>
#include "ieee80211_i.h"

extern const int ieee802_1d_to_ac[8];
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index b8600e3..3910fb9 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -7,17 +7,8 @@
* published by the Free Software Foundation.
*/

-#include <linux/netdevice.h>
-#include <linux/types.h>
-#include <linux/skbuff.h>
-#include <linux/compiler.h>
-#include <linux/ieee80211.h>
-#include <linux/gfp.h>
-#include <asm/unaligned.h>
-#include <net/mac80211.h>
#include <crypto/aes.h>

-#include "ieee80211_i.h"
#include "michael.h"
#include "tkip.h"
#include "aes_ccm.h"
diff --git a/net/mac80211/wpa.h b/net/mac80211/wpa.h
index 62e5a12..30ecd66 100644
--- a/net/mac80211/wpa.h
+++ b/net/mac80211/wpa.h
@@ -9,8 +9,6 @@
#ifndef WPA_H
#define WPA_H

-#include <linux/skbuff.h>
-#include <linux/types.h>
#include "ieee80211_i.h"

ieee80211_tx_result
--
1.9.0


2014-04-09 07:49:49

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 8/8] cfg80211: remove unnecessary include clauses

I don't like those last four patches, I'd rather have more includes than
rely on other headers including headers that we need - that could change
after all.

johannes


2014-04-10 08:02:42

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/8] cfg80211: fix possible compile warning in wext-compat.h

On Wed, 2014-04-09 at 22:18 +0800, Zhao, Gang wrote:

> As I said in commit log, that parameter is not used in that function,
> and all the other functions in wext-compat.h use net_device as their
> parameters, I don't see any reason why this function should be specific.
>
> Although changing the parameter type seems complicated the problem, I
> think it's the more reasonable way.

Fair enough. I'll take that patch.

johannes


2014-04-09 13:49:43

by Zhao, Gang

[permalink] [raw]
Subject: Re: [PATCH 8/8] cfg80211: remove unnecessary include clauses

On Wed, 2014-04-09 at 09:49:30 +0200, Johannes Berg wrote:
> I don't like those last four patches, I'd rather have more includes than
> rely on other headers including headers that we need - that could change
> after all.

And if the change causes compile to fail(or generate warnings), it can
be found immediately and be fixed, but duplicate including could _hide_
problems, that's not good.

That's why we have `make includecheck`. But I make this change by my
bare hand, since `make includecheck` doesn't report any problems to
cfg80211 / mac80211.

>
> johannes

2014-04-09 14:18:35

by Zhao, Gang

[permalink] [raw]
Subject: Re: [PATCH 1/8] cfg80211: fix possible compile warning in wext-compat.h

On Wed, 2014-04-09 at 14:46:50 +0200, Johannes Berg wrote:
> On Wed, 2014-04-09 at 09:28 +0800, Zhao, Gang wrote:
>> Function cfg80211_wext_freq() is declared in wext-compat.h, but its
>> parameter struct wiphy's declaration is not included there. Actually
>> the parameter is not used in this function, so change it to normal
>> net_device.
>>
>> The compile warning doesn't show up due to duplicate including, but
>> it's worth fixing it.
>
> Why not just include the right file here?

As I said in commit log, that parameter is not used in that function,
and all the other functions in wext-compat.h use net_device as their
parameters, I don't see any reason why this function should be specific.

Although changing the parameter type seems complicated the problem, I
think it's the more reasonable way.

>
> johannes

2014-04-10 08:09:50

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 1/8] cfg80211: fix possible compile warning in wext-compat.h

On Wed, 2014-04-09 at 09:28 +0800, Zhao, Gang wrote:
> Function cfg80211_wext_freq() is declared in wext-compat.h, but its
> parameter struct wiphy's declaration is not included there. Actually
> the parameter is not used in this function, so change it to normal
> net_device.

I applied this, but the netdev argument is also unused so I just removed
it entirely.

johannes


2014-04-09 15:22:37

by Zhao, Gang

[permalink] [raw]
Subject: Re: [PATCH 8/8] cfg80211: remove unnecessary include clauses

On Wed, 2014-04-09 at 14:36:59 +0200, Johannes Berg wrote:
> On Wed, 2014-04-09 at 20:25 +0800, Zhao, Gang wrote:
>> On Wed, 2014-04-09 at 09:49:30 +0200, Johannes Berg wrote:
>> > I don't like those last four patches, I'd rather have more includes than
>> > rely on other headers including headers that we need - that could change
>> > after all.
>>
>> As I said in commit log, duplicate including could hide some warnings.
>
> Well, the commit logs for these patches didn't have any such
> information, but that's not really the point. Besides, what does "could
> hide some warnings" even mean? This isn't a meaningful thing, if you
> include the right headers then you should get what you need, and you
> should include the headers for what you need.

I said it in those four "fix" patches, not here. I thought it's
consensus to exclude directly included headers if it's indirectly
included in other headers, but apparently I'm wrong.

What I mean the duplicate including supressed the warnings is:

#include <a.h>
#include <b.h>
#include <c.h>

<c.h> includes <a.h>, so I thought <a.h> is "duplicate". BTW now I'm not
sure my defination of duplicate is equal to `make includecheck` command.

If <b.h> needs to includes <a.h> but forgot to do it, it will not
generate warning, since <a.h> is above, and do the work. If we remove
<a.h>, the warning will show up, and we can fix it. That's what I think
is the benifit of removing duplicate include.

>
>> In theory, the possibility of change is equal, either it's a directly
>> included header or a indirectly included header, and it's more likely to
>> change to include more, not less. So the change may not cause any
>> problem.
>
> At the current point in time. If some of the headers that you rely on
> including something no longer does in the future because it no longer
> needs that, then you just broke everything. That's the point you
> seemingly didn't consider, and I think it's much better to include what
> you need rather than rely on somebody else doing it for you. The latter
> can even be architecture-specific.

I see your point. The benifit of removing duplicate including is above,
the drawback is that we may more depend on other parts of the code than
we should be.

>
>> In other way, the local directory header files may change more
>> frequently than the header files in include/ directory. Whether it's a
>> total win to apply the last four patches may be a question, but it's
>> just amusing to see that lots of lines can be deleted. :-)
>
> # of lines isn't a relevant metric though. If you were removing includes
> that we didn't need that's certainly a useful thing, but removing
> includes because they're indirectly already included is IMHO practically
> always bad.
>
> johannes