On Tue, 2012-04-17 at 10:46 -0700, greearb@xxxxxxxxxxxxxxx wrote: > From: Ben Greear <greearb@xxxxxxxxxxxxxxx> > > Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx> > --- > :100644 100644 27f9561... be6fb62... M include/net/cfg80211.h > :100644 100644 6cba001... 2fd0e97... M net/wireless/util.c > include/net/cfg80211.h | 7 +++++++ > net/wireless/util.c | 24 ++++++++++++++++++++++++ > 2 files changed, 31 insertions(+), 0 deletions(-) > > diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h > index 27f9561..be6fb62 100644 > --- a/include/net/cfg80211.h > +++ b/include/net/cfg80211.h > @@ -2388,6 +2388,13 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq) > } > > /** > + * ieee80211_get_channel_idx - get channel index from wiphy for specified freq > + * @wiphy: the struct wiphy to get the channel for > + * @freq: the center frequency of the channel > + */ > +extern int ieee80211_get_channel_idx(struct wiphy *wiphy, int freq); I prefer you drop the extern, but ... > +int ieee80211_get_channel_idx(struct wiphy *wiphy, int freq) > +{ > + enum ieee80211_band band; > + struct ieee80211_supported_band *sband; > + int i; > + int rv = 0; > + > + for (band = 0; band < IEEE80211_NUM_BANDS; band++) { > + sband = wiphy->bands[band]; > + > + if (!sband) > + continue; > + > + for (i = 0; i < sband->n_channels; i++) { > + if (sband->channels[i].center_freq == freq) > + return rv; > + rv++; > + } > + } > + > + return NULL; > +} "return NULL"? Really? Also, what use is the index? It's some kind of global channel index, but that's almost completely useless. I think you need a very very very good reason to have this function and you're not even stating a single one. johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html