All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-02 13:27 ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 13:27 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

So far wiphy's device had to be set using separated set_wiphy_dev call.
Most drivers were doing this right after calling wiphy_new anyway so
this just simplifies the code a bit.
The real advantage of this however is having access to struct dev during
early wiphy init. This allows e.g. reading extra DT info thanks to
of_node reference. It's important for things that may happen before
wiphy_register like custom regulatory.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
V2: This is a new patch, wasn't used in V1
---
 drivers/net/wireless/ath/ath6kl/cfg80211.c                  | 7 ++-----
 drivers/net/wireless/ath/ath6kl/cfg80211.h                  | 2 +-
 drivers/net/wireless/ath/ath6kl/core.c                      | 2 +-
 drivers/net/wireless/ath/wil6210/cfg80211.c                 | 3 +--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +--
 drivers/net/wireless/intel/ipw2x00/libipw_module.c          | 2 +-
 drivers/net/wireless/intersil/orinoco/cfg.c                 | 2 --
 drivers/net/wireless/intersil/orinoco/main.c                | 2 +-
 drivers/net/wireless/marvell/libertas/cfg.c                 | 3 ++-
 drivers/net/wireless/marvell/mwifiex/cfg80211.c             | 4 +---
 drivers/net/wireless/rndis_wlan.c                           | 5 ++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c           | 9 ++++-----
 drivers/staging/wlan-ng/cfg80211.c                          | 3 +--
 include/net/cfg80211.h                                      | 9 +++++----
 net/mac80211/main.c                                         | 3 ++-
 net/wireless/core.c                                         | 6 ++++--
 16 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index b7fe0af..0f9f7e7 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -3870,9 +3870,6 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
 
 	wiphy->max_remain_on_channel_duration = 5000;
 
-	/* set device pointer for wiphy */
-	set_wiphy_dev(wiphy, ar->dev);
-
 	wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
 				 BIT(NL80211_IFTYPE_ADHOC) |
 				 BIT(NL80211_IFTYPE_AP);
@@ -4004,13 +4001,13 @@ void ath6kl_cfg80211_cleanup(struct ath6kl *ar)
 	ar->wiphy_registered = false;
 }
 
