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

Commit 15400663 authored by Yonglong Liu's avatar Yonglong Liu Committed by David S. Miller
Browse files

net: hns: Fix sparse: some warnings in HNS drivers



There are some sparse warnings in the HNS drivers:

warning: incorrect type in assignment (different address spaces)
    expected void [noderef] <asn:2> *io_base
    got void *vaddr
warning: cast removes address space '<asn:2>' of expression
[...]

Add __iomem and change all the u8 __iomem to void __iomem to
fix these kind of  warnings.

warning: incorrect type in argument 1 (different address spaces)
    expected void [noderef] <asn:2> *base
    got unsigned char [usertype] *base_addr
warning: cast to restricted __le16
warning: incorrect type in assignment (different base types)
    expected unsigned int [usertype] tbl_tcam_data_high
    got restricted __le32 [usertype]
warning: cast to restricted __le32
[...]

These variables used u32/u16 as their type, and finally as a
parameter of writel(), writel() will do the cpu_to_le32 coversion
so remove the little endian covert code to fix these kind of warnings.

Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8601a99d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -357,7 +357,7 @@ struct hnae_buf_ops {
};

struct hnae_queue {
	void __iomem *io_base;
	u8 __iomem *io_base;
	phys_addr_t phy_base;
	struct hnae_ae_dev *dev;	/* the device who use this queue */
	struct hnae_ring rx_ring ____cacheline_internodealigned_in_smp;
+1 −1
Original line number Diff line number Diff line
@@ -370,7 +370,7 @@ int hns_mac_clr_multicast(struct hns_mac_cb *mac_cb, int vfn)
static void hns_mac_param_get(struct mac_params *param,
			      struct hns_mac_cb *mac_cb)
{
	param->vaddr = (void *)mac_cb->vaddr;
	param->vaddr = mac_cb->vaddr;
	param->mac_mode = hns_get_enet_interface(mac_cb);
	ether_addr_copy(param->addr, mac_cb->addr_entry_idx[0].addr);
	param->mac_id = mac_cb->mac_id;
+2 −2
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ struct mac_statistics {
/*mac para struct ,mac get param from nic or dsaf when initialize*/
struct mac_params {
	char addr[ETH_ALEN];
	void *vaddr; /*virtual address*/
	u8 __iomem *vaddr; /*virtual address*/
	struct device *dev;
	u8 mac_id;
	/**< Ethernet operation mode (MAC-PHY interface and speed) */
@@ -402,7 +402,7 @@ struct mac_driver {
	enum mac_mode mac_mode;
	u8 mac_id;
	struct hns_mac_cb *mac_cb;
	void __iomem *io_base;
	u8 __iomem *io_base;
	unsigned int mac_en_flg;/*you'd better don't enable mac twice*/
	unsigned int virt_dev_num;
	struct device *dev;
+6 −14
Original line number Diff line number Diff line
@@ -1602,8 +1602,6 @@ static void hns_dsaf_set_mac_key(
		       DSAF_TBL_TCAM_KEY_VLAN_S, vlan_id);
	dsaf_set_field(mac_key->low.bits.port_vlan, DSAF_TBL_TCAM_KEY_PORT_M,
		       DSAF_TBL_TCAM_KEY_PORT_S, port);

	mac_key->low.bits.port_vlan = le16_to_cpu(mac_key->low.bits.port_vlan);
}

/**
@@ -1663,8 +1661,8 @@ int hns_dsaf_set_mac_uc_entry(
	/* default config dvc to 0 */
	mac_data.tbl_ucast_dvc = 0;
	mac_data.tbl_ucast_out_port = mac_entry->port_num;
	tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val);
	tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val);
	tcam_data.tbl_tcam_data_high = mac_key.high.val;
	tcam_data.tbl_tcam_data_low = mac_key.low.val;

	hns_dsaf_tcam_uc_cfg(dsaf_dev, entry_index, &tcam_data, &mac_data);

@@ -1786,9 +1784,6 @@ int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev,
				     0xff,
				     mc_mask);

		mask_key.high.val = le32_to_cpu(mask_key.high.val);
		mask_key.low.val = le32_to_cpu(mask_key.low.val);

		pmask_key = (struct dsaf_tbl_tcam_data *)(&mask_key);
	}

@@ -1840,8 +1835,8 @@ int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev,
		dsaf_dev->ae_dev.name, mac_key.high.val,
		mac_key.low.val, entry_index);

	tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val);
	tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val);
	tcam_data.tbl_tcam_data_high = mac_key.high.val;
	tcam_data.tbl_tcam_data_low = mac_key.low.val;

	/* config mc entry with mask */
	hns_dsaf_tcam_mc_cfg(dsaf_dev, entry_index, &tcam_data,
@@ -1956,9 +1951,6 @@ int hns_dsaf_del_mac_mc_port(struct dsaf_device *dsaf_dev,
		/* config key mask */
		hns_dsaf_set_mac_key(dsaf_dev, &mask_key, 0x00, 0xff, mc_mask);

		mask_key.high.val = le32_to_cpu(mask_key.high.val);
		mask_key.low.val = le32_to_cpu(mask_key.low.val);

		pmask_key = (struct dsaf_tbl_tcam_data *)(&mask_key);
	}

@@ -2012,8 +2004,8 @@ int hns_dsaf_del_mac_mc_port(struct dsaf_device *dsaf_dev,
		soft_mac_entry += entry_index;
		soft_mac_entry->index = DSAF_INVALID_ENTRY_IDX;
	} else { /* not zero, just del port, update */
		tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val);
		tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val);
		tcam_data.tbl_tcam_data_high = mac_key.high.val;
		tcam_data.tbl_tcam_data_low = mac_key.low.val;

		hns_dsaf_tcam_mc_cfg(dsaf_dev, entry_index,
				     &tcam_data,
+2 −0
Original line number Diff line number Diff line
@@ -467,4 +467,6 @@ int hns_dsaf_clr_mac_mc_port(struct dsaf_device *dsaf_dev,
			     u8 mac_id, u8 port_num);
int hns_dsaf_wait_pkt_clean(struct dsaf_device *dsaf_dev, int port);

int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset);

#endif /* __HNS_DSAF_MAIN_H__ */
Loading