wifi: cfg80211: expose cfg80211_chandef_get_width()
authorJohannes Berg <johannes.berg@intel.com>
Tue, 11 Mar 2025 11:25:34 +0000 (12:25 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 12 Mar 2025 08:50:24 +0000 (09:50 +0100)
This can be just a trivial inline, to simplify some code.
Expose it, and also use it in util.c where it wasn't
previously available.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250311122534.c5c3b4af9a74.Ib25cf60f634dc359961182113214e5cdc3504e9c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
net/wireless/chan.c
net/wireless/util.c

index 73f0e75cc8147806949195d09912b8e075acadd4..efbd79c67be21dc596dba7cedc6a161b141cb13c 100644 (file)
@@ -1008,6 +1008,17 @@ cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
  */
 int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width);
 
+/**
+ * cfg80211_chandef_get_width - return chandef width in MHz
+ * @c: chandef to return bandwidth for
+ * Return: channel width in MHz for the given chandef; note that it returns
+ *     80 for 80+80 configurations
+ */
+static inline int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c)
+{
+       return nl80211_chan_width_to_mhz(c->width);
+}
+
 /**
  * cfg80211_chandef_valid - check if a channel definition is valid
  * @chandef: the channel definition to check
index 4cdb74a3f38c6a464d8e359cf5ec28ecb93f5bab..193734b7f9dc52d93f556d691098b4c63416774f 100644 (file)
@@ -55,11 +55,6 @@ void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
 }
 EXPORT_SYMBOL(cfg80211_chandef_create);
 
-static int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c)
-{
-       return nl80211_chan_width_to_mhz(c->width);
-}
-
 static u32 cfg80211_get_start_freq(const struct cfg80211_chan_def *chandef,
                                   u32 cf)
 {
index 60157943d3519874faa1ed0cbf15f7ddd783f65e..ed868c0f7ca8ed7a9e85e70c10a738f592eac1d6 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright 2007-2009 Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright 2017      Intel Deutschland GmbH
- * Copyright (C) 2018-2023 Intel Corporation
+ * Copyright (C) 2018-2023, 2025 Intel Corporation
  */
 #include <linux/export.h>
 #include <linux/bitops.h>
@@ -2908,7 +2908,7 @@ bool cfg80211_radio_chandef_valid(const struct wiphy_radio *radio,
        u32 freq, width;
 
        freq = ieee80211_chandef_to_khz(chandef);
-       width = nl80211_chan_width_to_mhz(chandef->width);
+       width = cfg80211_chandef_get_width(chandef);
        if (!ieee80211_radio_freq_range_valid(radio, freq, width))
                return false;