All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] cfg80211: Do not call CRDA when using internal regulatory database
@ 2014-01-18  1:39 Chaitanya T K
  2014-01-20 10:50 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Chaitanya T K @ 2014-01-18  1:39 UTC (permalink / raw)
  To: linux-wireless, johannes, mcgrof; +Cc: Chaitanya T K

When using internal regulatory data base kconfig option,
do not try to call crda. This completely defeats the 
purpose of enabling internal regulatory db.

Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
---
V2: 
   Use Proper Error codes while returning
   Fix the call_crda if condition.
---
 net/wireless/reg.c |   29 +++++++++++++++--------------
 net/wireless/reg.c |   31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 7d20d84..1f9e67d 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -454,16 +454,16 @@ static void reg_regdb_search(struct work_struct *work)
 
 static DECLARE_WORK(reg_regdb_work, reg_regdb_search);
 
-static void reg_regdb_query(const char *alpha2)
+static int reg_regdb_query(const char *alpha2)
 {
 	struct reg_regdb_search_request *request;
 
 	if (!alpha2)
-		return;
+		return -EINVAL;
 
 	request = kzalloc(sizeof(struct reg_regdb_search_request), GFP_KERNEL);
 	if (!request)
-		return;
+		return -ENOMEM;
 
 	memcpy(request->alpha2, alpha2, 2);
 
@@ -472,6 +472,7 @@ static void reg_regdb_query(const char *alpha2)
 	mutex_unlock(&reg_regdb_search_mutex);
 
 	schedule_work(&reg_regdb_work);
+	return 0;
 }
 
 /* Feel free to add any other sanity checks here */
@@ -482,7 +483,15 @@ static void reg_regdb_size_check(void)
 }
 #else
 static inline void reg_regdb_size_check(void) {}
-static inline void reg_regdb_query(const char *alpha2) {}
+static inline int reg_regdb_query(const char *alpha2)
+{
+	if (!is_world_regdom((char *) alpha2))
+		pr_info("Calling CRDA for country: %c%c\n",
+			alpha2[0], alpha2[1]);
+	else
+		pr_info("Calling CRDA to update world regulatory domain\n");
+	return kobject_uevent(&reg_pdev->dev.kobj, KOBJ_CHANGE);
+}
 #endif /* CONFIG_CFG80211_INTERNAL_REGDB */
 
 /*
@@ -492,22 +501,14 @@ static inline void reg_regdb_query(const char *alpha2) {}
  */
 static int call_crda(const char *alpha2)
 {
-	if (!is_world_regdom((char *) alpha2))
-		pr_info("Calling CRDA for country: %c%c\n",
-			alpha2[0], alpha2[1]);
-	else
-		pr_info("Calling CRDA to update world regulatory domain\n");
-
-	/* query internal regulatory database (if it exists) */
-	reg_regdb_query(alpha2);
-
-	return kobject_uevent(&reg_pdev->dev.kobj, KOBJ_CHANGE);
+	/* query internal regulatory database/crda depending on config */
+	return reg_regdb_query(alpha2);
 }
 
 static enum reg_request_treatment
 reg_call_crda(struct regulatory_request *request)
 {
-	if (call_crda(request->alpha2))
+	if (call_crda(request->alpha2) < 0)
 		return REG_REQ_IGNORE;
 	return REG_REQ_OK;
 }

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

* Re: [PATCH V2] cfg80211: Do not call CRDA when using internal regulatory database
  2014-01-18  1:39 [PATCH V2] cfg80211: Do not call CRDA when using internal regulatory database Chaitanya T K
@ 2014-01-20 10:50 ` Johannes Berg
  2014-01-21 19:11   ` Krishna Chaitanya
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2014-01-20 10:50 UTC (permalink / raw)
  To: Chaitanya T K; +Cc: linux-wireless, mcgrof

On Sat, 2014-01-18 at 07:09 +0530, Chaitanya T K wrote:
> When using internal regulatory data base kconfig option,
> do not try to call crda. This completely defeats the 
> purpose of enabling internal regulatory db.

I still think that this is a significant userspace API change, so I'm
not going to apply it. Find another solution.

johannes


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

* Re: [PATCH V2] cfg80211: Do not call CRDA when using internal regulatory database
  2014-01-20 10:50 ` Johannes Berg
@ 2014-01-21 19:11   ` Krishna Chaitanya
  0 siblings, 0 replies; 3+ messages in thread
From: Krishna Chaitanya @ 2014-01-21 19:11 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Luis Rodriguez

On Mon, Jan 20, 2014 at 4:20 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Sat, 2014-01-18 at 07:09 +0530, Chaitanya T K wrote:
>> When using internal regulatory data base kconfig option,
>> do not try to call crda. This completely defeats the
>> purpose of enabling internal regulatory db.
>
> I still think that this is a significant userspace API change, so I'm
> not going to apply it. Find another solution.
>
Well, only way i can think of is ignore the update from the CRDA
and go on with internal db.txt, but even this will have impact on
user. As internal regdb is rarely used,this is not really needed.

But the second fix which returns REG_IGNORE when call_crda
returns an error should be still taken. Probably !=0 check is still better .

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

end of thread, other threads:[~2014-01-21 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-18  1:39 [PATCH V2] cfg80211: Do not call CRDA when using internal regulatory database Chaitanya T K
2014-01-20 10:50 ` Johannes Berg
2014-01-21 19:11   ` Krishna Chaitanya

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.