linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] wireless:  Support wiphy_renamed hook for drivers.
@ 2010-10-11 18:42 greearb
  2010-10-11 18:42 ` [PATCH 2/2] ath5k: Support wiphy_renamed operation greearb
  2010-10-11 18:43 ` [PATCH 1/2] wireless: Support wiphy_renamed hook for drivers Johannes Berg
  0 siblings, 2 replies; 7+ messages in thread
From: greearb @ 2010-10-11 18:42 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

Some drivers may want to know when their wiphy is updated
so that they can reuname debugfs links, etc.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 bb5e0d7... 74dc014... M	include/net/cfg80211.h
:100644 100644 33aa2e3... 89e0671... M	include/net/mac80211.h
:100644 100644 512f8d3... bc722d5... M	net/mac80211/cfg.c
:100644 100644 1684ad9... b48c778... M	net/wireless/core.c
 include/net/cfg80211.h |    2 ++
 include/net/mac80211.h |    1 +
 net/mac80211/cfg.c     |   12 ++++++++++++
 net/wireless/core.c    |    4 ++++
 4 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index bb5e0d7..74dc014 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1285,6 +1285,8 @@ struct cfg80211_ops {
 	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
 				       struct net_device *dev,
 				       s32 rssi_thold, u32 rssi_hyst);
+	int	(*wiphy_renamed)(struct wiphy *wiphy,
+				 const char *newname);
 };
 
 /*
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 33aa2e3..89e0671 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1790,6 +1790,7 @@ struct ieee80211_ops {
 	void (*channel_switch)(struct ieee80211_hw *hw,
 			       struct ieee80211_channel_switch *ch_switch);
 	int (*napi_poll)(struct ieee80211_hw *hw, int budget);
+	int (*wiphy_renamed)(struct ieee80211_hw *hw, const char* newname);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 512f8d3..bc722d5 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1477,6 +1477,17 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
 	return 0;
 }
 
+static int ieee80211_wiphy_renamed(struct wiphy *wiphy,
+				   const char *newname)
+{
+	struct ieee80211_local *local = wiphy_priv(wiphy);
+
+	if (!local->ops->wiphy_renamed)
+		return -EOPNOTSUPP;
+
+	return local->ops->wiphy_renamed(&local->hw, newname);
+}
+
 static int ieee80211_set_cqm_rssi_config(struct wiphy *wiphy,
 					 struct net_device *dev,
 					 s32 rssi_thold, u32 rssi_hyst)
@@ -1663,4 +1674,5 @@ struct cfg80211_ops mac80211_config_ops = {
 	.cancel_remain_on_channel = ieee80211_cancel_remain_on_channel,
 	.mgmt_tx = ieee80211_mgmt_tx,
 	.set_cqm_rssi_config = ieee80211_set_cqm_rssi_config,
+	.wiphy_renamed = ieee80211_wiphy_renamed,
 };
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 1684ad9..b48c778 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -203,6 +203,10 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
 		printk(KERN_ERR "cfg80211: failed to rename debugfs dir to %s!\n",
 		       newname);
 
+	/* Let drivers know to rename their debugfs names as well. */
+	if (rdev->ops->wiphy_renamed)
+		rdev->ops->wiphy_renamed(&rdev->wiphy, newname);
+
 	nl80211_notify_dev_rename(rdev);
 
 	return 0;
-- 
1.7.2.2


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

* [PATCH 2/2] ath5k:  Support wiphy_renamed operation.
  2010-10-11 18:42 [PATCH 1/2] wireless: Support wiphy_renamed hook for drivers greearb
@ 2010-10-11 18:42 ` greearb
  2010-10-11 18:43 ` [PATCH 1/2] wireless: Support wiphy_renamed hook for drivers Johannes Berg
  1 sibling, 0 replies; 7+ messages in thread
From: greearb @ 2010-10-11 18:42 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

This allows the debugfs phy directory to remain up to
date if someone renames the phy.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 c9732a6... dc73615... M	drivers/net/wireless/ath/ath5k/base.c
:100644 100644 a342a9d... e361d16... M	drivers/net/wireless/ath/ath5k/debug.c
:100644 100644 4f078b1... 3de6f62... M	drivers/net/wireless/ath/ath5k/debug.h
 drivers/net/wireless/ath/ath5k/base.c  |    7 +++++++
 drivers/net/wireless/ath/ath5k/debug.c |    9 +++++++++
 drivers/net/wireless/ath/ath5k/debug.h |    7 +++++++
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index c9732a6..dc73615 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -3359,6 +3359,12 @@ static void ath5k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class)
 	mutex_unlock(&sc->lock);
 }
 
