diff options
Diffstat (limited to 'drivers/staging/vt6656/main_usb.c')
-rw-r--r-- | drivers/staging/vt6656/main_usb.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 5e48b3ddb94c..8e7269c87ea9 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -21,8 +21,10 @@ */ #undef __NO_VERSION__ +#include <linux/bits.h> #include <linux/etherdevice.h> #include <linux/file.h> +#include <linux/kernel.h> #include "device.h" #include "card.h" #include "baseband.h" @@ -30,12 +32,10 @@ #include "power.h" #include "wcmd.h" #include "rxtx.h" -#include "dpc.h" #include "rf.h" #include "firmware.h" #include "usbpipe.h" #include "channel.h" -#include "int.h" /* * define module options @@ -99,7 +99,6 @@ static void vnt_set_options(struct vnt_private *priv) priv->op_mode = NL80211_IFTYPE_UNSPECIFIED; priv->bb_type = BBP_TYPE_DEF; priv->packet_type = priv->bb_type; - priv->auto_fb_ctrl = AUTO_FB_0; priv->preamble_type = 0; priv->exist_sw_net_addr = false; } @@ -109,7 +108,7 @@ static void vnt_set_options(struct vnt_private *priv) */ static int vnt_init_registers(struct vnt_private *priv) { - int ret = 0; + int ret; struct vnt_cmd_card_init *init_cmd = &priv->init_command; struct vnt_rsp_card_init *init_rsp = &priv->init_response; u8 antenna; @@ -145,7 +144,7 @@ static int vnt_init_registers(struct vnt_private *priv) init_cmd->init_class = DEVICE_INIT_COLD; init_cmd->exist_sw_net_addr = priv->exist_sw_net_addr; - for (ii = 0; ii < 6; ii++) + for (ii = 0; ii < ARRAY_SIZE(init_cmd->sw_net_addr); ii++) init_cmd->sw_net_addr[ii] = priv->current_net_addr[ii]; init_cmd->short_retry_limit = priv->short_retry_limit; init_cmd->long_retry_limit = priv->long_retry_limit; @@ -184,7 +183,7 @@ static int vnt_init_registers(struct vnt_private *priv) priv->cck_pwr = priv->eeprom[EEP_OFS_PWR_CCK]; priv->ofdm_pwr_g = priv->eeprom[EEP_OFS_PWR_OFDMG]; /* load power table */ - for (ii = 0; ii < 14; ii++) { + for (ii = 0; ii < ARRAY_SIZE(priv->cck_pwr_tbl); ii++) { priv->cck_pwr_tbl[ii] = priv->eeprom[ii + EEP_OFS_CCK_PWR_TBL]; if (priv->cck_pwr_tbl[ii] == 0) @@ -200,7 +199,7 @@ static int vnt_init_registers(struct vnt_private *priv) * original zonetype is USA, but custom zonetype is Europe, * then need to recover 12, 13, 14 channels with 11 channel */ - for (ii = 11; ii < 14; ii++) { + for (ii = 11; ii < ARRAY_SIZE(priv->cck_pwr_tbl); ii++) { priv->cck_pwr_tbl[ii] = priv->cck_pwr_tbl[10]; priv->ofdm_pwr_tbl[ii] = priv->ofdm_pwr_tbl[10]; } @@ -261,9 +260,6 @@ static int vnt_init_registers(struct vnt_private *priv) if (ret) goto end; - /* get Auto Fall Back type */ - priv->auto_fb_ctrl = AUTO_FB_0; - /* default Auto Mode */ priv->bb_type = BB_TYPE_11G; @@ -370,7 +366,7 @@ static int vnt_init_registers(struct vnt_private *priv) if (ret) goto end; - ret = vnt_mac_reg_bits_on(priv, MAC_REG_GPIOCTL0, 0x01); + ret = vnt_mac_reg_bits_on(priv, MAC_REG_GPIOCTL0, BIT(0)); if (ret) goto end; @@ -435,7 +431,7 @@ static void vnt_free_int_bufs(struct vnt_private *priv) static int vnt_alloc_bufs(struct vnt_private *priv) { - int ret = 0; + int ret; struct vnt_usb_send_context *tx_context; struct vnt_rcb *rcb; int ii; @@ -484,9 +480,6 @@ static int vnt_alloc_bufs(struct vnt_private *priv) ret = -ENOMEM; goto free_rx_tx; } - - rcb->in_use = false; - /* submit rx urb */ ret = vnt_submit_rx_urb(priv, rcb); if (ret) @@ -528,7 +521,7 @@ static void vnt_tx_80211(struct ieee80211_hw *hw, static int vnt_start(struct ieee80211_hw *hw) { - int ret = 0; + int ret; struct vnt_private *priv = hw->priv; priv->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS; @@ -553,7 +546,7 @@ static int vnt_start(struct ieee80211_hw *hw) priv->int_interval = 1; /* bInterval is set to 1 */ - ret = vnt_int_start_interrupt(priv); + ret = vnt_start_interrupt_urb(priv); if (ret) goto free_all; @@ -798,12 +791,11 @@ static u64 vnt_prepare_multicast(struct ieee80211_hw *hw, struct vnt_private *priv = hw->priv; struct netdev_hw_addr *ha; u64 mc_filter = 0; - u32 bit_nr = 0; + u32 bit_nr; netdev_hw_addr_list_for_each(ha, mc_list) { bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; - - mc_filter |= 1ULL << (bit_nr & 0x3f); + mc_filter |= BIT_ULL(bit_nr); } priv->mc_list_count = mc_list->count; @@ -862,9 +854,7 @@ static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, switch (cmd) { case SET_KEY: - if (vnt_set_keys(hw, sta, vif, key)) - return -EOPNOTSUPP; - break; + return vnt_set_keys(hw, sta, vif, key); case DISABLE_KEY: if (test_bit(key->hw_key_idx, &priv->key_entry_inuse)) clear_bit(key->hw_key_idx, &priv->key_entry_inuse); @@ -973,7 +963,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) struct vnt_private *priv; struct ieee80211_hw *hw; struct wiphy *wiphy; - int rc = 0; + int rc; udev = usb_get_dev(interface_to_usbdev(intf)); |