aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorZHAO Gang <gamerh2o@gmail.com>2014-01-17 11:17:39 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-02-13 15:20:14 -0500
commitbb6bd25c08738ace7102a550a15481e70bc31ee8 (patch)
tree39c645451412aeeb5bd3cadf8a9fa76cae75378d /drivers/net
parent0e028ab0fb2da47fd235dafd4159859892e73d08 (diff)
b43: use kernel api to replace b43 specific helper function
Use ieee80211_channel_to_frequency() to replace b43_channel_to_freq_{2,5}ghz(), and remove unused b43_freq_to_channel_{2,5}ghz(). Signed-off-by: ZHAO Gang <gamerh2o@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/b43/main.h35
-rw-r--r--drivers/net/wireless/b43/xmit.c12
2 files changed, 6 insertions, 41 deletions
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index abac25ee958d..f476fc337d64 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -58,41 +58,6 @@ enum b43_verbosity {
58#endif 58#endif
59}; 59};
60 60
61
62/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
63static inline u8 b43_freq_to_channel_5ghz(int freq)
64{
65 return ((freq - 5000) / 5);
66}
67static inline u8 b43_freq_to_channel_2ghz(int freq)
68{
69 u8 channel;
70
71 if (freq == 2484)
72 channel = 14;
73 else
74 channel = (freq - 2407) / 5;
75
76 return channel;
77}
78
79/* Lightweight function to convert a channel number to a frequency (in Mhz). */
80static inline int b43_channel_to_freq_5ghz(u8 channel)
81{
82 return (5000 + (5 * channel));
83}
84static inline int b43_channel_to_freq_2ghz(u8 channel)
85{
86 int freq;
87
88 if (channel == 14)
89 freq = 2484;
90 else
91 freq = 2407 + (5 * channel);
92
93 return freq;
94}
95
96static inline int b43_is_cck_rate(int rate) 61static inline int b43_is_cck_rate(int rate)
97{ 62{
98 return (rate == B43_CCK_RATE_1MB || 63 return (rate == B43_CCK_RATE_1MB ||
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 50e5ddb12fb3..218a0f37af46 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -806,7 +806,8 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
806 B43_WARN_ON(1); 806 B43_WARN_ON(1);
807 /* FIXME: We don't really know which value the "chanid" contains. 807 /* FIXME: We don't really know which value the "chanid" contains.
808 * So the following assignment might be wrong. */ 808 * So the following assignment might be wrong. */
809 status.freq = b43_channel_to_freq_5ghz(chanid); 809 status.freq =
810 ieee80211_channel_to_frequency(chanid, status.band);
810 break; 811 break;
811 case B43_PHYTYPE_G: 812 case B43_PHYTYPE_G:
812 status.band = IEEE80211_BAND_2GHZ; 813 status.band = IEEE80211_BAND_2GHZ;
@@ -819,13 +820,12 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
819 case B43_PHYTYPE_HT: 820 case B43_PHYTYPE_HT:
820 /* chanid is the SHM channel cookie. Which is the plain 821 /* chanid is the SHM channel cookie. Which is the plain
821 * channel number in b43. */ 822 * channel number in b43. */
822 if (chanstat & B43_RX_CHAN_5GHZ) { 823 if (chanstat & B43_RX_CHAN_5GHZ)
823 status.band = IEEE80211_BAND_5GHZ; 824 status.band = IEEE80211_BAND_5GHZ;
824 status.freq = b43_channel_to_freq_5ghz(chanid); 825 else
825 } else {
826 status.band = IEEE80211_BAND_2GHZ; 826 status.band = IEEE80211_BAND_2GHZ;
827 status.freq = b43_channel_to_freq_2ghz(chanid); 827 status.freq =
828 } 828 ieee80211_channel_to_frequency(chanid, status.band);
829 break; 829 break;
830 default: 830 default:
831 B43_WARN_ON(1); 831 B43_WARN_ON(1);