+static int ath5k_wiphy_renamed(struct ieee80211_hw *hw, const char* newname)
+{
+	struct ath5k_softc *sc = hw->priv;
+	return ath5k_debug_wiphy_renamed(sc, newname);
+}
+
 static int ath5k_conf_tx(struct ieee80211_hw *hw, u16 queue,
 			 const struct ieee80211_tx_queue_params *params)
 {
@@ -3417,6 +3423,7 @@ static const struct ieee80211_ops ath5k_hw_ops = {
 	.sw_scan_start	= ath5k_sw_scan_start,
 	.sw_scan_complete = ath5k_sw_scan_complete,
 	.set_coverage_class = ath5k_set_coverage_class,
+	.wiphy_renamed = ath5k_wiphy_renamed,
 };
 
 /********************\
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index a342a9d..e361d16 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -897,6 +897,15 @@ ath5k_debug_init(void)
 	ath5k_global_debugfs = debugfs_create_dir("ath5k", NULL);
 }
 
+int
+ath5k_debug_wiphy_renamed(struct ath5k_softc *sc, const char *newname)
+{
+	if (!debugfs_rename(ath5k_global_debugfs, sc->debug.debugfs_phydir,
+			    ath5k_global_debugfs, newname))
+		return EINVAL;
+	return 0;
+}
+
 void
 ath5k_debug_init_device(struct ath5k_softc *sc)
 {
diff --git a/drivers/net/wireless/ath/ath5k/debug.h b/drivers/net/wireless/ath/ath5k/debug.h
index 4f078b1..3de6f62 100644
--- a/drivers/net/wireless/ath/ath5k/debug.h
+++ b/drivers/net/wireless/ath/ath5k/debug.h
@@ -162,6 +162,9 @@ ath5k_debug_dump_skb(struct ath5k_softc *sc,
 void
 ath5k_debug_printtxbuf(struct ath5k_softc *sc, struct ath5k_buf *bf);
 
+int
+ath5k_debug_wiphy_renamed(struct ath5k_softc *sc, const char *newname);
+
 #else /* no debugging */
 
 #include <linux/compiler.h>
@@ -198,6 +201,10 @@ ath5k_debug_dump_skb(struct ath5k_softc *sc,
 static inline void
 ath5k_debug_printtxbuf(struct ath5k_softc *sc, struct ath5k_buf *bf) {}
 
+static inline int
+ath5k_debug_wiphy_renamed(struct ath5k_softc *sc,
+			  const char *newname) { return 0; }
+
 #endif /* ifdef CONFIG_ATH5K_DEBUG */
 
 #endif /* ifndef _ATH5K_DEBUG_H */
-- 
1.7.2.2


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

* Re: [PATCH 1/2] wireless:  Support wiphy_renamed hook for drivers.
  2010-10-11 18:42 [PATCH 1/2] wireless: Support wiphy_renamed hook for drivers greearb
  2010-10-11 18:42 ` [PATCH 2/2] ath5k: Support wiphy_renamed operation greearb
@ 2010-10-11 18:43 ` Johannes Berg
  2010-10-11 18:46   ` Johannes Berg
  1 sibling, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2010-10-11 18:43 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless

On Mon, 2010-10-11 at 11:42 -0700, greearb@candelatech.com wrote:

> Some drivers may want to know when their wiphy is updated
> so that they can reuname debugfs links, etc.

I really don't like this -- we provide a debugfs directory that follows
the correct name that drivers can use, so for that particular purpose
this isn't worthwhile. And there seems no other purpose really.

johannes


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

* Re: [PATCH 1/2] wireless:  Support wiphy_renamed hook for drivers.
  2010-10-11 18:43 ` [PATCH 1/2] wireless: Support wiphy_renamed hook for drivers Johannes Berg
@ 2010-10-11 18:46   ` Johannes Berg
  2010-10-11 18:48     ` Ben Greear
  2010-10-11 19:07     ` Ben Greear
  0 siblings, 2 replies; 7+ messages in thread
From: Johannes Berg @ 2010-10-11 18:46 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless

I think you should just do this (untested):

--- wireless-testing.orig/drivers/net/wireless/ath/ath5k/debug.c	2010-10-11 20:44:26.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath/ath5k/debug.c	2010-10-11 20:45:26.000000000 +0200
@@ -71,8 +71,6 @@ module_param_named(debug, ath5k_debug, u
 #include "reg.h"
 #include "ani.h"
 
-static struct dentry *ath5k_global_debugfs;
-
 static int ath5k_debugfs_open(struct inode *inode, struct file *file)
 {
 	file->private_data = inode->i_private;
@@ -884,7 +882,6 @@ static const struct file_operations fops
 void
 ath5k_debug_init(void)
 {
-	ath5k_global_debugfs = debugfs_create_dir("ath5k", NULL);
 }
 
 void
@@ -892,8 +889,8 @@ ath5k_debug_init_device(struct ath5k_sof
 {
 	sc->debug.level = ath5k_debug;
 
-	sc->debug.debugfs_phydir = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
-				ath5k_global_debugfs);
+	sc->debug.debugfs_phydir = debugfs_create_dir("ath5k",
+				sc->hw->wiphy->debugfsdir);
 
 	sc->debug.debugfs_debug = debugfs_create_file("debug",
 				S_IWUSR | S_IRUSR,
@@ -936,7 +933,6 @@ ath5k_debug_init_device(struct ath5k_sof
 void
 ath5k_debug_finish(void)
 {
-	debugfs_remove(ath5k_global_debugfs);
 }
 
 void



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

* Re: [PATCH 1/2] wireless:  Support wiphy_renamed hook for drivers.
  2010-10-11 18:46   ` Johannes Berg
@ 2010-10-11 18:48     ` Ben Greear
  2010-10-11 19:07     ` Ben Greear
  1 sibling, 0 replies; 7+ messages in thread
From: Ben Greear @ 2010-10-11 18:48 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On 10/11/2010 11:46 AM, Johannes Berg wrote:
> I think you should just do this (untested):

That seems fine to me..I guess any existing users of ath5k debugfs
should just not admit they are using it in the first place and silently fix
their scripts? :)

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


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

* Re: [PATCH 1/2] wireless:  Support wiphy_renamed hook for drivers.
  2010-10-11 18:46   ` Johannes Berg
  2010-10-11 18:48     ` Ben Greear
@ 2010-10-11 19:07     ` Ben Greear
  2010-10-11 19:28       ` Johannes Berg
  1 sibling, 1 reply; 7+ messages in thread
From: Ben Greear @ 2010-10-11 19:07 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On 10/11/2010 11:46 AM, Johannes Berg wrote:
> I think you should just do this (untested):

>   void
> @@ -892,8 +889,8 @@ ath5k_debug_init_device(struct ath5k_sof
>   {
>   	sc->debug.level = ath5k_debug;
>
> -	sc->debug.debugfs_phydir = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
> -				ath5k_global_debugfs);
> +	sc->debug.debugfs_phydir = debugfs_create_dir("ath5k",
> +				sc->hw->wiphy->debugfsdir);

This fails to work because sc->hw->wiphy->debugfsdir is null when this
method is called...

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


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

* Re: [PATCH 1/2] wireless:  Support wiphy_renamed hook for drivers.
  2010-10-11 19:07     ` Ben Greear
@ 2010-10-11 19:28       ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2010-10-11 19:28 UTC (permalink / raw)
  To: Ben Greear; +Cc: linux-wireless

On Mon, 2010-10-11 at 12:07 -0700, Ben Greear wrote:
> On 10/11/2010 11:46 AM, Johannes Berg wrote:
> > I think you should just do this (untested):
> 
> >   void
> > @@ -892,8 +889,8 @@ ath5k_debug_init_device(struct ath5k_sof
> >   {
> >   	sc->debug.level = ath5k_debug;
> >
> > -	sc->debug.debugfs_phydir = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
> > -				ath5k_global_debugfs);
> > +	sc->debug.debugfs_phydir = debugfs_create_dir("ath5k",
> > +				sc->hw->wiphy->debugfsdir);
> 
> This fails to work because sc->hw->wiphy->debugfsdir is null when this
> method is called...

Then it needs to be after registering with mac80211 -- shouldn't really
change much though.

johannes


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

end of thread, other threads:[~2010-10-11 19:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-11 18:42 [PATCH 1/2] wireless: Support wiphy_renamed hook for drivers greearb
2010-10-11 18:42 ` [PATCH 2/2] ath5k: Support wiphy_renamed operation greearb
2010-10-11 18:43 ` [PATCH 1/2] wireless: Support wiphy_renamed hook for drivers Johannes Berg
2010-10-11 18:46   ` Johannes Berg
2010-10-11 18:48     ` Ben Greear
2010-10-11 19:07     ` Ben Greear
2010-10-11 19:28       ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).