Commit abe3ed14 authored by Li Zefan's avatar Li Zefan Committed by David S. Miller

libertas: don't cast a pointer to pointer of

Don't cast struct foo * to struct list_head *, it's safe only when
the list member is the first member of struct foo.

Also don't cast struct list_head * to struct foo *.
Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarHolger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6228c0ae
...@@ -1021,11 +1021,10 @@ void lbs_queue_cmd(struct lbs_adapter *adapter, ...@@ -1021,11 +1021,10 @@ void lbs_queue_cmd(struct lbs_adapter *adapter,
spin_lock_irqsave(&adapter->driver_lock, flags); spin_lock_irqsave(&adapter->driver_lock, flags);
if (addtail) { if (addtail) {
list_add_tail((struct list_head *)cmdnode, list_add_tail(&cmdnode->list, &adapter->cmdpendingq);
&adapter->cmdpendingq);
adapter->nr_cmd_pending++; adapter->nr_cmd_pending++;
} else } else
list_add((struct list_head *)cmdnode, &adapter->cmdpendingq); list_add(&cmdnode->list, &adapter->cmdpendingq);
spin_unlock_irqrestore(&adapter->driver_lock, flags); spin_unlock_irqrestore(&adapter->driver_lock, flags);
...@@ -1144,7 +1143,7 @@ void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, ...@@ -1144,7 +1143,7 @@ void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv,
return; return;
cleanup_cmdnode(ptempcmd); cleanup_cmdnode(ptempcmd);
list_add_tail((struct list_head *)ptempcmd, &adapter->cmdfreeq); list_add_tail(&ptempcmd->list, &adapter->cmdfreeq);
} }
static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv,
...@@ -1642,8 +1641,9 @@ struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) ...@@ -1642,8 +1641,9 @@ struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv)
spin_lock_irqsave(&adapter->driver_lock, flags); spin_lock_irqsave(&adapter->driver_lock, flags);
if (!list_empty(&adapter->cmdfreeq)) { if (!list_empty(&adapter->cmdfreeq)) {
tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next; tempnode = list_first_entry(&adapter->cmdfreeq,
list_del((struct list_head *)tempnode); struct cmd_ctrl_node, list);
list_del(&tempnode->list);
} else { } else {
lbs_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n"); lbs_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n");
tempnode = NULL; tempnode = NULL;
...@@ -1738,8 +1738,8 @@ int lbs_execute_next_command(struct lbs_private *priv) ...@@ -1738,8 +1738,8 @@ int lbs_execute_next_command(struct lbs_private *priv)
} }
if (!list_empty(&adapter->cmdpendingq)) { if (!list_empty(&adapter->cmdpendingq)) {
cmdnode = (struct cmd_ctrl_node *) cmdnode = list_first_entry(&adapter->cmdpendingq,
adapter->cmdpendingq.next; struct cmd_ctrl_node, list);
} }
spin_unlock_irqrestore(&adapter->driver_lock, flags); spin_unlock_irqrestore(&adapter->driver_lock, flags);
...@@ -1803,7 +1803,7 @@ int lbs_execute_next_command(struct lbs_private *priv) ...@@ -1803,7 +1803,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { cpu_to_le16(CMD_SUBCMD_EXIT_PS)) {
lbs_deb_host( lbs_deb_host(
"EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n");
list_del((struct list_head *)cmdnode); list_del(&cmdnode->list);
lbs_cleanup_and_insert_cmd(priv, cmdnode); lbs_cleanup_and_insert_cmd(priv, cmdnode);
ret = 0; ret = 0;
...@@ -1814,7 +1814,7 @@ int lbs_execute_next_command(struct lbs_private *priv) ...@@ -1814,7 +1814,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
(adapter->psstate == PS_STATE_PRE_SLEEP)) { (adapter->psstate == PS_STATE_PRE_SLEEP)) {
lbs_deb_host( lbs_deb_host(
"EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n");
list_del((struct list_head *)cmdnode); list_del(&cmdnode->list);
lbs_cleanup_and_insert_cmd(priv, cmdnode); lbs_cleanup_and_insert_cmd(priv, cmdnode);
adapter->needtowakeup = 1; adapter->needtowakeup = 1;
...@@ -1826,7 +1826,7 @@ int lbs_execute_next_command(struct lbs_private *priv) ...@@ -1826,7 +1826,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
"EXEC_NEXT_CMD: sending EXIT_PS\n"); "EXEC_NEXT_CMD: sending EXIT_PS\n");
} }
} }
list_del((struct list_head *)cmdnode); list_del(&cmdnode->list);
lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n",
le16_to_cpu(cmdptr->command)); le16_to_cpu(cmdptr->command));
DownloadcommandToStation(priv, cmdnode); DownloadcommandToStation(priv, cmdnode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment