netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v1 1/1] wireless: Add KHZ_PER_GHZ to units.h and reuse
@ 2024-02-15 15:41 Andy Shevchenko
  2024-02-15 17:23 ` Kalle Valo
  2024-02-19 10:52 ` Simon Horman
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-02-15 15:41 UTC (permalink / raw)
  To: Andy Shevchenko, Johannes Berg, linux-kernel, linux-wireless,
	netdev
  Cc: Johannes Berg, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

The KHZ_PER_GHZ might be used by others (with the name aligned
with similar constants). Define it in units.h and convert
wireless to use it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/units.h | 5 ++++-
 net/wireless/reg.c    | 7 +++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/include/linux/units.h b/include/linux/units.h
index 45110daaf8d3..00e15de33eca 100644
--- a/include/linux/units.h
+++ b/include/linux/units.h
@@ -24,10 +24,13 @@
 #define NANOHZ_PER_HZ		1000000000UL
 #define MICROHZ_PER_HZ		1000000UL
 #define MILLIHZ_PER_HZ		1000UL
+
 #define HZ_PER_KHZ		1000UL
-#define KHZ_PER_MHZ		1000UL
 #define HZ_PER_MHZ		1000000UL
 
+#define KHZ_PER_MHZ		1000UL
+#define KHZ_PER_GHZ		1000000UL
+
 #define MILLIWATT_PER_WATT	1000UL
 #define MICROWATT_PER_MILLIWATT	1000UL
 #define MICROWATT_PER_WATT	1000000UL
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 50cadbad485f..753f8e9aa4b1 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -57,6 +57,8 @@
 #include <linux/verification.h>
 #include <linux/moduleparam.h>
 #include <linux/firmware.h>
+#include <linux/units.h>
+
 #include <net/cfg80211.h>
 #include "core.h"
 #include "reg.h"
@@ -1289,20 +1291,17 @@ static bool is_valid_rd(const struct ieee80211_regdomain *rd)
 static bool freq_in_rule_band(const struct ieee80211_freq_range *freq_range,
 			      u32 freq_khz)
 {
-#define ONE_GHZ_IN_KHZ	1000000
 	/*
 	 * From 802.11ad: directional multi-gigabit (DMG):
 	 * Pertaining to operation in a frequency band containing a channel
 	 * with the Channel starting frequency above 45 GHz.
 	 */
-	u32 limit = freq_khz > 45 * ONE_GHZ_IN_KHZ ?
-			20 * ONE_GHZ_IN_KHZ : 2 * ONE_GHZ_IN_KHZ;
+	u32 limit = freq_khz > 45 * KHZ_PER_GHZ ? 20 * KHZ_PER_GHZ : 2 * KHZ_PER_GHZ;
 	if (abs(freq_khz - freq_range->start_freq_khz) <= limit)
 		return true;
 	if (abs(freq_khz - freq_range->end_freq_khz) <= limit)
 		return true;
 	return false;
-#undef ONE_GHZ_IN_KHZ
 }
 
 /*
-- 
2.43.0.rc1.1.gbec44491f096


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

* Re: [PATCH net-next v1 1/1] wireless: Add KHZ_PER_GHZ to units.h and reuse
  2024-02-15 15:41 [PATCH net-next v1 1/1] wireless: Add KHZ_PER_GHZ to units.h and reuse Andy Shevchenko
@ 2024-02-15 17:23 ` Kalle Valo
  2024-02-20 14:25   ` Andy Shevchenko
  2024-02-19 10:52 ` Simon Horman
  1 sibling, 1 reply; 5+ messages in thread
From: Kalle Valo @ 2024-02-15 17:23 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Johannes Berg, linux-kernel, linux-wireless, netdev,
	Johannes Berg, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:

> The KHZ_PER_GHZ might be used by others (with the name aligned
> with similar constants). Define it in units.h and convert
> wireless to use it.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  include/linux/units.h | 5 ++++-
>  net/wireless/reg.c    | 7 +++----
>  2 files changed, 7 insertions(+), 5 deletions(-)

wireless patches go to wireless-next, not net-next. But no need resend
because of this.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH net-next v1 1/1] wireless: Add KHZ_PER_GHZ to units.h and reuse
  2024-02-15 15:41 [PATCH net-next v1 1/1] wireless: Add KHZ_PER_GHZ to units.h and reuse Andy Shevchenko
  2024-02-15 17:23 ` Kalle Valo
@ 2024-02-19 10:52 ` Simon Horman
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Horman @ 2024-02-19 10:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Johannes Berg, linux-kernel, linux-wireless, netdev,
	Johannes Berg, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

On Thu, Feb 15, 2024 at 05:41:36PM +0200, Andy Shevchenko wrote:
> The KHZ_PER_GHZ might be used by others (with the name aligned
> with similar constants). Define it in units.h and convert
> wireless to use it.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Simon Horman <horms@kernel.org>


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

* Re: [PATCH net-next v1 1/1] wireless: Add KHZ_PER_GHZ to units.h and reuse
  2024-02-15 17:23 ` Kalle Valo
@ 2024-02-20 14:25   ` Andy Shevchenko
  2024-02-20 16:57     ` Kalle Valo
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2024-02-20 14:25 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Johannes Berg, linux-kernel, linux-wireless, netdev,
	Johannes Berg, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

On Thu, Feb 15, 2024 at 07:23:06PM +0200, Kalle Valo wrote:
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
> 
> > The KHZ_PER_GHZ might be used by others (with the name aligned
> > with similar constants). Define it in units.h and convert
> > wireless to use it.

> wireless patches go to wireless-next, not net-next. But no need resend
> because of this.

Aha, thanks. Note, I still don't see it in wireless-next tree. Is everything
on track?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH net-next v1 1/1] wireless: Add KHZ_PER_GHZ to units.h and reuse
  2024-02-20 14:25   ` Andy Shevchenko
@ 2024-02-20 16:57     ` Kalle Valo
  0 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2024-02-20 16:57 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Johannes Berg, linux-kernel, linux-wireless, netdev,
	Johannes Berg, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:

> On Thu, Feb 15, 2024 at 07:23:06PM +0200, Kalle Valo wrote:
>> Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
>> 
>> > The KHZ_PER_GHZ might be used by others (with the name aligned
>> > with similar constants). Define it in units.h and convert
>> > wireless to use it.
>
>> wireless patches go to wireless-next, not net-next. But no need resend
>> because of this.
>
> Aha, thanks. Note, I still don't see it in wireless-next tree. Is everything
> on track?

Yes, it's queued in patchwork:

https://patchwork.kernel.org/project/linux-wireless/patch/20240215154136.630029-1-andriy.shevchenko@linux.intel.com/

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

end of thread, other threads:[~2024-02-20 16:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-15 15:41 [PATCH net-next v1 1/1] wireless: Add KHZ_PER_GHZ to units.h and reuse Andy Shevchenko
2024-02-15 17:23 ` Kalle Valo
2024-02-20 14:25   ` Andy Shevchenko
2024-02-20 16:57     ` Kalle Valo
2024-02-19 10:52 ` Simon Horman

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