Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation warning with 64 bit system #413

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,10 @@ static ssize_t mwl_debugfs_info_read(struct file *file, char __user *ubuf,
"-----------------------=> address| address|qlen|fw_desc_cnt\n");
spin_lock_irqsave(&pcie_priv->tx_desc_lock, flags);
len += scnprintf(p + len, size - len,
"wcb_base0 : %x => %8x|%8p|%4d|%d\n", get_hw_spec->wcb_base0, *((unsigned int *)le32_to_cpu(get_hw_spec->wcb_base0)),(void *)*((unsigned int *)le32_to_cpu(get_hw_spec->wcb_base0)),skb_queue_len(&pcie_priv->txq[0]),pcie_priv->fw_desc_cnt[0]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zx requires size_t.

"wcb_base0 : %x => %8zx|%8p|%4d|%d\n", get_hw_spec->wcb_base0, *((uintptr_t *)(uintptr_t)le32_to_cpu(get_hw_spec->wcb_base0)),(void *)*((uintptr_t *)(uintptr_t)le32_to_cpu(get_hw_spec->wcb_base0)),skb_queue_len(&pcie_priv->txq[0]),pcie_priv->fw_desc_cnt[0]);
for(i = 0; i < SYSADPT_TOTAL_TX_QUEUES - 1; i++)
len += scnprintf(p + len, size - len,
"wcb_base[%2d]: %x => %8x|%8p|%4d|%d\n", i, get_hw_spec->wcb_base[i], *((unsigned int *)le32_to_cpu(get_hw_spec->wcb_base[i])),(void *)*((unsigned int *)le32_to_cpu(get_hw_spec->wcb_base[i])),skb_queue_len(&pcie_priv->txq[i + 1]),pcie_priv->fw_desc_cnt[i + 1]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete this part :

*((unsigned int *)le32_to_cpu(get_hw_spec->wcb_base[i])),(void *)*((unsigned int *)le32_to_cpu(get_hw_spec->wcb_base[i])),

wcb_base must be an internal memory on the 88X8xxx chip, searching RAM is useless.

"wcb_base[%2d]: %x => %8zx|%8p|%4d|%d\n", i, get_hw_spec->wcb_base[i], *((uintptr_t *)(uintptr_t)le32_to_cpu(get_hw_spec->wcb_base[i])),(void *)*((uintptr_t *)(uintptr_t)le32_to_cpu(get_hw_spec->wcb_base[i])),skb_queue_len(&pcie_priv->txq[i + 1]),pcie_priv->fw_desc_cnt[i + 1]);
spin_unlock_irqrestore(&pcie_priv->tx_desc_lock, flags);
}

Expand Down Expand Up @@ -1342,7 +1342,7 @@ static ssize_t mwl_debugfs_regrdwr_read(struct file *file, char __user *ubuf,
priv->reg_value);
else
len += scnprintf(p + len, size - len,
"error: %d(%u 0x%08x 0x%08x)\n",
"error: %zd(%u 0x%08x 0x%08x)\n",
ret, priv->reg_type, priv->reg_offset,
priv->reg_value);

Expand Down
6 changes: 1 addition & 5 deletions hif/fwcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3622,11 +3622,7 @@ int mwl_fwcmd_get_fw_core_dump(struct ieee80211_hw *hw,
core_dump->context = pcmd->cmd_data.coredump.context;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd have to test this function, I'm not sure:

	pcmd->cmd_data.coredump.buffer = cpu_to_le32(priv->pphys_cmd_buf +
		sizeof(struct hostcmd_cmd_get_fw_core_dump) -
		sizeof(struct hostcmd_cmd_get_fw_core_dump_));

in
image
2 struct have exactly the same size.

struct coredump_cmd {
	__le32 context;
	__le32 buffer;
	__le32 buffer_len;
	__le16 size_kb;
	__le16 flags;
} __packed;

struct debug_mem_cmd {
	__le32 set;
	__le32 type;
	__le32 addr;
	__le32 val;
} __packed;

but

char buffer[MAX_CORE_DUMP_BUFFER];

Roughly speaking, for a union, if I calculate, it would be worth :

cpu_to_le32(priv->pphys_cmd_buf 
		+ sizeof(char buffer[MAX_CORE_DUMP_BUFFER]))

sounds strange
Thank you in advance,

core_dump->size_kb = pcmd->cmd_data.coredump.size_kb;
core_dump->flags = pcmd->cmd_data.coredump.flags;
memcpy(buff,
(const void *)((u32)pcmd +
sizeof(struct hostcmd_cmd_get_fw_core_dump) -
sizeof(struct hostcmd_cmd_get_fw_core_dump_)),
MAX_CORE_DUMP_BUFFER);
memcpy(buff, pcmd->buffer, MAX_CORE_DUMP_BUFFER);

mutex_unlock(&priv->fwcmd_mutex);

Expand Down
9 changes: 2 additions & 7 deletions hif/pcie/8964/tx_ndp.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,8 @@ int pcie_tx_init_ndp(struct ieee80211_hw *hw)
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(&skb);
int rc;

if (sizeof(struct pcie_tx_ctrl_ndp) >
sizeof(tx_info->driver_data)) {
wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
sizeof(struct pcie_tx_ctrl_ndp),
sizeof(tx_info->driver_data));
return -ENOMEM;
}
BUILD_BUG_ON(sizeof(struct pcie_tx_ctrl_ndp) >
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to use BUILD_BUG_ON_MSG instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you for maintaining this message, it's an initialization function, it doesn't cost anything in terms of performance.

sizeof(tx_info->driver_data));

rc = pcie_tx_ring_alloc_ndp(priv);
if (rc) {
Expand Down
4 changes: 2 additions & 2 deletions hif/pcie/pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -1466,8 +1466,8 @@ static void pcie_bf_mimo_ctrl_decode(struct mwl_priv *priv,
&fp_data->f_pos);
filp_close(fp_data, current->files);
} else {
wiphy_err(priv->hw->wiphy, "Error opening %s! %x\n",
filename, (unsigned int)fp_data);
wiphy_err(priv->hw->wiphy, "Error opening %s! %ld\n",
filename, PTR_ERR(fp_data));
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
Expand Down