2009-05-16 22:00:42

by Dave Kilroy

[permalink] [raw]
Subject: [PATCH 0/2] 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.

Signed-off-by: David Kilroy <[email protected]>
Acked-by: Johannes Berg <[email protected]>
---
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(-)



2009-05-16 22:00:45

by Dave Kilroy

[permalink] [raw]
Subject: [PATCH 1/2] cfg80211: mark ops as pointer to const

This allows drivers to mark their cfg80211_ops tables const.

Signed-off-by: David Kilroy <[email protected]>
Acked-by: Johannes Berg <[email protected]>
---
include/net/cfg80211.h | 2 +-
net/wireless/core.c | 2 +-
net/wireless/core.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9e17a83..7702715 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -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
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 47c20eb..98bfd4d 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -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;

diff --git a/net/wireless/core.h b/net/wireless/core.h
index f14b6c5..725c22e 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -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
--
1.6.0.6


2009-05-16 22:00:49

by Dave Kilroy

[permalink] [raw]
Subject: [PATCH 2/2] cfg80211: mark wiphy->privid as pointer to const

This allows drivers to use a const pointer as the privid without a cast.

Signed-off-by: David Kilroy <[email protected]>
Acked-by: Johannes Berg <[email protected]>
---
include/net/cfg80211.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7702715..0639962 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -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];

--
1.6.0.6