-struct ath6kl *ath6kl_cfg80211_create(void)
+struct ath6kl *ath6kl_cfg80211_create(struct device *dev)
 {
 	struct ath6kl *ar;
 	struct wiphy *wiphy;
 
 	/* create a new wiphy for use with cfg80211 */
-	wiphy = wiphy_new(&ath6kl_cfg80211_ops, sizeof(struct ath6kl));
+	wiphy = wiphy_new(dev, &ath6kl_cfg80211_ops, sizeof(struct ath6kl));
 
 	if (!wiphy) {
 		ath6kl_err("couldn't allocate wiphy device\n");
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.h b/drivers/net/wireless/ath/ath6kl/cfg80211.h
index 5aa57a7..994ba2c 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.h
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.h
@@ -60,7 +60,7 @@ void ath6kl_cfg80211_stop_all(struct ath6kl *ar);
 int ath6kl_cfg80211_init(struct ath6kl *ar);
 void ath6kl_cfg80211_cleanup(struct ath6kl *ar);
 
-struct ath6kl *ath6kl_cfg80211_create(void);
+struct ath6kl *ath6kl_cfg80211_create(struct device *dev);
 void ath6kl_cfg80211_destroy(struct ath6kl *ar);
 
 #endif /* ATH6KL_CFG80211_H */
diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c
index ebb9f16..d3f3822 100644
--- a/drivers/net/wireless/ath/ath6kl/core.c
+++ b/drivers/net/wireless/ath/ath6kl/core.c
@@ -267,7 +267,7 @@ struct ath6kl *ath6kl_core_create(struct device *dev)
 	struct ath6kl *ar;
 	u8 ctr;
 
-	ar = ath6kl_cfg80211_create();
+	ar = ath6kl_cfg80211_create(dev);
 	if (!ar)
 		return NULL;
 
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 6aa3ff4..ce4d7d4 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -1575,14 +1575,13 @@ struct wireless_dev *wil_cfg80211_init(struct device *dev)
 	if (!wdev)
 		return ERR_PTR(-ENOMEM);
 
-	wdev->wiphy = wiphy_new(&wil_cfg80211_ops,
+	wdev->wiphy = wiphy_new(dev, &wil_cfg80211_ops,
 				sizeof(struct wil6210_priv));
 	if (!wdev->wiphy) {
 		rc = -ENOMEM;
 		goto out;
 	}
 
-	set_wiphy_dev(wdev->wiphy, dev);
 	wil_wiphy_init(wdev->wiphy);
 
 	return wdev;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index ccae3bb..29cb1e9 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6779,13 +6779,12 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
 	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK))
 		ops->set_rekey_data = brcmf_cfg80211_set_rekey_data;
 #endif
-	wiphy = wiphy_new(ops, sizeof(struct brcmf_cfg80211_info));
+	wiphy = wiphy_new(busdev, ops, sizeof(struct brcmf_cfg80211_info));
 	if (!wiphy) {
 		brcmf_err("Could not allocate wiphy device\n");
 		return NULL;
 	}
 	memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
-	set_wiphy_dev(wiphy, busdev);
 
 	cfg = wiphy_priv(wiphy);
 	cfg->wiphy = wiphy;
diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_module.c b/drivers/net/wireless/intel/ipw2x00/libipw_module.c
index 2332075..555ef56 100644
--- a/drivers/net/wireless/intel/ipw2x00/libipw_module.c
+++ b/drivers/net/wireless/intel/ipw2x00/libipw_module.c
@@ -135,7 +135,7 @@ struct net_device *alloc_libipw(int sizeof_priv, int monitor)
 	ieee->dev = dev;
 
 	if (!monitor) {
-		ieee->wdev.wiphy = wiphy_new(&libipw_config_ops, 0);
+		ieee->wdev.wiphy = wiphy_new(NULL, &libipw_config_ops, 0);
 		if (!ieee->wdev.wiphy) {
 			LIBIPW_ERROR("Unable to allocate wiphy.\n");
 			goto failed_free_netdev;
diff --git a/drivers/net/wireless/intersil/orinoco/cfg.c b/drivers/net/wireless/intersil/orinoco/cfg.c
index 7aa4706..5848fd6 100644
--- a/drivers/net/wireless/intersil/orinoco/cfg.c
+++ b/drivers/net/wireless/intersil/orinoco/cfg.c
@@ -26,8 +26,6 @@ void orinoco_wiphy_init(struct wiphy *wiphy)
 	struct orinoco_private *priv = wiphy_priv(wiphy);
 
 	wiphy->privid = orinoco_wiphy_privid;
-
-	set_wiphy_dev(wiphy, priv->dev);
 }
 
 /* Called after firmware is initialised */
diff --git a/drivers/net/wireless/intersil/orinoco/main.c b/drivers/net/wireless/intersil/orinoco/main.c
index 9d96b7c..3465ea6 100644
--- a/drivers/net/wireless/intersil/orinoco/main.c
+++ b/drivers/net/wireless/intersil/orinoco/main.c
@@ -2178,7 +2178,7 @@ struct orinoco_private
 	 * NOTE: We only support a single virtual interface
 	 *       but this may change when monitor mode is added
 	 */
-	wiphy = wiphy_new(&orinoco_cfg_ops,
+	wiphy = wiphy_new(device, &orinoco_cfg_ops,
 			  sizeof(struct orinoco_private) + sizeof_card);
 	if (!wiphy)
 		return NULL;
diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c
index 7ff2efa..f87d279 100644
--- a/drivers/net/wireless/marvell/libertas/cfg.c
+++ b/drivers/net/wireless/marvell/libertas/cfg.c
@@ -2120,7 +2120,8 @@ struct wireless_dev *lbs_cfg_alloc(struct device *dev)
 	if (!wdev)
 		return ERR_PTR(-ENOMEM);
 
-	wdev->wiphy = wiphy_new(&lbs_cfg80211_ops, sizeof(struct lbs_private));
+	wdev->wiphy = wiphy_new(dev, &lbs_cfg80211_ops,
+				sizeof(struct lbs_private));
 	if (!wdev->wiphy) {
 		dev_err(dev, "cannot allocate wiphy\n");
 		ret = -ENOMEM;
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 1e3bd43..d92a649 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -4232,7 +4232,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 	u32 thr, retry;
 
 	/* create a new wiphy for use with cfg80211 */
-	wiphy = wiphy_new(&mwifiex_cfg80211_ops,
+	wiphy = wiphy_new(priv->adapter->dev, &mwifiex_cfg80211_ops,
 			  sizeof(struct mwifiex_adapter *));
 	if (!wiphy) {
 		mwifiex_dbg(adapter, ERROR,
@@ -4328,8 +4328,6 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 	wdev_priv = wiphy_priv(wiphy);
 	*(unsigned long *)wdev_priv = (unsigned long)adapter;
 
-	set_wiphy_dev(wiphy, priv->adapter->dev);
-
 	ret = wiphy_register(wiphy);
 	if (ret < 0) {
 		mwifiex_dbg(adapter, ERROR,
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 603c904..6535f26 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -3408,7 +3408,8 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
 	 * NOTE: We only support a single virtual interface, so wiphy
 	 * and wireless_dev are somewhat synonymous for this device.
 	 */
-	wiphy = wiphy_new(&rndis_config_ops, sizeof(struct rndis_wlan_private));
+	wiphy = wiphy_new(&usbdev->udev->dev, &rndis_config_ops,
+			  sizeof(struct rndis_wlan_private));
 	if (!wiphy)
 		return -ENOMEM;
 
@@ -3486,8 +3487,6 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
 	wiphy->cipher_suites = priv->cipher_suites;
 	wiphy->n_cipher_suites = ARRAY_SIZE(rndis_cipher_suites);
 
-	set_wiphy_dev(wiphy, &usbdev->udev->dev);
-
 	if (wiphy_register(wiphy)) {
 		retval = -ENODEV;
 		goto fail;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 60d8b05..dd87557 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2243,7 +2243,7 @@ static const struct cfg80211_ops wilc_cfg80211_ops = {
 
 };
 
-static struct wireless_dev *WILC_WFI_CfgAlloc(void)
+static struct wireless_dev *WILC_WFI_CfgAlloc(struct device *dev)
 {
 	struct wireless_dev *wdev;
 
@@ -2251,7 +2251,8 @@ static struct wireless_dev *WILC_WFI_CfgAlloc(void)
 	if (!wdev)
 		goto _fail_;
 
-	wdev->wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(struct wilc_priv));
+	wdev->wiphy = wiphy_new(dev, &wilc_cfg80211_ops,
+				sizeof(struct wilc_priv));
 	if (!wdev->wiphy)
 		goto _fail_mem_;
 
@@ -2277,7 +2278,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de
 	struct wireless_dev *wdev;
 	s32 s32Error = 0;
 
-	wdev = WILC_WFI_CfgAlloc();
+	wdev = WILC_WFI_CfgAlloc(dev);
 	if (!wdev) {
 		netdev_err(net, "wiphy new allocate failed\n");
 		return NULL;
@@ -2302,8 +2303,6 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de
 	wdev->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
 	wdev->iftype = NL80211_IFTYPE_STATION;
 
-	set_wiphy_dev(wdev->wiphy, dev);
-
 	s32Error = wiphy_register(wdev->wiphy);
 	if (s32Error)
 		netdev_err(net, "Cannot register wiphy device\n");
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index 182b2d5..444b7fc 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -694,7 +694,7 @@ static struct wiphy *wlan_create_wiphy(struct device *dev, struct wlandevice *wl
 	struct wiphy *wiphy;
 	struct prism2_wiphy_private *priv;
 
-	wiphy = wiphy_new(&prism2_usb_cfg_ops, sizeof(*priv));
+	wiphy = wiphy_new(dev, &prism2_usb_cfg_ops, sizeof(*priv));
 	if (!wiphy)
 		return NULL;
 
@@ -710,7 +710,6 @@ static struct wiphy *wlan_create_wiphy(struct device *dev, struct wlandevice *wl
 	priv->band.ht_cap.ht_supported = false;
 	wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;
 
-	set_wiphy_dev(wiphy, dev);
 	wiphy->privid = prism2_wiphy_privid;
 	wiphy->max_scan_ssids = 1;
 	wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index ca2ac1c..e952cca 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3730,8 +3730,8 @@ static inline const char *wiphy_name(const struct wiphy *wiphy)
  * Return: A pointer to the new wiphy. This pointer must be
  * assigned to each netdev's ieee80211_ptr for proper operation.
  */
-struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
-			   const char *requested_name);
+struct wiphy *wiphy_new_nm(struct device *dev, const struct cfg80211_ops *ops,
+			   int sizeof_priv, const char *requested_name);
 
 /**
  * wiphy_new - create a new wiphy for use with cfg80211
@@ -3745,10 +3745,11 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
  * Return: A pointer to the new wiphy. This pointer must be
  * assigned to each netdev's ieee80211_ptr for proper operation.
  */
-static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
+static inline struct wiphy *wiphy_new(struct device *dev,
+				      const struct cfg80211_ops *ops,
 				      int sizeof_priv)
 {
-	return wiphy_new_nm(ops, sizeof_priv, NULL);
+	return wiphy_new_nm(dev, ops, sizeof_priv, NULL);
 }
 
 /**
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 1822c77..a0f780f 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -524,7 +524,8 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
 	 */
 	priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
 
-	wiphy = wiphy_new_nm(&mac80211_config_ops, priv_size, requested_name);
+	wiphy = wiphy_new_nm(NULL, &mac80211_config_ops, priv_size,
+			     requested_name);
 
 	if (!wiphy)
 		return NULL;
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 158c59e..398922a 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -359,8 +359,8 @@ static void cfg80211_sched_scan_stop_wk(struct work_struct *work)
 
 /* exported functions */
 
-struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
-			   const char *requested_name)
+struct wiphy *wiphy_new_nm(struct device *dev, const struct cfg80211_ops *ops,
+			   int sizeof_priv, const char *requested_name)
 {
 	static atomic_t wiphy_counter = ATOMIC_INIT(0);
 
@@ -404,6 +404,8 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
 	/* atomic_inc_return makes it start at 1, make it start at 0 */
 	rdev->wiphy_idx--;
 
+	set_wiphy_dev(&rdev->wiphy, dev);
+
 	/* give it a proper name */
 	if (requested_name && requested_name[0]) {
 		int rv;
-- 
2.10.1

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

* [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-02 13:27 ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 13:27 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Rafał Miłecki

From: Rafał Miłecki <rafal-g1n6cQUeyibVItvQsEIGlw@public.gmane.org>

So far wiphy's device had to be set using separated set_wiphy_dev call.
Most drivers were doing this right after calling wiphy_new anyway so
this just simplifies the code a bit.
The real advantage of this however is having access to struct dev during
early wiphy init. This allows e.g. reading extra DT info thanks to
of_node reference. It's important for things that may happen before
wiphy_register like custom regulatory.

Signed-off-by: Rafał Miłecki <rafal-g1n6cQUeyibVItvQsEIGlw@public.gmane.org>
---
V2: This is a new patch, wasn't used in V1
---
 drivers/net/wireless/ath/ath6kl/cfg80211.c                  | 7 ++-----
 drivers/net/wireless/ath/ath6kl/cfg80211.h                  | 2 +-
 drivers/net/wireless/ath/ath6kl/core.c                      | 2 +-
 drivers/net/wireless/ath/wil6210/cfg80211.c                 | 3 +--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +--
 drivers/net/wireless/intel/ipw2x00/libipw_module.c          | 2 +-
 drivers/net/wireless/intersil/orinoco/cfg.c                 | 2 --
 drivers/net/wireless/intersil/orinoco/main.c                | 2 +-
 drivers/net/wireless/marvell/libertas/cfg.c                 | 3 ++-
 drivers/net/wireless/marvell/mwifiex/cfg80211.c             | 4 +---
 drivers/net/wireless/rndis_wlan.c                           | 5 ++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c           | 9 ++++-----
 drivers/staging/wlan-ng/cfg80211.c                          | 3 +--
 include/net/cfg80211.h                                      | 9 +++++----
 net/mac80211/main.c                                         | 3 ++-
 net/wireless/core.c                                         | 6 ++++--
 16 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index b7fe0af..0f9f7e7 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -3870,9 +3870,6 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
 
 	wiphy->max_remain_on_channel_duration = 5000;
 
-	/* set device pointer for wiphy */
-	set_wiphy_dev(wiphy, ar->dev);
-
 	wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
 				 BIT(NL80211_IFTYPE_ADHOC) |
 				 BIT(NL80211_IFTYPE_AP);
@@ -4004,13 +4001,13 @@ void ath6kl_cfg80211_cleanup(struct ath6kl *ar)
 	ar->wiphy_registered = false;
 }
 
-struct ath6kl *ath6kl_cfg80211_create(void)
+struct ath6kl *ath6kl_cfg80211_create(struct device *dev)
 {
 	struct ath6kl *ar;
 	struct wiphy *wiphy;
 
 	/* create a new wiphy for use with cfg80211 */
-	wiphy = wiphy_new(&ath6kl_cfg80211_ops, sizeof(struct ath6kl));
+	wiphy = wiphy_new(dev, &ath6kl_cfg80211_ops, sizeof(struct ath6kl));
 
 	if (!wiphy) {
 		ath6kl_err("couldn't allocate wiphy device\n");
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.h b/drivers/net/wireless/ath/ath6kl/cfg80211.h
index 5aa57a7..994ba2c 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.h
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.h
@@ -60,7 +60,7 @@ void ath6kl_cfg80211_stop_all(struct ath6kl *ar);
 int ath6kl_cfg80211_init(struct ath6kl *ar);
 void ath6kl_cfg80211_cleanup(struct ath6kl *ar);
 
-struct ath6kl *ath6kl_cfg80211_create(void);
+struct ath6kl *ath6kl_cfg80211_create(struct device *dev);
 void ath6kl_cfg80211_destroy(struct ath6kl *ar);
 
 #endif /* ATH6KL_CFG80211_H */
diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c
index ebb9f16..d3f3822 100644
--- a/drivers/net/wireless/ath/ath6kl/core.c
+++ b/drivers/net/wireless/ath/ath6kl/core.c
@@ -267,7 +267,7 @@ struct ath6kl *ath6kl_core_create(struct device *dev)
 	struct ath6kl *ar;
 	u8 ctr;
 
-	ar = ath6kl_cfg80211_create();
+	ar = ath6kl_cfg80211_create(dev);
 	if (!ar)
 		return NULL;
 
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c
index 6aa3ff4..ce4d7d4 100644
--- a/drivers/net/wireless/ath/wil6210/cfg80211.c
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -1575,14 +1575,13 @@ struct wireless_dev *wil_cfg80211_init(struct device *dev)
 	if (!wdev)
 		return ERR_PTR(-ENOMEM);
 
-	wdev->wiphy = wiphy_new(&wil_cfg80211_ops,
+	wdev->wiphy = wiphy_new(dev, &wil_cfg80211_ops,
 				sizeof(struct wil6210_priv));
 	if (!wdev->wiphy) {
 		rc = -ENOMEM;
 		goto out;
 	}
 
-	set_wiphy_dev(wdev->wiphy, dev);
 	wil_wiphy_init(wdev->wiphy);
 
 	return wdev;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index ccae3bb..29cb1e9 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6779,13 +6779,12 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
 	if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK))
 		ops->set_rekey_data = brcmf_cfg80211_set_rekey_data;
 #endif
-	wiphy = wiphy_new(ops, sizeof(struct brcmf_cfg80211_info));
+	wiphy = wiphy_new(busdev, ops, sizeof(struct brcmf_cfg80211_info));
 	if (!wiphy) {
 		brcmf_err("Could not allocate wiphy device\n");
 		return NULL;
 	}
 	memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
-	set_wiphy_dev(wiphy, busdev);
 
 	cfg = wiphy_priv(wiphy);
 	cfg->wiphy = wiphy;
diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_module.c b/drivers/net/wireless/intel/ipw2x00/libipw_module.c
index 2332075..555ef56 100644
--- a/drivers/net/wireless/intel/ipw2x00/libipw_module.c
+++ b/drivers/net/wireless/intel/ipw2x00/libipw_module.c
@@ -135,7 +135,7 @@ struct net_device *alloc_libipw(int sizeof_priv, int monitor)
 	ieee->dev = dev;
 
 	if (!monitor) {
-		ieee->wdev.wiphy = wiphy_new(&libipw_config_ops, 0);
+		ieee->wdev.wiphy = wiphy_new(NULL, &libipw_config_ops, 0);
 		if (!ieee->wdev.wiphy) {
 			LIBIPW_ERROR("Unable to allocate wiphy.\n");
 			goto failed_free_netdev;
diff --git a/drivers/net/wireless/intersil/orinoco/cfg.c b/drivers/net/wireless/intersil/orinoco/cfg.c
index 7aa4706..5848fd6 100644
--- a/drivers/net/wireless/intersil/orinoco/cfg.c
+++ b/drivers/net/wireless/intersil/orinoco/cfg.c
@@ -26,8 +26,6 @@ void orinoco_wiphy_init(struct wiphy *wiphy)
 	struct orinoco_private *priv = wiphy_priv(wiphy);
 
 	wiphy->privid = orinoco_wiphy_privid;
-
-	set_wiphy_dev(wiphy, priv->dev);
 }
 
 /* Called after firmware is initialised */
diff --git a/drivers/net/wireless/intersil/orinoco/main.c b/drivers/net/wireless/intersil/orinoco/main.c
index 9d96b7c..3465ea6 100644
--- a/drivers/net/wireless/intersil/orinoco/main.c
+++ b/drivers/net/wireless/intersil/orinoco/main.c
@@ -2178,7 +2178,7 @@ struct orinoco_private
 	 * NOTE: We only support a single virtual interface
 	 *       but this may change when monitor mode is added
 	 */
-	wiphy = wiphy_new(&orinoco_cfg_ops,
+	wiphy = wiphy_new(device, &orinoco_cfg_ops,
 			  sizeof(struct orinoco_private) + sizeof_card);
 	if (!wiphy)
 		return NULL;
diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c
index 7ff2efa..f87d279 100644
--- a/drivers/net/wireless/marvell/libertas/cfg.c
+++ b/drivers/net/wireless/marvell/libertas/cfg.c
@@ -2120,7 +2120,8 @@ struct wireless_dev *lbs_cfg_alloc(struct device *dev)
 	if (!wdev)
 		return ERR_PTR(-ENOMEM);
 
-	wdev->wiphy = wiphy_new(&lbs_cfg80211_ops, sizeof(struct lbs_private));
+	wdev->wiphy = wiphy_new(dev, &lbs_cfg80211_ops,
+				sizeof(struct lbs_private));
 	if (!wdev->wiphy) {
 		dev_err(dev, "cannot allocate wiphy\n");
 		ret = -ENOMEM;
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 1e3bd43..d92a649 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -4232,7 +4232,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 	u32 thr, retry;
 
 	/* create a new wiphy for use with cfg80211 */
-	wiphy = wiphy_new(&mwifiex_cfg80211_ops,
+	wiphy = wiphy_new(priv->adapter->dev, &mwifiex_cfg80211_ops,
 			  sizeof(struct mwifiex_adapter *));
 	if (!wiphy) {
 		mwifiex_dbg(adapter, ERROR,
@@ -4328,8 +4328,6 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 	wdev_priv = wiphy_priv(wiphy);
 	*(unsigned long *)wdev_priv = (unsigned long)adapter;
 
-	set_wiphy_dev(wiphy, priv->adapter->dev);
-
 	ret = wiphy_register(wiphy);
 	if (ret < 0) {
 		mwifiex_dbg(adapter, ERROR,
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 603c904..6535f26 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -3408,7 +3408,8 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
 	 * NOTE: We only support a single virtual interface, so wiphy
 	 * and wireless_dev are somewhat synonymous for this device.
 	 */
-	wiphy = wiphy_new(&rndis_config_ops, sizeof(struct rndis_wlan_private));
+	wiphy = wiphy_new(&usbdev->udev->dev, &rndis_config_ops,
+			  sizeof(struct rndis_wlan_private));
 	if (!wiphy)
 		return -ENOMEM;
 
@@ -3486,8 +3487,6 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
 	wiphy->cipher_suites = priv->cipher_suites;
 	wiphy->n_cipher_suites = ARRAY_SIZE(rndis_cipher_suites);
 
-	set_wiphy_dev(wiphy, &usbdev->udev->dev);
-
 	if (wiphy_register(wiphy)) {
 		retval = -ENODEV;
 		goto fail;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 60d8b05..dd87557 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2243,7 +2243,7 @@ static const struct cfg80211_ops wilc_cfg80211_ops = {
 
 };
 
-static struct wireless_dev *WILC_WFI_CfgAlloc(void)
+static struct wireless_dev *WILC_WFI_CfgAlloc(struct device *dev)
 {
 	struct wireless_dev *wdev;
 
@@ -2251,7 +2251,8 @@ static struct wireless_dev *WILC_WFI_CfgAlloc(void)
 	if (!wdev)
 		goto _fail_;
 
-	wdev->wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(struct wilc_priv));
+	wdev->wiphy = wiphy_new(dev, &wilc_cfg80211_ops,
+				sizeof(struct wilc_priv));
 	if (!wdev->wiphy)
 		goto _fail_mem_;
 
@@ -2277,7 +2278,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de
 	struct wireless_dev *wdev;
 	s32 s32Error = 0;
 
-	wdev = WILC_WFI_CfgAlloc();
+	wdev = WILC_WFI_CfgAlloc(dev);
 	if (!wdev) {
 		netdev_err(net, "wiphy new allocate failed\n");
 		return NULL;
@@ -2302,8 +2303,6 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de
 	wdev->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
 	wdev->iftype = NL80211_IFTYPE_STATION;
 
-	set_wiphy_dev(wdev->wiphy, dev);
-
 	s32Error = wiphy_register(wdev->wiphy);
 	if (s32Error)
 		netdev_err(net, "Cannot register wiphy device\n");
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index 182b2d5..444b7fc 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -694,7 +694,7 @@ static struct wiphy *wlan_create_wiphy(struct device *dev, struct wlandevice *wl
 	struct wiphy *wiphy;
 	struct prism2_wiphy_private *priv;
 
-	wiphy = wiphy_new(&prism2_usb_cfg_ops, sizeof(*priv));
+	wiphy = wiphy_new(dev, &prism2_usb_cfg_ops, sizeof(*priv));
 	if (!wiphy)
 		return NULL;
 
@@ -710,7 +710,6 @@ static struct wiphy *wlan_create_wiphy(struct device *dev, struct wlandevice *wl
 	priv->band.ht_cap.ht_supported = false;
 	wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;
 
-	set_wiphy_dev(wiphy, dev);
 	wiphy->privid = prism2_wiphy_privid;
 	wiphy->max_scan_ssids = 1;
 	wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index ca2ac1c..e952cca 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3730,8 +3730,8 @@ static inline const char *wiphy_name(const struct wiphy *wiphy)
  * Return: A pointer to the new wiphy. This pointer must be
  * assigned to each netdev's ieee80211_ptr for proper operation.
  */
-struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
-			   const char *requested_name);
+struct wiphy *wiphy_new_nm(struct device *dev, const struct cfg80211_ops *ops,
+			   int sizeof_priv, const char *requested_name);
 
 /**
  * wiphy_new - create a new wiphy for use with cfg80211
@@ -3745,10 +3745,11 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
  * Return: A pointer to the new wiphy. This pointer must be
  * assigned to each netdev's ieee80211_ptr for proper operation.
  */
-static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
+static inline struct wiphy *wiphy_new(struct device *dev,
+				      const struct cfg80211_ops *ops,
 				      int sizeof_priv)
 {
-	return wiphy_new_nm(ops, sizeof_priv, NULL);
+	return wiphy_new_nm(dev, ops, sizeof_priv, NULL);
 }
 
 /**
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 1822c77..a0f780f 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -524,7 +524,8 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
 	 */
 	priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
 
-	wiphy = wiphy_new_nm(&mac80211_config_ops, priv_size, requested_name);
+	wiphy = wiphy_new_nm(NULL, &mac80211_config_ops, priv_size,
+			     requested_name);
 
 	if (!wiphy)
 		return NULL;
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 158c59e..398922a 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -359,8 +359,8 @@ static void cfg80211_sched_scan_stop_wk(struct work_struct *work)
 
 /* exported functions */
 
-struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
-			   const char *requested_name)
+struct wiphy *wiphy_new_nm(struct device *dev, const struct cfg80211_ops *ops,
+			   int sizeof_priv, const char *requested_name)
 {
 	static atomic_t wiphy_counter = ATOMIC_INIT(0);
 
@@ -404,6 +404,8 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
 	/* atomic_inc_return makes it start at 1, make it start at 0 */
 	rdev->wiphy_idx--;
 
+	set_wiphy_dev(&rdev->wiphy, dev);
+
 	/* give it a proper name */
 	if (requested_name && requested_name[0]) {
 		int rv;
-- 
2.10.1

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

* [PATCH V2 2/3] dt-bindings: document common IEEE 802.11 frequency limit property
@ 2017-01-02 13:27   ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 13:27 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

This new file should be used for properties that apply to all wireless
devices.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
V2: Switch to a single ieee80211-freq-limit property that allows specifying
    *multiple* ranges. This resolves problem with more complex rules as pointed
    by Felx.
    Make description implementation agnostic as pointed by Arend.
    Rename node to wifi as suggested by Martin.
---
 .../devicetree/bindings/net/wireless/ieee80211.txt     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/ieee80211.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/ieee80211.txt b/Documentation/devicetree/bindings/net/wireless/ieee80211.txt
new file mode 100644
index 0000000..658c721
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ieee80211.txt
@@ -0,0 +1,18 @@
+Common IEEE 802.11 properties
+
+This provides documentation of common properties that are valid for all wireless
+devices.
+
+Optional properties:
+ - ieee80211-freq-limit : list of supported frequency ranges in KHz
+
+Example:
+
+pcie@0,0 {
+	reg = <0x0000 0 0 0 0>;
+	wifi@0,0 {
+		reg = <0x0000 0 0 0 0>;
+		ieee80211-freq-limit = <2402000 2432000>,
+				       <2432000 2462000>;
+	};
+};
-- 
2.10.1

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

* [PATCH V2 2/3] dt-bindings: document common IEEE 802.11 frequency limit property
@ 2017-01-02 13:27   ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 13:27 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Rafał Miłecki

From: Rafał Miłecki <rafal-g1n6cQUeyibVItvQsEIGlw@public.gmane.org>

This new file should be used for properties that apply to all wireless
devices.

Signed-off-by: Rafał Miłecki <rafal-g1n6cQUeyibVItvQsEIGlw@public.gmane.org>
---
V2: Switch to a single ieee80211-freq-limit property that allows specifying
    *multiple* ranges. This resolves problem with more complex rules as pointed
    by Felx.
    Make description implementation agnostic as pointed by Arend.
    Rename node to wifi as suggested by Martin.
---
 .../devicetree/bindings/net/wireless/ieee80211.txt     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/ieee80211.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/ieee80211.txt b/Documentation/devicetree/bindings/net/wireless/ieee80211.txt
new file mode 100644
index 0000000..658c721
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ieee80211.txt
@@ -0,0 +1,18 @@
+Common IEEE 802.11 properties
+
+This provides documentation of common properties that are valid for all wireless
+devices.
+
+Optional properties:
+ - ieee80211-freq-limit : list of supported frequency ranges in KHz
+
+Example:
+
+pcie@0,0 {
+	reg = <0x0000 0 0 0 0>;
+	wifi@0,0 {
+		reg = <0x0000 0 0 0 0>;
+		ieee80211-freq-limit = <2402000 2432000>,
+				       <2432000 2462000>;
+	};
+};
-- 
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH V2 3/3] cfg80211: support ieee80211-freq-limit DT property
@ 2017-01-02 13:27   ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 13:27 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

It allows specifying hardware limitations of supported channels. This
may be useful for specifying single band devices or devices that support
only some part of the whole band.
This can be useful for some tri-band routers that have separated radios
for lower and higher part of 5 GHz band.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
V2: Put main code in core.c as it isn't strictly part of regulatory - pointed
    by Arend.
    Update to support ieee80211-freq-limit (new property).
---
 include/net/cfg80211.h |   6 +++
 net/wireless/core.c    | 110 +++++++++++++++++++++++++++++++++++++++++++++++++
 net/wireless/core.h    |   2 +
 net/wireless/reg.c     |   8 +++-
 net/wireless/reg.h     |   2 +
 5 files changed, 126 insertions(+), 2 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index e952cca..6609c39 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3515,6 +3515,9 @@ struct wiphy_iftype_ext_capab {
  *	attribute indices defined in &enum nl80211_bss_select_attr.
  *
  * @cookie_counter: unique generic cookie counter, used to identify objects.
+ *
+ * @n_freq_limits: number of frequency limits
+ * @freq_limits: array of extra frequency limits
  */
 struct wiphy {
 	/* assign these fields before you register the wiphy */
@@ -3646,6 +3649,9 @@ struct wiphy {
 
 	u64 cookie_counter;
 
+	unsigned int n_freq_limits;
+	struct ieee80211_freq_range *freq_limits;
+
 	char priv[0] __aligned(NETDEV_ALIGN);
 };
 
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 398922a..c2a5c81 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -87,6 +87,113 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx)
 	return &rdev->wiphy;
 }
 
+static int wiphy_freq_limits_init(struct wiphy *wiphy)
+{
+	struct device *dev = wiphy_dev(wiphy);
+	struct device_node *np;
+	struct property *prop;
+	const __be32 *p;
+	int i;
+	int err = 0;
+
+	if (wiphy->n_freq_limits)
+		return 0;
+
+	if (!dev)
+		return 0;
+	np = dev->of_node;
+	if (!np)
+		return 0;
+
+	prop = of_find_property(np, "ieee80211-freq-limit", &i);
+	if (!prop)
+		return 0;
+
+	i = i / sizeof(u32);
+	if (i % 2) {
+		dev_err(dev, "ieee80211-freq-limit wrong value");
+		return -EPROTO;
+	}
+	wiphy->n_freq_limits = i / 2;
+
+	wiphy->freq_limits = kzalloc(wiphy->n_freq_limits * sizeof(*wiphy->freq_limits),
+				     GFP_KERNEL);
+	if (!wiphy->freq_limits) {
+		err = -ENOMEM;
+		goto out;
+	}
+
+	p = NULL;
+	for (i = 0; i < wiphy->n_freq_limits; i++) {
+		struct ieee80211_freq_range *limit = &wiphy->freq_limits[i];
+
+		p = of_prop_next_u32(prop, p, &limit->start_freq_khz);
+		if (!p) {
+			err = -EINVAL;
+			goto out;
+		}
+
+		p = of_prop_next_u32(prop, p, &limit->end_freq_khz);
+		if (!p) {
+			err = -EINVAL;
+			goto out;
+		}
+	}
+
+out:
+	if (err) {
+		dev_err(dev, "Failed to get limits: %d\n", err);
+		kfree(wiphy->freq_limits);
+		wiphy->n_freq_limits = 0;
+	}
+	return err;
+}
+
+static bool wiphy_freq_limits_valid_chan(struct wiphy *wiphy,
+					 struct ieee80211_channel *chan)
+{
+	u32 bw = MHZ_TO_KHZ(20);
+	int i;
+
+	for (i = 0; i < wiphy->n_freq_limits; i++) {
+		struct ieee80211_freq_range *limit = &wiphy->freq_limits[i];
+
+		if (reg_does_bw_fit(limit, MHZ_TO_KHZ(chan->center_freq), bw))
+			return true;
+	}
+
+	return false;
+}
+
+void wiphy_freq_limits_apply(struct wiphy *wiphy)
+{
+	enum nl80211_band band;
+	int i;
+
+	if (!wiphy->n_freq_limits)
+		return;
+
+	for (band = 0; band < NUM_NL80211_BANDS; band++) {
+		struct ieee80211_supported_band *sband = wiphy->bands[band];
+
+		if (!sband)
+			continue;
+
+		for (i = 0; i < sband->n_channels; i++) {
+			struct ieee80211_channel *chan = &sband->channels[i];
+
+			if (chan->flags & IEEE80211_CHAN_DISABLED)
+				continue;
+
+			if (!wiphy_freq_limits_valid_chan(wiphy, chan)) {
+				pr_debug("Disabling freq %d MHz as it's out of OF limits\n",
+					 chan->center_freq);
+				chan->flags |= IEEE80211_CHAN_DISABLED;
+			}
+		}
+	}
+}
+
 static int cfg80211_dev_check_name(struct cfg80211_registered_device *rdev,
 				   const char *newname)
 {
@@ -481,6 +588,8 @@ struct wiphy *wiphy_new_nm(struct device *dev, const struct cfg80211_ops *ops,
 
 	init_waitqueue_head(&rdev->dev_wait);
 
+	wiphy_freq_limits_init(&rdev->wiphy);
+
 	/*
 	 * Initialize wiphy parameters to IEEE 802.11 MIB default values.
 	 * Fragmentation and RTS threshold are disabled by default with the
@@ -942,6 +1051,7 @@ void cfg80211_dev_free(struct cfg80211_registered_device *rdev)
 
 void wiphy_free(struct wiphy *wiphy)
 {
+	kfree(wiphy->freq_limits);
 	put_device(&wiphy->dev);
 }
 EXPORT_SYMBOL(wiphy_free);
diff --git a/net/wireless/core.h b/net/wireless/core.h
index af6e023..ce94f82 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -271,6 +271,8 @@ struct cfg80211_iface_destroy {
 	u32 nlportid;
 };
 
+void wiphy_freq_limits_apply(struct wiphy *wiphy);
+
 void cfg80211_destroy_ifaces(struct cfg80211_registered_device *rdev);
 
 /* free object */
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5dbac37..cb5a264 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -748,8 +748,8 @@ static bool is_valid_rd(const struct ieee80211_regdomain *rd)
 	return true;
 }
 
-static bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
-			    u32 center_freq_khz, u32 bw_khz)
+bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
+		     u32 center_freq_khz, u32 bw_khz)
 {
 	u32 start_freq_khz, end_freq_khz;
 
@@ -1693,6 +1693,8 @@ static void wiphy_update_regulatory(struct wiphy *wiphy,
 	for (band = 0; band < NUM_NL80211_BANDS; band++)
 		handle_band(wiphy, initiator, wiphy->bands[band]);
 
+	wiphy_freq_limits_apply(wiphy);
+
 	reg_process_beacons(wiphy);
 	reg_process_ht_flags(wiphy);
 	reg_call_notifier(wiphy, lr);
@@ -1800,6 +1802,8 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
 		bands_set++;
 	}
 
+	wiphy_freq_limits_apply(wiphy);
+
 	/*
 	 * no point in calling this if it won't have any effect
 	 * on your device's supported bands.
diff --git a/net/wireless/reg.h b/net/wireless/reg.h
index f6ced31..90eddc3 100644
--- a/net/wireless/reg.h
+++ b/net/wireless/reg.h
@@ -25,6 +25,8 @@ extern const struct ieee80211_regdomain __rcu *cfg80211_regdomain;
 
 bool reg_is_valid_request(const char *alpha2);
 bool is_world_regdom(const char *alpha2);
+bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
+		     u32 center_freq_khz, u32 bw_khz);
 bool reg_supported_dfs_region(enum nl80211_dfs_regions dfs_region);
 enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy);
 
-- 
2.10.1

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

* [PATCH V2 3/3] cfg80211: support ieee80211-freq-limit DT property
@ 2017-01-02 13:27   ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 13:27 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Rafał Miłecki

From: Rafał Miłecki <rafal-g1n6cQUeyibVItvQsEIGlw@public.gmane.org>

It allows specifying hardware limitations of supported channels. This
may be useful for specifying single band devices or devices that support
only some part of the whole band.
This can be useful for some tri-band routers that have separated radios
for lower and higher part of 5 GHz band.

Signed-off-by: Rafał Miłecki <rafal-g1n6cQUeyibVItvQsEIGlw@public.gmane.org>
---
V2: Put main code in core.c as it isn't strictly part of regulatory - pointed
    by Arend.
    Update to support ieee80211-freq-limit (new property).
---
 include/net/cfg80211.h |   6 +++
 net/wireless/core.c    | 110 +++++++++++++++++++++++++++++++++++++++++++++++++
 net/wireless/core.h    |   2 +
 net/wireless/reg.c     |   8 +++-
 net/wireless/reg.h     |   2 +
 5 files changed, 126 insertions(+), 2 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index e952cca..6609c39 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3515,6 +3515,9 @@ struct wiphy_iftype_ext_capab {
  *	attribute indices defined in &enum nl80211_bss_select_attr.
  *
  * @cookie_counter: unique generic cookie counter, used to identify objects.
+ *
+ * @n_freq_limits: number of frequency limits
+ * @freq_limits: array of extra frequency limits
  */
 struct wiphy {
 	/* assign these fields before you register the wiphy */
@@ -3646,6 +3649,9 @@ struct wiphy {
 
 	u64 cookie_counter;
 
+	unsigned int n_freq_limits;
+	struct ieee80211_freq_range *freq_limits;
+
 	char priv[0] __aligned(NETDEV_ALIGN);
 };
 
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 398922a..c2a5c81 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -87,6 +87,113 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx)
 	return &rdev->wiphy;
 }
 
+static int wiphy_freq_limits_init(struct wiphy *wiphy)
+{
+	struct device *dev = wiphy_dev(wiphy);
+	struct device_node *np;
+	struct property *prop;
+	const __be32 *p;
+	int i;
+	int err = 0;
+
+	if (wiphy->n_freq_limits)
+		return 0;
+
+	if (!dev)
+		return 0;
+	np = dev->of_node;
+	if (!np)
+		return 0;
+
+	prop = of_find_property(np, "ieee80211-freq-limit", &i);
+	if (!prop)
+		return 0;
+
+	i = i / sizeof(u32);
+	if (i % 2) {
+		dev_err(dev, "ieee80211-freq-limit wrong value");
+		return -EPROTO;
+	}
+	wiphy->n_freq_limits = i / 2;
+
+	wiphy->freq_limits = kzalloc(wiphy->n_freq_limits * sizeof(*wiphy->freq_limits),
+				     GFP_KERNEL);
+	if (!wiphy->freq_limits) {
+		err = -ENOMEM;
+		goto out;
+	}
+
+	p = NULL;
+	for (i = 0; i < wiphy->n_freq_limits; i++) {
+		struct ieee80211_freq_range *limit = &wiphy->freq_limits[i];
+
+		p = of_prop_next_u32(prop, p, &limit->start_freq_khz);
+		if (!p) {
+			err = -EINVAL;
+			goto out;
+		}
+
+		p = of_prop_next_u32(prop, p, &limit->end_freq_khz);
+		if (!p) {
+			err = -EINVAL;
+			goto out;
+		}
+	}
+
+out:
+	if (err) {
+		dev_err(dev, "Failed to get limits: %d\n", err);
+		kfree(wiphy->freq_limits);
+		wiphy->n_freq_limits = 0;
+	}
+	return err;
+}
+
+static bool wiphy_freq_limits_valid_chan(struct wiphy *wiphy,
+					 struct ieee80211_channel *chan)
+{
+	u32 bw = MHZ_TO_KHZ(20);
+	int i;
+
+	for (i = 0; i < wiphy->n_freq_limits; i++) {
+		struct ieee80211_freq_range *limit = &wiphy->freq_limits[i];
+
+		if (reg_does_bw_fit(limit, MHZ_TO_KHZ(chan->center_freq), bw))
+			return true;
+	}
+
+	return false;
+}
+
+void wiphy_freq_limits_apply(struct wiphy *wiphy)
+{
+	enum nl80211_band band;
+	int i;
+
+	if (!wiphy->n_freq_limits)
+		return;
+
+	for (band = 0; band < NUM_NL80211_BANDS; band++) {
+		struct ieee80211_supported_band *sband = wiphy->bands[band];
+
+		if (!sband)
+			continue;
+
+		for (i = 0; i < sband->n_channels; i++) {
+			struct ieee80211_channel *chan = &sband->channels[i];
+
+			if (chan->flags & IEEE80211_CHAN_DISABLED)
+				continue;
+
+			if (!wiphy_freq_limits_valid_chan(wiphy, chan)) {
+				pr_debug("Disabling freq %d MHz as it's out of OF limits\n",
+					 chan->center_freq);
+				chan->flags |= IEEE80211_CHAN_DISABLED;
+			}
+		}
+	}
+}
+
 static int cfg80211_dev_check_name(struct cfg80211_registered_device *rdev,
 				   const char *newname)
 {
@@ -481,6 +588,8 @@ struct wiphy *wiphy_new_nm(struct device *dev, const struct cfg80211_ops *ops,
 
 	init_waitqueue_head(&rdev->dev_wait);
 
+	wiphy_freq_limits_init(&rdev->wiphy);
+
 	/*
 	 * Initialize wiphy parameters to IEEE 802.11 MIB default values.
 	 * Fragmentation and RTS threshold are disabled by default with the
@@ -942,6 +1051,7 @@ void cfg80211_dev_free(struct cfg80211_registered_device *rdev)
 
 void wiphy_free(struct wiphy *wiphy)
 {
+	kfree(wiphy->freq_limits);
 	put_device(&wiphy->dev);
 }
 EXPORT_SYMBOL(wiphy_free);
diff --git a/net/wireless/core.h b/net/wireless/core.h
index af6e023..ce94f82 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -271,6 +271,8 @@ struct cfg80211_iface_destroy {
 	u32 nlportid;
 };
 
+void wiphy_freq_limits_apply(struct wiphy *wiphy);
+
 void cfg80211_destroy_ifaces(struct cfg80211_registered_device *rdev);
 
 /* free object */
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5dbac37..cb5a264 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -748,8 +748,8 @@ static bool is_valid_rd(const struct ieee80211_regdomain *rd)
 	return true;
 }
 
-static bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
-			    u32 center_freq_khz, u32 bw_khz)
+bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
+		     u32 center_freq_khz, u32 bw_khz)
 {
 	u32 start_freq_khz, end_freq_khz;
 
@@ -1693,6 +1693,8 @@ static void wiphy_update_regulatory(struct wiphy *wiphy,
 	for (band = 0; band < NUM_NL80211_BANDS; band++)
 		handle_band(wiphy, initiator, wiphy->bands[band]);
 
+	wiphy_freq_limits_apply(wiphy);
+
 	reg_process_beacons(wiphy);
 	reg_process_ht_flags(wiphy);
 	reg_call_notifier(wiphy, lr);
@@ -1800,6 +1802,8 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
 		bands_set++;
 	}
 
+	wiphy_freq_limits_apply(wiphy);
+
 	/*
 	 * no point in calling this if it won't have any effect
 	 * on your device's supported bands.
diff --git a/net/wireless/reg.h b/net/wireless/reg.h
index f6ced31..90eddc3 100644
--- a/net/wireless/reg.h
+++ b/net/wireless/reg.h
@@ -25,6 +25,8 @@ extern const struct ieee80211_regdomain __rcu *cfg80211_regdomain;
 
 bool reg_is_valid_request(const char *alpha2);
 bool is_world_regdom(const char *alpha2);
+bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
+		     u32 center_freq_khz, u32 bw_khz);
 bool reg_supported_dfs_region(enum nl80211_dfs_regions dfs_region);
 enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy);
 
-- 
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-02 13:38   ` Johannes Berg
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Berg @ 2017-01-02 13:38 UTC (permalink / raw)
  To: Rafał Miłecki, linux-wireless
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree, Rafał Miłecki


> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -3730,8 +3730,8 @@ static inline const char *wiphy_name(const
> struct wiphy *wiphy)
>   * Return: A pointer to the new wiphy. This pointer must be
>   * assigned to each netdev's ieee80211_ptr for proper operation.
>   */
> -struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int
> sizeof_priv,
> -			   const char *requested_name);
> +struct wiphy *wiphy_new_nm(struct device *dev, const struct
> cfg80211_ops *ops,
> +			   int sizeof_priv, const char
> *requested_name);

This is obviously missing documentation updates.

>   */
> -static inline struct wiphy *wiphy_new(const struct cfg80211_ops
> *ops,
> +static inline struct wiphy *wiphy_new(struct device *dev,
> +				      const struct cfg80211_ops
> *ops,

Ditto.

It looks like you practically removed all users of set_wiphy_dev(), why
not do that completely and remove that entirely?

johannes

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

* Re: [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-02 13:38   ` Johannes Berg
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Berg @ 2017-01-02 13:38 UTC (permalink / raw)
  To: Rafał Miłecki, linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Rafał Miłecki


> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -3730,8 +3730,8 @@ static inline const char *wiphy_name(const
> struct wiphy *wiphy)
>   * Return: A pointer to the new wiphy. This pointer must be
>   * assigned to each netdev's ieee80211_ptr for proper operation.
>   */
> -struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int
> sizeof_priv,
> -			   const char *requested_name);
> +struct wiphy *wiphy_new_nm(struct device *dev, const struct
> cfg80211_ops *ops,
> +			   int sizeof_priv, const char
> *requested_name);

This is obviously missing documentation updates.

>   */
> -static inline struct wiphy *wiphy_new(const struct cfg80211_ops
> *ops,
> +static inline struct wiphy *wiphy_new(struct device *dev,
> +				      const struct cfg80211_ops
> *ops,

Ditto.

It looks like you practically removed all users of set_wiphy_dev(), why
not do that completely and remove that entirely?

johannes
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH V2 2/3] dt-bindings: document common IEEE 802.11 frequency limit property
@ 2017-01-02 13:49     ` Johannes Berg
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Berg @ 2017-01-02 13:49 UTC (permalink / raw)
  To: Rafał Miłecki, linux-wireless
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree, Rafał Miłecki


> +pcie@0,0 {
> +	reg = <0x0000 0 0 0 0>;
> +	wifi@0,0 {
> +		reg = <0x0000 0 0 0 0>;
> +		ieee80211-freq-limit = <2402000 2432000>,
> +				       <2432000 2462000>;
> +	};
> +};

Syntactically, that might be a good example, but semantically it
doesn't really make sense to have those ranges that have a common
endpoint?

johannes

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

* Re: [PATCH V2 2/3] dt-bindings: document common IEEE 802.11 frequency limit property
@ 2017-01-02 13:49     ` Johannes Berg
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Berg @ 2017-01-02 13:49 UTC (permalink / raw)
  To: Rafał Miłecki, linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Rafał Miłecki


> +pcie@0,0 {
> +	reg = <0x0000 0 0 0 0>;
> +	wifi@0,0 {
> +		reg = <0x0000 0 0 0 0>;
> +		ieee80211-freq-limit = <2402000 2432000>,
> +				       <2432000 2462000>;
> +	};
> +};

Syntactically, that might be a good example, but semantically it
doesn't really make sense to have those ranges that have a common
endpoint?

johannes

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

* Re: [PATCH V2 3/3] cfg80211: support ieee80211-freq-limit DT property
@ 2017-01-02 14:04     ` Johannes Berg
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Berg @ 2017-01-02 14:04 UTC (permalink / raw)
  To: Rafał Miłecki, linux-wireless
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree, Rafał Miłecki


> +	prop = of_find_property(np, "ieee80211-freq-limit", &i);
> +	if (!prop)
> +		return 0;
> +
> +	i = i / sizeof(u32);

What if it's not even a multiple of sizeof(u32)? Shouldn't you check
that, in case it's completely bogus?

> +	if (i % 2) {
> +		dev_err(dev, "ieee80211-freq-limit wrong value");

say "wrong format" perhaps? we don't care (much) above the values.

> +		return -EPROTO;
> +	}
> +	wiphy->n_freq_limits = i / 2;

I don't like this use of the 'i' variable - use something like
'len[gth]' instead?

> +	wiphy->freq_limits = kzalloc(wiphy->n_freq_limits *
> sizeof(*wiphy->freq_limits),
> +				     GFP_KERNEL);
> +	if (!wiphy->freq_limits) {
> +		err = -ENOMEM;
> +		goto out;
> +	}
> +
> +	p = NULL;
> +	for (i = 0; i < wiphy->n_freq_limits; i++) {
> +		struct ieee80211_freq_range *limit = &wiphy-
> >freq_limits[i];
> +
> +		p = of_prop_next_u32(prop, p, &limit-
> >start_freq_khz);
> +		if (!p) {
> +			err = -EINVAL;
> +			goto out;
> +		}
> +
> +		p = of_prop_next_u32(prop, p, &limit->end_freq_khz);
> +		if (!p) {
> +			err = -EINVAL;
> +			goto out;
> +		}
> +	}

You should also reject nonsense like empty ranges, or ranges with a
higher beginning than end, etc. I think


put

	return 0;

here.

> +out:
> +	if (err) {

then you can make that a pure "error" label and remove the "if (err)"
check.

> +void wiphy_freq_limits_apply(struct wiphy *wiphy)

I don't see any point in having this here rather than in reg.c, which
is the only user.

> +			if (!wiphy_freq_limits_valid_chan(wiphy,
> chan)) {
> +				pr_debug("Disabling freq %d MHz as
> it's out of OF limits\n",
> +					 chan->center_freq);
> +				chan->flags |= IEEE80211_CHAN_DISABLED;

This seems wrong.

The sband and channels can be static data and be shared across
different wiphys for the same driver. If the driver has custom
regulatory etc. then this can't work, but that's up to the driver. OF
data is handled here though, so if OF data for one device disables a
channel, this would also cause the channel to be disabled for another
device, if the data is shared.

To avoid this, you'd have to have drivers that never share it - but you
can't really guarantee that at this level.

In order to fix that, you probably need to memdup the sband/channel
structs during wiphy registration. Then, if you set it up the right
way, you can actually simply edit them according to the OF data
directly there, so that *orig_flags* (rather than just flags) already
gets the DISABLED bit - and that allows you to get rid of the reg.c
hooks entirely since it'll look the same to reg.c independent of the
driver or the OF stuff doing this.


That can actually be inefficient though, since drivers may already have
copied the channel data somewhere and then you copy it again since you
can't know.

Perhaps a better approach would be to not combine this with wiphy
registration, but require drivers that may use this to call a new
helper function *before* wiphy registration (and *after* calling
set_wiphy_dev()), like e.g.

   ieee80211_read_of_data(wiphy);

You can then also make this an inline when OF is not configured in
(something which you haven't really taken into account now, you should
have used dev_of_node() too instead of dev->of_node)

Yes, this would mean that it doesn't automatically get applied to
arbitrary drivers, but it seems unlikely that arbitrary drivers like
realtek USB would suddenly get OF node entries ... so that's not
necessarily a bad thing.

In the documentation for this function you could then document that it
will modify flags, and as such must not be called when the sband and
channel data is shared, getting rid of the waste/complexity of the copy
you otherwise have to make in cfg80211.

johannes

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

* Re: [PATCH V2 3/3] cfg80211: support ieee80211-freq-limit DT property
@ 2017-01-02 14:04     ` Johannes Berg
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Berg @ 2017-01-02 14:04 UTC (permalink / raw)
  To: Rafał Miłecki, linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: Martin Blumenstingl, Felix Fietkau, Arend van Spriel,
	Arnd Bergmann, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Rafał Miłecki


> +	prop = of_find_property(np, "ieee80211-freq-limit", &i);
> +	if (!prop)
> +		return 0;
> +
> +	i = i / sizeof(u32);

What if it's not even a multiple of sizeof(u32)? Shouldn't you check
that, in case it's completely bogus?

> +	if (i % 2) {
> +		dev_err(dev, "ieee80211-freq-limit wrong value");

say "wrong format" perhaps? we don't care (much) above the values.

> +		return -EPROTO;
> +	}
> +	wiphy->n_freq_limits = i / 2;

I don't like this use of the 'i' variable - use something like
'len[gth]' instead?

> +	wiphy->freq_limits = kzalloc(wiphy->n_freq_limits *
> sizeof(*wiphy->freq_limits),
> +				     GFP_KERNEL);
> +	if (!wiphy->freq_limits) {
> +		err = -ENOMEM;
> +		goto out;
> +	}
> +
> +	p = NULL;
> +	for (i = 0; i < wiphy->n_freq_limits; i++) {
> +		struct ieee80211_freq_range *limit = &wiphy-
> >freq_limits[i];
> +
> +		p = of_prop_next_u32(prop, p, &limit-
> >start_freq_khz);
> +		if (!p) {
> +			err = -EINVAL;
> +			goto out;
> +		}
> +
> +		p = of_prop_next_u32(prop, p, &limit->end_freq_khz);
> +		if (!p) {
> +			err = -EINVAL;
> +			goto out;
> +		}
> +	}

You should also reject nonsense like empty ranges, or ranges with a
higher beginning than end, etc. I think


put

	return 0;

here.

> +out:
> +	if (err) {

then you can make that a pure "error" label and remove the "if (err)"
check.

> +void wiphy_freq_limits_apply(struct wiphy *wiphy)

I don't see any point in having this here rather than in reg.c, which
is the only user.

> +			if (!wiphy_freq_limits_valid_chan(wiphy,
> chan)) {
> +				pr_debug("Disabling freq %d MHz as
> it's out of OF limits\n",
> +					 chan->center_freq);
> +				chan->flags |= IEEE80211_CHAN_DISABLED;

This seems wrong.

The sband and channels can be static data and be shared across
different wiphys for the same driver. If the driver has custom
regulatory etc. then this can't work, but that's up to the driver. OF
data is handled here though, so if OF data for one device disables a
channel, this would also cause the channel to be disabled for another
device, if the data is shared.

To avoid this, you'd have to have drivers that never share it - but you
can't really guarantee that at this level.

In order to fix that, you probably need to memdup the sband/channel
structs during wiphy registration. Then, if you set it up the right
way, you can actually simply edit them according to the OF data
directly there, so that *orig_flags* (rather than just flags) already
gets the DISABLED bit - and that allows you to get rid of the reg.c
hooks entirely since it'll look the same to reg.c independent of the
driver or the OF stuff doing this.


That can actually be inefficient though, since drivers may already have
copied the channel data somewhere and then you copy it again since you
can't know.

Perhaps a better approach would be to not combine this with wiphy
registration, but require drivers that may use this to call a new
helper function *before* wiphy registration (and *after* calling
set_wiphy_dev()), like e.g.

   ieee80211_read_of_data(wiphy);

You can then also make this an inline when OF is not configured in
(something which you haven't really taken into account now, you should
have used dev_of_node() too instead of dev->of_node)

Yes, this would mean that it doesn't automatically get applied to
arbitrary drivers, but it seems unlikely that arbitrary drivers like
realtek USB would suddenly get OF node entries ... so that's not
necessarily a bad thing.

In the documentation for this function you could then document that it
will modify flags, and as such must not be called when the sband and
channel data is shared, getting rid of the waste/complexity of the copy
you otherwise have to make in cfg80211.

johannes

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

* Re: [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-02 14:05     ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 14:05 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, Martin Blumenstingl, Felix Fietkau,
	Arend van Spriel, Arnd Bergmann, devicetree,
	Rafał Miłecki

On 2 January 2017 at 14:38, Johannes Berg <johannes@sipsolutions.net> wrote=
:
>
>> --- a/include/net/cfg80211.h
>> +++ b/include/net/cfg80211.h
>> @@ -3730,8 +3730,8 @@ static inline const char *wiphy_name(const
>> struct wiphy *wiphy)
>>   * Return: A pointer to the new wiphy. This pointer must be
>>   * assigned to each netdev's ieee80211_ptr for proper operation.
>>   */
>> -struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int
>> sizeof_priv,
>> -                        const char *requested_name);
>> +struct wiphy *wiphy_new_nm(struct device *dev, const struct
>> cfg80211_ops *ops,
>> +                        int sizeof_priv, const char
>> *requested_name);
>
> This is obviously missing documentation updates.
>
>>   */
>> -static inline struct wiphy *wiphy_new(const struct cfg80211_ops
>> *ops,
>> +static inline struct wiphy *wiphy_new(struct device *dev,
>> +                                   const struct cfg80211_ops
>> *ops,
>
> Ditto.
>
> It looks like you practically removed all users of set_wiphy_dev(), why
> not do that completely and remove that entirely?

There are 2 users left:
1) ipw2x00 - I missed that one
2) mac80211 - it's a big one as it's used in SET_IEEE80211_DEV

I was planning to work on mac80211 drivers later. This will require
similar modification of ieee80211_alloc_hw.

--=20
Rafa=C5=82

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

* Re: [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-02 14:05     ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 14:05 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, Martin Blumenstingl,
	Felix Fietkau, Arend van Spriel, Arnd Bergmann,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rafał Miłecki

On 2 January 2017 at 14:38, Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org> wrote:
>
>> --- a/include/net/cfg80211.h
>> +++ b/include/net/cfg80211.h
>> @@ -3730,8 +3730,8 @@ static inline const char *wiphy_name(const
>> struct wiphy *wiphy)
>>   * Return: A pointer to the new wiphy. This pointer must be
>>   * assigned to each netdev's ieee80211_ptr for proper operation.
>>   */
>> -struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int
>> sizeof_priv,
>> -                        const char *requested_name);
>> +struct wiphy *wiphy_new_nm(struct device *dev, const struct
>> cfg80211_ops *ops,
>> +                        int sizeof_priv, const char
>> *requested_name);
>
> This is obviously missing documentation updates.
>
>>   */
>> -static inline struct wiphy *wiphy_new(const struct cfg80211_ops
>> *ops,
>> +static inline struct wiphy *wiphy_new(struct device *dev,
>> +                                   const struct cfg80211_ops
>> *ops,
>
> Ditto.
>
> It looks like you practically removed all users of set_wiphy_dev(), why
> not do that completely and remove that entirely?

There are 2 users left:
1) ipw2x00 - I missed that one
2) mac80211 - it's a big one as it's used in SET_IEEE80211_DEV

I was planning to work on mac80211 drivers later. This will require
similar modification of ieee80211_alloc_hw.

-- 
Rafał
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH V2 3/3] cfg80211: support ieee80211-freq-limit DT property
@ 2017-01-02 14:09       ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 14:09 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, Martin Blumenstingl, Felix Fietkau,
	Arend van Spriel, Arnd Bergmann, devicetree,
	Rafał Miłecki

On 2 January 2017 at 15:04, Johannes Berg <johannes@sipsolutions.net> wrote=
:
>> +     prop =3D of_find_property(np, "ieee80211-freq-limit", &i);
>> +     if (!prop)
>> +             return 0;
>> +
>> +     i =3D i / sizeof(u32);
>
> What if it's not even a multiple of sizeof(u32)? Shouldn't you check
> that, in case it's completely bogus?
>
>> +     if (i % 2) {
>> +             dev_err(dev, "ieee80211-freq-limit wrong value");
>
> say "wrong format" perhaps? we don't care (much) above the values.
>
>> +             return -EPROTO;
>> +     }
>> +     wiphy->n_freq_limits =3D i / 2;
>
> I don't like this use of the 'i' variable - use something like
> 'len[gth]' instead?
>
>> +     wiphy->freq_limits =3D kzalloc(wiphy->n_freq_limits *
>> sizeof(*wiphy->freq_limits),
>> +                                  GFP_KERNEL);
>> +     if (!wiphy->freq_limits) {
>> +             err =3D -ENOMEM;
>> +             goto out;
>> +     }
>> +
>> +     p =3D NULL;
>> +     for (i =3D 0; i < wiphy->n_freq_limits; i++) {
>> +             struct ieee80211_freq_range *limit =3D &wiphy-
>> >freq_limits[i];
>> +
>> +             p =3D of_prop_next_u32(prop, p, &limit-
>> >start_freq_khz);
>> +             if (!p) {
>> +                     err =3D -EINVAL;
>> +                     goto out;
>> +             }
>> +
>> +             p =3D of_prop_next_u32(prop, p, &limit->end_freq_khz);
>> +             if (!p) {
>> +                     err =3D -EINVAL;
>> +                     goto out;
>> +             }
>> +     }
>
> You should also reject nonsense like empty ranges, or ranges with a
> higher beginning than end, etc. I think
>
>
> put
>
>         return 0;
>
> here.
>
>> +out:
>> +     if (err) {
>
> then you can make that a pure "error" label and remove the "if (err)"
> check.
>
>> +void wiphy_freq_limits_apply(struct wiphy *wiphy)
>
> I don't see any point in having this here rather than in reg.c, which
> is the only user.
>
>> +                     if (!wiphy_freq_limits_valid_chan(wiphy,
>> chan)) {
>> +                             pr_debug("Disabling freq %d MHz as
>> it's out of OF limits\n",
>> +                                      chan->center_freq);
>> +                             chan->flags |=3D IEEE80211_CHAN_DISABLED;
>
> This seems wrong.
>
> The sband and channels can be static data and be shared across
> different wiphys for the same driver. If the driver has custom
> regulatory etc. then this can't work, but that's up to the driver. OF
> data is handled here though, so if OF data for one device disables a
> channel, this would also cause the channel to be disabled for another
> device, if the data is shared.
>
> To avoid this, you'd have to have drivers that never share it - but you
> can't really guarantee that at this level.
>
> In order to fix that, you probably need to memdup the sband/channel
> structs during wiphy registration. Then, if you set it up the right
> way, you can actually simply edit them according to the OF data
> directly there, so that *orig_flags* (rather than just flags) already
> gets the DISABLED bit - and that allows you to get rid of the reg.c
> hooks entirely since it'll look the same to reg.c independent of the
> driver or the OF stuff doing this.
>
>
> That can actually be inefficient though, since drivers may already have
> copied the channel data somewhere and then you copy it again since you
> can't know.
>
> Perhaps a better approach would be to not combine this with wiphy
> registration, but require drivers that may use this to call a new
> helper function *before* wiphy registration (and *after* calling
> set_wiphy_dev()), like e.g.
>
>    ieee80211_read_of_data(wiphy);
>
> You can then also make this an inline when OF is not configured in
> (something which you haven't really taken into account now, you should
> have used dev_of_node() too instead of dev->of_node)
>
> Yes, this would mean that it doesn't automatically get applied to
> arbitrary drivers, but it seems unlikely that arbitrary drivers like
> realtek USB would suddenly get OF node entries ... so that's not
> necessarily a bad thing.
>
> In the documentation for this function you could then document that it
> will modify flags, and as such must not be called when the sband and
> channel data is shared, getting rid of the waste/complexity of the copy
> you otherwise have to make in cfg80211.

Thank you, I appreciate your review a lot, I'll work on this according
to your comments!

--=20
Rafa=C5=82

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

* Re: [PATCH V2 3/3] cfg80211: support ieee80211-freq-limit DT property
@ 2017-01-02 14:09       ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 14:09 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, Martin Blumenstingl,
	Felix Fietkau, Arend van Spriel, Arnd Bergmann,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rafał Miłecki

On 2 January 2017 at 15:04, Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org> wrote:
>> +     prop = of_find_property(np, "ieee80211-freq-limit", &i);
>> +     if (!prop)
>> +             return 0;
>> +
>> +     i = i / sizeof(u32);
>
> What if it's not even a multiple of sizeof(u32)? Shouldn't you check
> that, in case it's completely bogus?
>
>> +     if (i % 2) {
>> +             dev_err(dev, "ieee80211-freq-limit wrong value");
>
> say "wrong format" perhaps? we don't care (much) above the values.
>
>> +             return -EPROTO;
>> +     }
>> +     wiphy->n_freq_limits = i / 2;
>
> I don't like this use of the 'i' variable - use something like
> 'len[gth]' instead?
>
>> +     wiphy->freq_limits = kzalloc(wiphy->n_freq_limits *
>> sizeof(*wiphy->freq_limits),
>> +                                  GFP_KERNEL);
>> +     if (!wiphy->freq_limits) {
>> +             err = -ENOMEM;
>> +             goto out;
>> +     }
>> +
>> +     p = NULL;
>> +     for (i = 0; i < wiphy->n_freq_limits; i++) {
>> +             struct ieee80211_freq_range *limit = &wiphy-
>> >freq_limits[i];
>> +
>> +             p = of_prop_next_u32(prop, p, &limit-
>> >start_freq_khz);
>> +             if (!p) {
>> +                     err = -EINVAL;
>> +                     goto out;
>> +             }
>> +
>> +             p = of_prop_next_u32(prop, p, &limit->end_freq_khz);
>> +             if (!p) {
>> +                     err = -EINVAL;
>> +                     goto out;
>> +             }
>> +     }
>
> You should also reject nonsense like empty ranges, or ranges with a
> higher beginning than end, etc. I think
>
>
> put
>
>         return 0;
>
> here.
>
>> +out:
>> +     if (err) {
>
> then you can make that a pure "error" label and remove the "if (err)"
> check.
>
>> +void wiphy_freq_limits_apply(struct wiphy *wiphy)
>
> I don't see any point in having this here rather than in reg.c, which
> is the only user.
>
>> +                     if (!wiphy_freq_limits_valid_chan(wiphy,
>> chan)) {
>> +                             pr_debug("Disabling freq %d MHz as
>> it's out of OF limits\n",
>> +                                      chan->center_freq);
>> +                             chan->flags |= IEEE80211_CHAN_DISABLED;
>
> This seems wrong.
>
> The sband and channels can be static data and be shared across
> different wiphys for the same driver. If the driver has custom
> regulatory etc. then this can't work, but that's up to the driver. OF
> data is handled here though, so if OF data for one device disables a
> channel, this would also cause the channel to be disabled for another
> device, if the data is shared.
>
> To avoid this, you'd have to have drivers that never share it - but you
> can't really guarantee that at this level.
>
> In order to fix that, you probably need to memdup the sband/channel
> structs during wiphy registration. Then, if you set it up the right
> way, you can actually simply edit them according to the OF data
> directly there, so that *orig_flags* (rather than just flags) already
> gets the DISABLED bit - and that allows you to get rid of the reg.c
> hooks entirely since it'll look the same to reg.c independent of the
> driver or the OF stuff doing this.
>
>
> That can actually be inefficient though, since drivers may already have
> copied the channel data somewhere and then you copy it again since you
> can't know.
>
> Perhaps a better approach would be to not combine this with wiphy
> registration, but require drivers that may use this to call a new
> helper function *before* wiphy registration (and *after* calling
> set_wiphy_dev()), like e.g.
>
>    ieee80211_read_of_data(wiphy);
>
> You can then also make this an inline when OF is not configured in
> (something which you haven't really taken into account now, you should
> have used dev_of_node() too instead of dev->of_node)
>
> Yes, this would mean that it doesn't automatically get applied to
> arbitrary drivers, but it seems unlikely that arbitrary drivers like
> realtek USB would suddenly get OF node entries ... so that's not
> necessarily a bad thing.
>
> In the documentation for this function you could then document that it
> will modify flags, and as such must not be called when the sband and
> channel data is shared, getting rid of the waste/complexity of the copy
> you otherwise have to make in cfg80211.

Thank you, I appreciate your review a lot, I'll work on this according
to your comments!

-- 
Rafał
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-02 14:10       ` Johannes Berg
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Berg @ 2017-01-02 14:10 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: linux-wireless, Martin Blumenstingl, Felix Fietkau,
	Arend van Spriel, Arnd Bergmann, devicetree,
	Rafał Miłecki


> 2) mac80211 - it's a big one as it's used in SET_IEEE80211_DEV
> 
> I was planning to work on mac80211 drivers later. This will require
> similar modification of ieee80211_alloc_hw.

Ah, ok, thanks for the explanation.

johannes

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

* Re: [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-02 14:10       ` Johannes Berg
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Berg @ 2017-01-02 14:10 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, Martin Blumenstingl,
	Felix Fietkau, Arend van Spriel, Arnd Bergmann,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rafał Miłecki


> 2) mac80211 - it's a big one as it's used in SET_IEEE80211_DEV
> 
> I was planning to work on mac80211 drivers later. This will require
> similar modification of ieee80211_alloc_hw.

Ah, ok, thanks for the explanation.

johannes

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

* Re: [PATCH V2 3/3] cfg80211: support ieee80211-freq-limit DT property
@ 2017-01-02 15:05       ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 15:05 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, Martin Blumenstingl, Felix Fietkau,
	Arend van Spriel, Arnd Bergmann, devicetree,
	Rafał Miłecki

On 2 January 2017 at 15:04, Johannes Berg <johannes@sipsolutions.net> wrote=
:
> Perhaps a better approach would be to not combine this with wiphy
> registration, but require drivers that may use this to call a new
> helper function *before* wiphy registration (and *after* calling
> set_wiphy_dev()), like e.g.
>
>    ieee80211_read_of_data(wiphy);
>
> (...)
>
> Yes, this would mean that it doesn't automatically get applied to
> arbitrary drivers, but it seems unlikely that arbitrary drivers like
> realtek USB would suddenly get OF node entries ... so that's not
> necessarily a bad thing.
>
> In the documentation for this function you could then document that it
> will modify flags, and as such must not be called when the sband and
> channel data is shared, getting rid of the waste/complexity of the copy
> you otherwise have to make in cfg80211.

I just think it may be better to stick to something like
ieee80211_read_of_freq_limits
or
wiphy_read_of_freq_limits

As you noted this function will be a bit specific because of modifying
(possibly shared) band channels. At some point we may want to add more
helpers for other OF properties which won't have extra requirements
for driver code. Some drivers may want to use them while not necessary
risking have shared band channels modified.

--=20
Rafa=C5=82

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

* Re: [PATCH V2 3/3] cfg80211: support ieee80211-freq-limit DT property
@ 2017-01-02 15:05       ` Rafał Miłecki
  0 siblings, 0 replies; 26+ messages in thread
From: Rafał Miłecki @ 2017-01-02 15:05 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, Martin Blumenstingl,
	Felix Fietkau, Arend van Spriel, Arnd Bergmann,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rafał Miłecki

On 2 January 2017 at 15:04, Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org> wrote:
> Perhaps a better approach would be to not combine this with wiphy
> registration, but require drivers that may use this to call a new
> helper function *before* wiphy registration (and *after* calling
> set_wiphy_dev()), like e.g.
>
>    ieee80211_read_of_data(wiphy);
>
> (...)
>
> Yes, this would mean that it doesn't automatically get applied to
> arbitrary drivers, but it seems unlikely that arbitrary drivers like
> realtek USB would suddenly get OF node entries ... so that's not
> necessarily a bad thing.
>
> In the documentation for this function you could then document that it
> will modify flags, and as such must not be called when the sband and
> channel data is shared, getting rid of the waste/complexity of the copy
> you otherwise have to make in cfg80211.

I just think it may be better to stick to something like
ieee80211_read_of_freq_limits
or
wiphy_read_of_freq_limits

As you noted this function will be a bit specific because of modifying
(possibly shared) band channels. At some point we may want to add more
helpers for other OF properties which won't have extra requirements
for driver code. Some drivers may want to use them while not necessary
risking have shared band channels modified.

-- 
Rafał
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH V2 3/3] cfg80211: support ieee80211-freq-limit DT property
@ 2017-01-02 15:10         ` Johannes Berg
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Berg @ 2017-01-02 15:10 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: linux-wireless, Martin Blumenstingl, Felix Fietkau,
	Arend van Spriel, Arnd Bergmann, devicetree,
	Rafał Miłecki

On Mon, 2017-01-02 at 16:05 +0100, Rafał Miłecki wrote:
> On 2 January 2017 at 15:04, Johannes Berg <johannes@sipsolutions.net>
> wrote:
> > Perhaps a better approach would be to not combine this with wiphy
> > registration, but require drivers that may use this to call a new
> > helper function *before* wiphy registration (and *after* calling
> > set_wiphy_dev()), like e.g.
> > 
> >    ieee80211_read_of_data(wiphy);
> > 
> > (...)

> I just think it may be better to stick to something like
> ieee80211_read_of_freq_limits
> or
> wiphy_read_of_freq_limits

I have no objection to that.

> As you noted this function will be a bit specific because of
> modifying (possibly shared) band channels. At some point we may want
> to add more helpers for other OF properties which won't have extra
> requirements for driver code. Some drivers may want to use them while
> not necessary risking have shared band channels modified.

That makes sense, although at that time we might still wish to have a
common "read it all" with the combined requirements. But we can cross
that bridge when we get to it.

johannes

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

* Re: [PATCH V2 3/3] cfg80211: support ieee80211-freq-limit DT property
@ 2017-01-02 15:10         ` Johannes Berg
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Berg @ 2017-01-02 15:10 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA, Martin Blumenstingl,
	Felix Fietkau, Arend van Spriel, Arnd Bergmann,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rafał Miłecki

On Mon, 2017-01-02 at 16:05 +0100, Rafał Miłecki wrote:
> On 2 January 2017 at 15:04, Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
> wrote:
> > Perhaps a better approach would be to not combine this with wiphy
> > registration, but require drivers that may use this to call a new
> > helper function *before* wiphy registration (and *after* calling
> > set_wiphy_dev()), like e.g.
> > 
> >    ieee80211_read_of_data(wiphy);
> > 
> > (...)

> I just think it may be better to stick to something like
> ieee80211_read_of_freq_limits
> or
> wiphy_read_of_freq_limits

I have no objection to that.

> As you noted this function will be a bit specific because of
> modifying (possibly shared) band channels. At some point we may want
> to add more helpers for other OF properties which won't have extra
> requirements for driver code. Some drivers may want to use them while
> not necessary risking have shared band channels modified.

That makes sense, although at that time we might still wish to have a
common "read it all" with the combined requirements. But we can cross
that bridge when we get to it.

johannes

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

* Re: [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-02 22:10   ` kbuild test robot
  0 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2017-01-02 22:10 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: kbuild-all, Johannes Berg, linux-wireless, Martin Blumenstingl,
	Felix Fietkau, Arend van Spriel, Arnd Bergmann, devicetree,
	Rafał Miłecki

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

Hi Rafał,

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on v4.10-rc2 next-20161224]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/cfg80211-allow-passing-struct-device-in-the-wiphy_new-call/20170103-014525
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   make[3]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'

vim +/dev +3734 include/net/cfg80211.h

  3718	
  3719	/**
  3720	 * wiphy_new_nm - create a new wiphy for use with cfg80211
  3721	 *
  3722	 * @ops: The configuration operations for this device
  3723	 * @sizeof_priv: The size of the private area to allocate
  3724	 * @requested_name: Request a particular name.
  3725	 *	NULL is valid value, and means use the default phy%d naming.
  3726	 *
  3727	 * Create a new wiphy and associate the given operations with it.
  3728	 * @sizeof_priv bytes are allocated for private use.
  3729	 *
  3730	 * Return: A pointer to the new wiphy. This pointer must be
  3731	 * assigned to each netdev's ieee80211_ptr for proper operation.
  3732	 */
  3733	struct wiphy *wiphy_new_nm(struct device *dev, const struct cfg80211_ops *ops,
> 3734				   int sizeof_priv, const char *requested_name);
  3735	
  3736	/**
  3737	 * wiphy_new - create a new wiphy for use with cfg80211
  3738	 *
  3739	 * @ops: The configuration operations for this device
  3740	 * @sizeof_priv: The size of the private area to allocate
  3741	 *
  3742	 * Create a new wiphy and associate the given operations with it.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 6421 bytes --]

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

* Re: [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-02 22:10   ` kbuild test robot
  0 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2017-01-02 22:10 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: kbuild-all-JC7UmRfGjtg, Johannes Berg,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, Martin Blumenstingl,
	Felix Fietkau, Arend van Spriel, Arnd Bergmann,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rafał Miłecki

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

Hi Rafał,

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on v4.10-rc2 next-20161224]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/cfg80211-allow-passing-struct-device-in-the-wiphy_new-call/20170103-014525
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   make[3]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'
>> include/net/cfg80211.h:3734: warning: No description found for parameter 'dev'
   include/net/cfg80211.h:3751: warning: No description found for parameter 'dev'

vim +/dev +3734 include/net/cfg80211.h

  3718	
  3719	/**
  3720	 * wiphy_new_nm - create a new wiphy for use with cfg80211
  3721	 *
  3722	 * @ops: The configuration operations for this device
  3723	 * @sizeof_priv: The size of the private area to allocate
  3724	 * @requested_name: Request a particular name.
  3725	 *	NULL is valid value, and means use the default phy%d naming.
  3726	 *
  3727	 * Create a new wiphy and associate the given operations with it.
  3728	 * @sizeof_priv bytes are allocated for private use.
  3729	 *
  3730	 * Return: A pointer to the new wiphy. This pointer must be
  3731	 * assigned to each netdev's ieee80211_ptr for proper operation.
  3732	 */
  3733	struct wiphy *wiphy_new_nm(struct device *dev, const struct cfg80211_ops *ops,
> 3734				   int sizeof_priv, const char *requested_name);
  3735	
  3736	/**
  3737	 * wiphy_new - create a new wiphy for use with cfg80211
  3738	 *
  3739	 * @ops: The configuration operations for this device
  3740	 * @sizeof_priv: The size of the private area to allocate
  3741	 *
  3742	 * Create a new wiphy and associate the given operations with it.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 6421 bytes --]

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

* Re: [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-08  7:38   ` kbuild test robot
  0 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2017-01-08  7:38 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: kbuild-all, Johannes Berg, linux-wireless, Martin Blumenstingl,
	Felix Fietkau, Arend van Spriel, Arnd Bergmann, devicetree,
	Rafał Miłecki

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

Hi Rafał,

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on v4.10-rc2 next-20170106]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/cfg80211-allow-passing-struct-device-in-the-wiphy_new-call/20170103-014525
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: x86_64-randconfig-s2-01081447 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/net/wireless/intersil/orinoco/cfg.c: In function 'orinoco_wiphy_init':
>> drivers/net/wireless/intersil/orinoco/cfg.c:26: warning: unused variable 'priv'
   drivers/net/wireless/intersil/orinoco/cfg.o: warning: objtool: orinoco_set_wiphy_params()+0x1e: function has unreachable instruction

vim +/priv +26 drivers/net/wireless/intersil/orinoco/cfg.c

ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  10  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  11  #include "cfg.h"
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  12  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  13  /* Supported bitrates. Must agree with hw.c */
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  14  static struct ieee80211_rate orinoco_rates[] = {
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  15  	{ .bitrate = 10 },
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  16  	{ .bitrate = 20 },
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  17  	{ .bitrate = 55 },
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  18  	{ .bitrate = 110 },
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  19  };
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  20  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  21  static const void * const orinoco_wiphy_privid = &orinoco_wiphy_privid;
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  22  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  23  /* Called after orinoco_private is allocated. */
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  24  void orinoco_wiphy_init(struct wiphy *wiphy)
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  25  {
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18 @26  	struct orinoco_private *priv = wiphy_priv(wiphy);
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  27  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  28  	wiphy->privid = orinoco_wiphy_privid;
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  29  }
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  30  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  31  /* Called after firmware is initialised */
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  32  int orinoco_wiphy_register(struct wiphy *wiphy)
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  33  {
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  34  	struct orinoco_private *priv = wiphy_priv(wiphy);

:::::: The code at line 26 was first introduced by commit
:::::: ea60a6aaf55984a13a7150568cc103d006e86ab2 orinoco: initiate cfg80211 conversion

:::::: TO: David Kilroy <kilroyd@googlemail.com>
:::::: CC: John W. Linville <linville@tuxdriver.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26253 bytes --]

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

* Re: [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call
@ 2017-01-08  7:38   ` kbuild test robot
  0 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2017-01-08  7:38 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: kbuild-all-JC7UmRfGjtg, Johannes Berg,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, Martin Blumenstingl,
	Felix Fietkau, Arend van Spriel, Arnd Bergmann,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rafał Miłecki

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

Hi Rafał,

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on v4.10-rc2 next-20170106]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/cfg80211-allow-passing-struct-device-in-the-wiphy_new-call/20170103-014525
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: x86_64-randconfig-s2-01081447 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/net/wireless/intersil/orinoco/cfg.c: In function 'orinoco_wiphy_init':
>> drivers/net/wireless/intersil/orinoco/cfg.c:26: warning: unused variable 'priv'
   drivers/net/wireless/intersil/orinoco/cfg.o: warning: objtool: orinoco_set_wiphy_params()+0x1e: function has unreachable instruction

vim +/priv +26 drivers/net/wireless/intersil/orinoco/cfg.c

ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  10  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  11  #include "cfg.h"
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  12  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  13  /* Supported bitrates. Must agree with hw.c */
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  14  static struct ieee80211_rate orinoco_rates[] = {
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  15  	{ .bitrate = 10 },
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  16  	{ .bitrate = 20 },
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  17  	{ .bitrate = 55 },
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  18  	{ .bitrate = 110 },
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  19  };
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  20  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  21  static const void * const orinoco_wiphy_privid = &orinoco_wiphy_privid;
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  22  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  23  /* Called after orinoco_private is allocated. */
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  24  void orinoco_wiphy_init(struct wiphy *wiphy)
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  25  {
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18 @26  	struct orinoco_private *priv = wiphy_priv(wiphy);
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  27  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  28  	wiphy->privid = orinoco_wiphy_privid;
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  29  }
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  30  
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  31  /* Called after firmware is initialised */
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  32  int orinoco_wiphy_register(struct wiphy *wiphy)
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  33  {
ea60a6aa drivers/net/wireless/orinoco/cfg.c David Kilroy 2009-06-18  34  	struct orinoco_private *priv = wiphy_priv(wiphy);

:::::: The code at line 26 was first introduced by commit
:::::: ea60a6aaf55984a13a7150568cc103d006e86ab2 orinoco: initiate cfg80211 conversion

:::::: TO: David Kilroy <kilroyd-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
:::::: CC: John W. Linville <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26253 bytes --]

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

end of thread, other threads:[~2017-01-08  7:38 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-02 13:27 [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call Rafał Miłecki
2017-01-02 13:27 ` Rafał Miłecki
2017-01-02 13:27 ` [PATCH V2 2/3] dt-bindings: document common IEEE 802.11 frequency limit property Rafał Miłecki
2017-01-02 13:27   ` Rafał Miłecki
2017-01-02 13:49   ` Johannes Berg
2017-01-02 13:49     ` Johannes Berg
2017-01-02 13:27 ` [PATCH V2 3/3] cfg80211: support ieee80211-freq-limit DT property Rafał Miłecki
2017-01-02 13:27   ` Rafał Miłecki
2017-01-02 14:04   ` Johannes Berg
2017-01-02 14:04     ` Johannes Berg
2017-01-02 14:09     ` Rafał Miłecki
2017-01-02 14:09       ` Rafał Miłecki
2017-01-02 15:05     ` Rafał Miłecki
2017-01-02 15:05       ` Rafał Miłecki
2017-01-02 15:10       ` Johannes Berg
2017-01-02 15:10         ` Johannes Berg
2017-01-02 13:38 ` [PATCH V2 1/3] cfg80211: allow passing struct device in the wiphy_new call Johannes Berg
2017-01-02 13:38   ` Johannes Berg
2017-01-02 14:05   ` Rafał Miłecki
2017-01-02 14:05     ` Rafał Miłecki
2017-01-02 14:10     ` Johannes Berg
2017-01-02 14:10       ` Johannes Berg
2017-01-02 22:10 ` kbuild test robot
2017-01-02 22:10   ` kbuild test robot
2017-01-08  7:38 ` kbuild test robot
2017-01-08  7:38   ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.