cfg80211: allow drivers to mark certain objects const
cover cfg80211: allow drivers to mark certain objects const
It is likely that the cfg80211_ops and privid data setup by wireless drivers will not need to change. Drivers may therefore want to mark these objects const. This patch ensures that the cfg80211 interface does not preclude this.
I sent these as part of an RFC titled 'orinoco: initiate cgf80211 conversion'. The core of that patch is being reworked, but there's no reason these can't go in independently.
---
David Kilroy (2):
cfg80211: mark ops as pointer to const
cfg80211: mark wiphy->privid as pointer to const
include/net/cfg80211.h | 4 ++-- net/wireless/core.c | 2 +- net/wireless/core.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
PATCH 1/2 cfg80211: mark ops as pointer to const
This allows drivers to mark their cfg80211_ops tables const.
--- include/net/cfg80211.h | 2 +- net/wireless/core.c | 2 +- net/wireless/core.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
include/net/cfg80211.h +1 -1
@@ -1070,7 +1070,7 @@ static inline const char *wiphy_name(struct wiphy *wiphy)* The returned pointer must be assigned to each netdev's * ieee80211_ptr for proper operation. */ -struct wiphy *wiphy_new (struct cfg80211_ops *ops,int sizeof_priv); +struct wiphy *wiphy_new (const struct cfg80211_ops *ops,int sizeof_priv);/** * wiphy_register - register a wiphy with cfg80211
net/wireless/core.c +1 -1
@@ -228,7 +228,7 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,/* exported functions */ -struct wiphy *wiphy_new (struct cfg80211_ops *ops,int sizeof_priv) +struct wiphy *wiphy_new (const struct cfg80211_ops *ops,int sizeof_priv) {static int wiphy_counter;
net/wireless/core.h +1 -1
@@ -15,7 +15,7 @@#include "reg.h" struct cfg80211_registered_device { -struct cfg80211_ops *ops; +const struct cfg80211_ops *ops;struct list_head list;/* we hold this mutex during any call so that * we cannot do multiple calls at once, and also
Signature · 1 line
1.6.0.6
PATCH 2/2 cfg80211: mark wiphy->privid as pointer to const
In reply to David KilroyThis allows drivers to use a const pointer as the privid without a cast.
--- include/net/cfg80211.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/net/cfg80211.h +1 -1
@@ -994,7 +994,7 @@ struct wiphy {* know whether it points to a wiphy your driver has registered * or not. Assign this to something global to your driver to * help determine whether you own this wiphy or not. */ -void *privid; +const void *privid;struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS ];
Signature · 1 line
1.6.0.6