Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] cfg80211: use nl80211_* enums
@ 2007-06-11 22:12 David Lamparter
  2007-06-12  9:08 ` Johannes Berg
  2007-06-13  6:55 ` Michael Wu
  0 siblings, 2 replies; 5+ messages in thread
From: David Lamparter @ 2007-06-11 22:12 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John Linville, linux-wireless

Use enum nl80211_phymode and nl80211_iftype where appropriate. Update
mac80211 and nl80211 to match.

Signed-off-by: David Lamparter <equinox@diac24.net>

---
 include/net/cfg80211.h       |    9 +++++----
 net/mac80211/ieee80211_cfg.c |    2 +-
 net/wireless/nl80211.c       |    4 ++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 813706a..1398c21 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3,6 +3,7 @@
 
 #include <linux/netlink.h>
 #include <linux/skbuff.h>
+#include <linux/nl80211.h>
 #include <net/genetlink.h>
 
 /*
@@ -18,7 +19,7 @@
  * @active: scan actively or passively on this channel
  */
 struct scan_channel {
-	int phymode;
+	enum nl80211_phymode phymode;
 	u32 channel;
 	int active;
 };
@@ -36,7 +37,7 @@ struct scan_channel {
 struct scan_params {
 	int n_channels;
 	int active;
-	int phymode;
+	enum nl80211_phymode phymode;
 	struct scan_channel *channels;
 };
 
@@ -116,10 +117,10 @@ struct wiphy;
  */
 struct cfg80211_ops {
 	int	(*add_virtual_intf)(struct wiphy *wiphy, char *name,
-				    unsigned int type);
+				    enum nl80211_iftype type);
 	int	(*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
 	int	(*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
-				       unsigned int type);
+				       enum nl80211_iftype type);
 
 	int	(*associate)(struct wiphy *wiphy, struct net_device *dev,
 			     struct association_params *params);
diff --git a/net/mac80211/ieee80211_cfg.c b/net/mac80211/ieee80211_cfg.c
index 0069826..8f85bc2 100644
--- a/net/mac80211/ieee80211_cfg.c
+++ b/net/mac80211/ieee80211_cfg.c
@@ -13,7 +13,7 @@
 #include "ieee80211_cfg.h"
 
 static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
-			       unsigned int type)
+			       enum nl80211_iftype type)
 {
 	struct ieee80211_local *local = wiphy_priv(wiphy);
 	int itype;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d6a44a3..ffbe628 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -293,7 +293,7 @@ static int nl80211_add_virt_intf(struct sk_buff *skb, struct genl_info *info)
 {
 	struct cfg80211_registered_device *drv;
 	int err;
-	unsigned int type = NL80211_IFTYPE_UNSPECIFIED;
+	enum nl80211_iftype type = NL80211_IFTYPE_UNSPECIFIED;
 
 	if (!info->attrs[NL80211_ATTR_IFNAME])
 		return -EINVAL;
@@ -353,7 +353,7 @@ static int nl80211_change_virt_intf(struct sk_buff *skb, struct genl_info *info)
 {
 	struct cfg80211_registered_device *drv;
 	int err, ifindex;
-	unsigned int type;
+	enum nl80211_iftype type;
 	struct net_device *dev;
 
 	if (info->attrs[NL80211_ATTR_IFTYPE]) {
-- 
1.5.2.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] cfg80211: use nl80211_* enums
  2007-06-11 22:12 [PATCH] cfg80211: use nl80211_* enums David Lamparter
@ 2007-06-12  9:08 ` Johannes Berg
  2007-06-13  6:55 ` Michael Wu
  1 sibling, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2007-06-12  9:08 UTC (permalink / raw)
  To: David Lamparter; +Cc: John Linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 3183 bytes --]

On Tue, 2007-06-12 at 00:12 +0200, David Lamparter wrote:
> Use enum nl80211_phymode and nl80211_iftype where appropriate. Update
> mac80211 and nl80211 to match.
> 
> Signed-off-by: David Lamparter <equinox@diac24.net>

Looks good to me.
Acked-by: Johannes Berg <johannes@sipsolutions.net>

There's one place in your new code where you used -1 to indicate an
invalid setting, you should probably change that then.

> ---
>  include/net/cfg80211.h       |    9 +++++----
>  net/mac80211/ieee80211_cfg.c |    2 +-
>  net/wireless/nl80211.c       |    4 ++--
>  3 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index 813706a..1398c21 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -3,6 +3,7 @@
>  
>  #include <linux/netlink.h>
>  #include <linux/skbuff.h>
> +#include <linux/nl80211.h>
>  #include <net/genetlink.h>
>  
>  /*
> @@ -18,7 +19,7 @@
>   * @active: scan actively or passively on this channel
>   */
>  struct scan_channel {
> -	int phymode;
> +	enum nl80211_phymode phymode;
>  	u32 channel;
>  	int active;
>  };
> @@ -36,7 +37,7 @@ struct scan_channel {
>  struct scan_params {
>  	int n_channels;
>  	int active;
> -	int phymode;
> +	enum nl80211_phymode phymode;
>  	struct scan_channel *channels;
>  };
>  
> @@ -116,10 +117,10 @@ struct wiphy;
>   */
>  struct cfg80211_ops {
>  	int	(*add_virtual_intf)(struct wiphy *wiphy, char *name,
> -				    unsigned int type);
> +				    enum nl80211_iftype type);
>  	int	(*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
>  	int	(*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
> -				       unsigned int type);
> +				       enum nl80211_iftype type);
>  
>  	int	(*associate)(struct wiphy *wiphy, struct net_device *dev,
>  			     struct association_params *params);
> diff --git a/net/mac80211/ieee80211_cfg.c b/net/mac80211/ieee80211_cfg.c
> index 0069826..8f85bc2 100644
> --- a/net/mac80211/ieee80211_cfg.c
> +++ b/net/mac80211/ieee80211_cfg.c
> @@ -13,7 +13,7 @@
>  #include "ieee80211_cfg.h"
>  
>  static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
> -			       unsigned int type)
> +			       enum nl80211_iftype type)
>  {
>  	struct ieee80211_local *local = wiphy_priv(wiphy);
>  	int itype;
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index d6a44a3..ffbe628 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -293,7 +293,7 @@ static int nl80211_add_virt_intf(struct sk_buff *skb, struct genl_info *info)
>  {
>  	struct cfg80211_registered_device *drv;
>  	int err;
> -	unsigned int type = NL80211_IFTYPE_UNSPECIFIED;
> +	enum nl80211_iftype type = NL80211_IFTYPE_UNSPECIFIED;
>  
>  	if (!info->attrs[NL80211_ATTR_IFNAME])
>  		return -EINVAL;
> @@ -353,7 +353,7 @@ static int nl80211_change_virt_intf(struct sk_buff *skb, struct genl_info *info)
>  {
>  	struct cfg80211_registered_device *drv;
>  	int err, ifindex;
> -	unsigned int type;
> +	enum nl80211_iftype type;
>  	struct net_device *dev;
>  
>  	if (info->attrs[NL80211_ATTR_IFTYPE]) {

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cfg80211: use nl80211_* enums
  2007-06-11 22:12 [PATCH] cfg80211: use nl80211_* enums David Lamparter
  2007-06-12  9:08 ` Johannes Berg
@ 2007-06-13  6:55 ` Michael Wu
  2007-06-13 12:33   ` David Lamparter
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Wu @ 2007-06-13  6:55 UTC (permalink / raw)
  To: David Lamparter; +Cc: Johannes Berg, John Linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

On Monday 11 June 2007 15:12, David Lamparter wrote:
> @@ -3,6 +3,7 @@
>
>  #include <linux/netlink.h>
>  #include <linux/skbuff.h>
> +#include <linux/nl80211.h>
>  #include <net/genetlink.h>
>
It seems to me that cfg80211 shouldn't depend on nl80211, so the 
nl80211_iftype enum should be moved to cfg80211.h and become cfg80211_iftype.

-Michael Wu

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cfg80211: use nl80211_* enums
  2007-06-13  6:55 ` Michael Wu
@ 2007-06-13 12:33   ` David Lamparter
  2007-06-13 15:53     ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: David Lamparter @ 2007-06-13 12:33 UTC (permalink / raw)
  To: Michael Wu; +Cc: David Lamparter, Johannes Berg, John Linville, linux-wireless

> > +#include <linux/nl80211.h>
>
> It seems to me that cfg80211 shouldn't depend on nl80211, so the 
> nl80211_iftype enum should be moved to cfg80211.h and become cfg80211_iftype.

That's not possible because nl80211_{iftype,phymode} are userspace API.
If they were defined in cfg80211.h, nl80211.h would need to at least mirror
them. And since nl80211.h can't include cfg80211.h (since the former is a
"public" header supposed to go to /usr/include with some linux-headers-*
package), this way around is the simplest and cleanest solution.

Anyway, I don't really think including a header to be a "dependency". You
can disable the nl80211 implementation and still use the API enum just
fine. (Note that nl80211.h contains enums, more enums and ONLY enums :)

-David


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cfg80211: use nl80211_* enums
  2007-06-13 12:33   ` David Lamparter
@ 2007-06-13 15:53     ` Johannes Berg
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2007-06-13 15:53 UTC (permalink / raw)
  To: David Lamparter; +Cc: Michael Wu, John Linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

On Wed, 2007-06-13 at 14:33 +0200, David Lamparter wrote:

> That's not possible because nl80211_{iftype,phymode} are userspace API.
> If they were defined in cfg80211.h, nl80211.h would need to at least mirror
> them. And since nl80211.h can't include cfg80211.h (since the former is a
> "public" header supposed to go to /usr/include with some linux-headers-*
> package), this way around is the simplest and cleanest solution.
> 
> Anyway, I don't really think including a header to be a "dependency". You
> can disable the nl80211 implementation and still use the API enum just
> fine. (Note that nl80211.h contains enums, more enums and ONLY enums :)

Good explanation, I was just going to write the same :)
Michael, pulling in nl80211.h is the only sensible thing to do unless
you want to duplicate a bunch of things and translate them in nl80211.c

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-06-13 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-11 22:12 [PATCH] cfg80211: use nl80211_* enums David Lamparter
2007-06-12  9:08 ` Johannes Berg
2007-06-13  6:55 ` Michael Wu
2007-06-13 12:33   ` David Lamparter
2007-06-13 15:53     ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox