Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3bb1429 authored by Larry Finger's avatar Larry Finger Committed by John W. Linville
Browse files

rtlwifi: rtl8192ce: rtl8192cu: Fix most sparse warnings



Fix most sparse warnings in rtlwifi, rtl8192ce and rtl8192cu drivers.

Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 76c34f91
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -795,7 +795,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
	ip = (struct iphdr *)((u8 *) skb->data + mac_hdr_len +
			      SNAP_SIZE + PROTOC_TYPE_SIZE);
	ether_type = *(u16 *) ((u8 *) skb->data + mac_hdr_len + SNAP_SIZE);
	ether_type = ntohs(ether_type);
	/*	ether_type = ntohs(ether_type); */

	if (ETH_P_IP == ether_type) {
		if (IPPROTO_UDP == ip->protocol) {
@@ -1105,7 +1105,7 @@ u8 *rtl_find_ie(u8 *data, unsigned int len, u8 ie)

/* when we use 2 rx ants we send IEEE80211_SMPS_OFF */
/* when we use 1 rx ant we send IEEE80211_SMPS_STATIC */
struct sk_buff *rtl_make_smps_action(struct ieee80211_hw *hw,
static struct sk_buff *rtl_make_smps_action(struct ieee80211_hw *hw,
		enum ieee80211_smps_mode smps, u8 *da, u8 *bssid)
{
	struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
@@ -1230,7 +1230,7 @@ static bool rtl_chk_vendor_ouisub(struct ieee80211_hw *hw,
	return matched;
}

bool rtl_find_221_ie(struct ieee80211_hw *hw, u8 *data,
static bool rtl_find_221_ie(struct ieee80211_hw *hw, u8 *data,
		unsigned int len)
{
	struct ieee80211_mgmt *mgmt = (void *)data;
+2 −2
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
	u8 efuse_tbl[rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]];
	u8 efuse_tbl[HWSET_MAX_SIZE];
	u8 rtemp8[1];
	u16 efuse_addr = 0;
	u8 offset, wren;
@@ -245,7 +245,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
		rtlpriv->cfg->maps[EFUSE_MAX_SECTION_MAP];
	const u32 efuse_len =
		rtlpriv->cfg->maps[EFUSE_REAL_CONTENT_SIZE];
	u16 efuse_word[efuse_max_section][EFUSE_MAX_WORD_UNIT];
	u16 efuse_word[EFUSE_MAX_SECTION][EFUSE_MAX_WORD_UNIT];
	u16 efuse_utilized = 0;
	u8 efuse_usage;

+18 −152
Original line number Diff line number Diff line
@@ -48,11 +48,11 @@ static const u8 ac_to_hwq[] = {
	BK_QUEUE
};

u8 _rtl_mac_to_hwqueue(struct ieee80211_hw *hw,
static u8 _rtl_mac_to_hwqueue(struct ieee80211_hw *hw,
		       struct sk_buff *skb)
{
	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
	u16 fc = rtl_get_fc(skb);
	__le16 fc = rtl_get_fc(skb);
	u8 queue_index = skb_get_queue_mapping(skb);

	if (unlikely(ieee80211_is_beacon(fc)))
@@ -181,71 +181,6 @@ static void _rtl_pci_update_default_setting(struct ieee80211_hw *hw)
		ppsc->support_aspm = false;
}

/*Disable L0s dirtectly. We will disable host L0s by default. */
void rtl_pci_disable_host_l0s(struct ieee80211_hw *hw)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
	u8 pcibridge_busnum = pcipriv->ndis_adapter.pcibridge_busnum;
	u8 pcibridge_devnum = pcipriv->ndis_adapter.pcibridge_devnum;
	u8 pcibridge_funcnum = pcipriv->ndis_adapter.pcibridge_funcnum;
	u32 pcicfg_addrport = pcipriv->ndis_adapter.pcicfg_addrport;
	u8 num4bytes = pcipriv->ndis_adapter.num4bytes;
	u8 u_pcibridge_aspmsetting = 0;

	/*Read  Link Control Register */
	rtl_pci_raw_write_port_ulong(PCI_CONF_ADDRESS,
				     pcicfg_addrport + (num4bytes << 2));
	rtl_pci_raw_read_port_uchar(PCI_CONF_DATA, &u_pcibridge_aspmsetting);

	if (u_pcibridge_aspmsetting & BIT(0))
		u_pcibridge_aspmsetting &= ~(BIT(0));

	rtl_pci_raw_write_port_ulong(PCI_CONF_ADDRESS,
				     pcicfg_addrport + (num4bytes << 2));
	rtl_pci_raw_write_port_uchar(PCI_CONF_DATA, u_pcibridge_aspmsetting);

	udelay(50);

	RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
		 ("PciBridge busnumber[%x], DevNumbe[%x], "
		  "funcnumber[%x], Write reg[%x] = %lx\n",
		  pcibridge_busnum, pcibridge_devnum, pcibridge_funcnum,
		  (pcipriv->ndis_adapter.pcibridge_pciehdr_offset + 0x10),
		  (pcipriv->ndis_adapter.pcibridge_linkctrlreg |
		   (rtlpci->const_devicepci_aspm_setting & ~BIT(0)))));
}

/*Enable rtl8192ce backdoor to control ASPM and clock request.*/
bool rtl_pci_enable_back_door(struct ieee80211_hw *hw)
{
	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
	u8 pcibridge_vendor = pcipriv->ndis_adapter.pcibridge_vendor;
	bool bresult = true;
	u8 value;

	pci_read_config_byte(rtlpci->pdev, 0x70f, &value);

	/*0x70f BIT(7) is used to control L0S */
	if (pcibridge_vendor == PCI_BRIDGE_VENDOR_INTEL) {
		value |= BIT(7);
	} else {
		/*Set 0x70f to 0x23 when non-Intel platform. */
		value = 0x23;
	}

	pci_write_config_byte(rtlpci->pdev, 0x70f, value);

	pci_read_config_byte(rtlpci->pdev, 0x719, &value);
	/*0x719 BIT(3) is for L1 BIT(4) is for clock request */
	value |= (BIT(3) | BIT(4));
	pci_write_config_byte(rtlpci->pdev, 0x719, value);

	return bresult;
}

static bool _rtl_pci_platform_switch_device_pci_aspm(
			struct ieee80211_hw *hw,
			u8 value)
@@ -426,7 +361,7 @@ static bool rtl_pci_get_amd_l1_patch(struct ieee80211_hw *hw)
	return status;
}

void rtl_pci_get_linkcontrol_field(struct ieee80211_hw *hw)
static void rtl_pci_get_linkcontrol_field(struct ieee80211_hw *hw)
{
	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
	u8 capabilityoffset = pcipriv->ndis_adapter.pcibridge_pciehdr_offset;
@@ -618,9 +553,9 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)

		skb = __skb_dequeue(&ring->queue);
		pci_unmap_single(rtlpci->pdev,
				 le32_to_cpu(rtlpriv->cfg->ops->
				 rtlpriv->cfg->ops->
					     get_desc((u8 *) entry, true,
						      HW_DESC_TXBUFF_ADDR)),
						      HW_DESC_TXBUFF_ADDR),
				 skb->len, PCI_DMA_TODEVICE);

		/* remove early mode header */
@@ -844,7 +779,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)

		}
done:
		bufferaddress = cpu_to_le32(*((dma_addr_t *)skb->cb));
		bufferaddress = (*((dma_addr_t *)skb->cb));
		tmp_one = 1;
		rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false,
					    HW_DESC_RXBUFF_ADDR,
@@ -868,75 +803,6 @@ done:

}

void _rtl_pci_tx_interrupt(struct ieee80211_hw *hw)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
	int prio;

	for (prio = 0; prio < RTL_PCI_MAX_TX_QUEUE_COUNT; prio++) {
		struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[prio];

		while (skb_queue_len(&ring->queue)) {
			struct rtl_tx_desc *entry = &ring->desc[ring->idx];
			struct sk_buff *skb;
			struct ieee80211_tx_info *info;
			u8 own;

			/*
			 *beacon packet will only use the first
			 *descriptor defautly, and the own may not
			 *be cleared by the hardware, and
			 *beacon will free in prepare beacon
			 */
			if (prio == BEACON_QUEUE || prio == TXCMD_QUEUE ||
			    prio == HCCA_QUEUE)
				break;

			own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) entry,
							       true,
							       HW_DESC_OWN);

			if (own)
				break;

			skb = __skb_dequeue(&ring->queue);
			pci_unmap_single(rtlpci->pdev,
					 le32_to_cpu(rtlpriv->cfg->ops->
						     get_desc((u8 *) entry,
							  true,
							  HW_DESC_TXBUFF_ADDR)),
					 skb->len, PCI_DMA_TODEVICE);

			ring->idx = (ring->idx + 1) % ring->entries;

			info = IEEE80211_SKB_CB(skb);
			ieee80211_tx_info_clear_status(info);

			info->flags |= IEEE80211_TX_STAT_ACK;
			/*info->status.rates[0].count = 1; */

			ieee80211_tx_status_irqsafe(hw, skb);

			if ((ring->entries - skb_queue_len(&ring->queue))
			    == 2 && prio != BEACON_QUEUE) {
				RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
					 ("more desc left, wake "
					  "skb_queue@%d,ring->idx = %d,"
					  "skb_queue_len = 0x%d\n",
					  prio, ring->idx,
					  skb_queue_len(&ring->queue)));

				ieee80211_wake_queue(hw,
						     skb_get_queue_mapping
						     (skb));
			}

			skb = NULL;
		}
	}
}

static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
{
	struct ieee80211_hw *hw = dev_id;
@@ -1202,9 +1068,9 @@ static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw,
		 ("queue:%d, ring_addr:%p\n", prio, ring));

	for (i = 0; i < entries; i++) {
		nextdescaddress = cpu_to_le32((u32) dma +
		nextdescaddress = (u32) dma +
					      ((i + 11) % entries) *
					      sizeof(*ring));
					      sizeof(*ring);

		rtlpriv->cfg->ops->set_desc((u8 *)&(ring[i]),
					    true, HW_DESC_TX_NEXTDESC_ADDR,
@@ -1268,7 +1134,7 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw)
					   rtlpci->rxbuffersize,
					   PCI_DMA_FROMDEVICE);

			bufferaddress = cpu_to_le32(*((dma_addr_t *)skb->cb));
			bufferaddress = (*((dma_addr_t *)skb->cb));
			rtlpriv->cfg->ops->set_desc((u8 *)entry, false,
						    HW_DESC_RXBUFF_ADDR,
						    (u8 *)&bufferaddress);
@@ -1299,9 +1165,9 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw,
		struct sk_buff *skb = __skb_dequeue(&ring->queue);

		pci_unmap_single(rtlpci->pdev,
				 le32_to_cpu(rtlpriv->cfg->
				 rtlpriv->cfg->
					     ops->get_desc((u8 *) entry, true,
						   HW_DESC_TXBUFF_ADDR)),
						   HW_DESC_TXBUFF_ADDR),
				 skb->len, PCI_DMA_TODEVICE);
		kfree_skb(skb);
		ring->idx = (ring->idx + 1) % ring->entries;
@@ -1433,11 +1299,11 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw)
				    __skb_dequeue(&ring->queue);

				pci_unmap_single(rtlpci->pdev,
						 le32_to_cpu(rtlpriv->cfg->ops->
						 rtlpriv->cfg->ops->
							 get_desc((u8 *)
							 entry,
							 true,
							 HW_DESC_TXBUFF_ADDR)),
							 HW_DESC_TXBUFF_ADDR),
						 skb->len, PCI_DMA_TODEVICE);
				kfree_skb(skb);
				ring->idx = (ring->idx + 1) % ring->entries;
@@ -1484,7 +1350,7 @@ static bool rtl_pci_tx_chk_waitq_insert(struct ieee80211_hw *hw,
	return true;
}

int rtl_pci_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
static int rtl_pci_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
		struct rtl_tcb_desc *ptcb_desc)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -1623,7 +1489,7 @@ static void rtl_pci_flush(struct ieee80211_hw *hw, bool drop)
	}
}

void rtl_pci_deinit(struct ieee80211_hw *hw)
static void rtl_pci_deinit(struct ieee80211_hw *hw)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
@@ -1638,7 +1504,7 @@ void rtl_pci_deinit(struct ieee80211_hw *hw)

}

int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	int err;
@@ -1655,7 +1521,7 @@ int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
	return 1;
}

int rtl_pci_start(struct ieee80211_hw *hw)
static int rtl_pci_start(struct ieee80211_hw *hw)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
@@ -1690,7 +1556,7 @@ int rtl_pci_start(struct ieee80211_hw *hw)
	return 0;
}

void rtl_pci_stop(struct ieee80211_hw *hw)
static void rtl_pci_stop(struct ieee80211_hw *hw)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
+0 −45
Original line number Diff line number Diff line
@@ -1238,51 +1238,6 @@ static void rtl92c_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw)
	dm_pstable.rssi_val_min = 0;
}

void rtl92c_dm_1r_cca(struct ieee80211_hw *hw)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_phy *rtlphy = &(rtlpriv->phy);

	if (dm_pstable.rssi_val_min != 0) {
		if (dm_pstable.pre_ccastate == CCA_2R) {
			if (dm_pstable.rssi_val_min >= 35)
				dm_pstable.cur_ccasate = CCA_1R;
			else
				dm_pstable.cur_ccasate = CCA_2R;
		} else {
			if (dm_pstable.rssi_val_min <= 30)
				dm_pstable.cur_ccasate = CCA_2R;
			else
				dm_pstable.cur_ccasate = CCA_1R;
		}
	} else {
		dm_pstable.cur_ccasate = CCA_MAX;
	}

	if (dm_pstable.pre_ccastate != dm_pstable.cur_ccasate) {
		if (dm_pstable.cur_ccasate == CCA_1R) {
			if (get_rf_type(rtlphy) == RF_2T2R) {
				rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE,
					      MASKBYTE0, 0x13);
				rtl_set_bbreg(hw, 0xe70, MASKBYTE3, 0x20);
			} else {
				rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE,
					      MASKBYTE0, 0x23);
				rtl_set_bbreg(hw, 0xe70, 0x7fc00000, 0x10c);
			}
		} else {
			rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, MASKBYTE0,
				      0x33);
			rtl_set_bbreg(hw, 0xe70, MASKBYTE3, 0x63);
		}
		dm_pstable.pre_ccastate = dm_pstable.cur_ccasate;
	}

	RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, ("CCAStage = %s\n",
					       (dm_pstable.cur_ccasate ==
						0) ? "1RCCA" : "2RCCA"));
}

void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal)
{
	static u8 initialize;
+16 −0
Original line number Diff line number Diff line
@@ -238,5 +238,21 @@ void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw);
bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
				      u8 channel, u8 *stage, u8 *step,
				      u32 *delay);
u8 rtl92c_bt_rssi_state_change(struct ieee80211_hw *hw);
u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
				  enum radio_path rfpath, u32 offset);
void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
				    enum radio_path rfpath, u32 offset,
				    u32 data);
u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw,
			       enum radio_path rfpath, u32 offset);
void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
				 enum radio_path rfpath, u32 offset,
				 u32 data);
bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw);
void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw,
					    u32 regaddr, u32 bitmask,
					    u32 data);
bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);

#endif
Loading