treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / staging / rtl8192e / dot11d.h
blob6d2b93acfa4315bc4d5012f3541789f61b7562b2
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
5 * Contact Information:
6 * wlanfae <wlanfae@realtek.com>
7 ******************************************************************************/
8 #ifndef __INC_DOT11D_H
9 #define __INC_DOT11D_H
11 #include "rtllib.h"
13 struct chnl_txpow_triple {
14 u8 first_channel;
15 u8 num_channels;
16 u8 max_tx_power;
19 enum dot11d_state {
20 DOT11D_STATE_NONE = 0,
21 DOT11D_STATE_LEARNED,
22 DOT11D_STATE_DONE,
25 /**
26 * struct rt_dot11d_info * @country_len: value greater than 0 if
27 * @country_buffer contains valid country information element.
28 * @channel_map: holds channel values
29 * 0 - invalid,
30 * 1 - valid (active scan),
31 * 2 - valid (passive scan)
32 * @country_src_addr - Source AP of the country IE
35 struct rt_dot11d_info {
36 bool enabled;
38 u16 country_len;
39 u8 country_buffer[MAX_IE_LEN];
40 u8 country_src_addr[6];
41 u8 country_watchdog;
43 u8 channel_map[MAX_CHANNEL_NUMBER + 1];
44 u8 max_tx_power_list[MAX_CHANNEL_NUMBER + 1];
46 enum dot11d_state state;
49 static inline void copy_mac_addr(unsigned char *des, unsigned char *src)
51 memcpy(des, src, 6);
54 #define GET_DOT11D_INFO(__ieee_dev) \
55 ((struct rt_dot11d_info *)((__ieee_dev)->dot11d_info))
57 #define IS_DOT11D_ENABLE(__ieee_dev) \
58 (GET_DOT11D_INFO(__ieee_dev)->enabled)
59 #define IS_COUNTRY_IE_VALID(__ieee_dev) \
60 (GET_DOT11D_INFO(__ieee_dev)->country_len > 0)
62 #define IS_EQUAL_CIE_SRC(__ieee_dev, __address) \
63 ether_addr_equal_unaligned( \
64 GET_DOT11D_INFO(__ieee_dev)->country_src_addr, __address)
65 #define UPDATE_CIE_SRC(__ieee_dev, __address) \
66 copy_mac_addr(GET_DOT11D_INFO(__ieee_dev)->country_src_addr, __address)
68 #define GET_CIE_WATCHDOG(__ieee_dev) \
69 (GET_DOT11D_INFO(__ieee_dev)->country_watchdog)
70 static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__ieee_dev)
72 GET_CIE_WATCHDOG(__ieee_dev) = 0;
75 #define UPDATE_CIE_WATCHDOG(__ieee_dev) (++GET_CIE_WATCHDOG(__ieee_dev))
77 void dot11d_init(struct rtllib_device *dev);
78 void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee);
79 void dot11d_reset(struct rtllib_device *dev);
80 void dot11d_update_country(struct rtllib_device *dev, u8 *address,
81 u16 country_len, u8 *country);
82 void dot11d_scan_complete(struct rtllib_device *dev);
84 #endif