diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2007-12-06 07:01:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:06:07 -0500 |
commit | abe3ed14d39adcea9ae186cf741b15d11544458f (patch) | |
tree | 65f0e7df2a2fea79541815a4a50349c4f020f533 /drivers | |
parent | 6228c0aea544f5292977e6b27cd231a4ea137a62 (diff) |
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: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 7097dcf7abc8..851eb3ce3e12 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -1021,11 +1021,10 @@ void lbs_queue_cmd(struct lbs_adapter *adapter, | |||
1021 | spin_lock_irqsave(&adapter->driver_lock, flags); | 1021 | spin_lock_irqsave(&adapter->driver_lock, flags); |
1022 | 1022 | ||
1023 | if (addtail) { | 1023 | if (addtail) { |
1024 | list_add_tail((struct list_head *)cmdnode, | 1024 | list_add_tail(&cmdnode->list, &adapter->cmdpendingq); |
1025 | &adapter->cmdpendingq); | ||
1026 | adapter->nr_cmd_pending++; | 1025 | adapter->nr_cmd_pending++; |
1027 | } else | 1026 | } else |
1028 | list_add((struct list_head *)cmdnode, &adapter->cmdpendingq); | 1027 | list_add(&cmdnode->list, &adapter->cmdpendingq); |
1029 | 1028 | ||
1030 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 1029 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
1031 | 1030 | ||
@@ -1144,7 +1143,7 @@ void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, | |||
1144 | return; | 1143 | return; |
1145 | 1144 | ||
1146 | cleanup_cmdnode(ptempcmd); | 1145 | cleanup_cmdnode(ptempcmd); |
1147 | list_add_tail((struct list_head *)ptempcmd, &adapter->cmdfreeq); | 1146 | list_add_tail(&ptempcmd->list, &adapter->cmdfreeq); |
1148 | } | 1147 | } |
1149 | 1148 | ||
1150 | static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, | 1149 | 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 | spin_lock_irqsave(&adapter->driver_lock, flags); | 1641 | spin_lock_irqsave(&adapter->driver_lock, flags); |
1643 | 1642 | ||
1644 | if (!list_empty(&adapter->cmdfreeq)) { | 1643 | if (!list_empty(&adapter->cmdfreeq)) { |
1645 | tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next; | 1644 | tempnode = list_first_entry(&adapter->cmdfreeq, |
1646 | list_del((struct list_head *)tempnode); | 1645 | struct cmd_ctrl_node, list); |
1646 | list_del(&tempnode->list); | ||
1647 | } else { | 1647 | } else { |
1648 | lbs_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n"); | 1648 | lbs_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n"); |
1649 | tempnode = NULL; | 1649 | tempnode = NULL; |
@@ -1738,8 +1738,8 @@ int lbs_execute_next_command(struct lbs_private *priv) | |||
1738 | } | 1738 | } |
1739 | 1739 | ||
1740 | if (!list_empty(&adapter->cmdpendingq)) { | 1740 | if (!list_empty(&adapter->cmdpendingq)) { |
1741 | cmdnode = (struct cmd_ctrl_node *) | 1741 | cmdnode = list_first_entry(&adapter->cmdpendingq, |
1742 | adapter->cmdpendingq.next; | 1742 | struct cmd_ctrl_node, list); |
1743 | } | 1743 | } |
1744 | 1744 | ||
1745 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 1745 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
@@ -1803,7 +1803,7 @@ int lbs_execute_next_command(struct lbs_private *priv) | |||
1803 | cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { | 1803 | cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { |
1804 | lbs_deb_host( | 1804 | lbs_deb_host( |
1805 | "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); | 1805 | "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); |
1806 | list_del((struct list_head *)cmdnode); | 1806 | list_del(&cmdnode->list); |
1807 | lbs_cleanup_and_insert_cmd(priv, cmdnode); | 1807 | lbs_cleanup_and_insert_cmd(priv, cmdnode); |
1808 | 1808 | ||
1809 | ret = 0; | 1809 | ret = 0; |
@@ -1814,7 +1814,7 @@ int lbs_execute_next_command(struct lbs_private *priv) | |||
1814 | (adapter->psstate == PS_STATE_PRE_SLEEP)) { | 1814 | (adapter->psstate == PS_STATE_PRE_SLEEP)) { |
1815 | lbs_deb_host( | 1815 | lbs_deb_host( |
1816 | "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); | 1816 | "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); |
1817 | list_del((struct list_head *)cmdnode); | 1817 | list_del(&cmdnode->list); |
1818 | lbs_cleanup_and_insert_cmd(priv, cmdnode); | 1818 | lbs_cleanup_and_insert_cmd(priv, cmdnode); |
1819 | adapter->needtowakeup = 1; | 1819 | adapter->needtowakeup = 1; |
1820 | 1820 | ||
@@ -1826,7 +1826,7 @@ int lbs_execute_next_command(struct lbs_private *priv) | |||
1826 | "EXEC_NEXT_CMD: sending EXIT_PS\n"); | 1826 | "EXEC_NEXT_CMD: sending EXIT_PS\n"); |
1827 | } | 1827 | } |
1828 | } | 1828 | } |
1829 | list_del((struct list_head *)cmdnode); | 1829 | list_del(&cmdnode->list); |
1830 | lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", | 1830 | lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", |
1831 | le16_to_cpu(cmdptr->command)); | 1831 | le16_to_cpu(cmdptr->command)); |
1832 | DownloadcommandToStation(priv, cmdnode); | 1832 | DownloadcommandToStation(priv, cmdnode); |