diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-06-10 06:18:50 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-08-22 17:25:34 -0400 |
commit | 91d697302b291205171840bfe84c1563e171acb2 (patch) | |
tree | e196d2573bee89b511cb8052d25357959d47d9a8 | |
parent | 60dee5ccd789ee8a380eee802b6cb24c52123428 (diff) |
Bluetooth: Fix Marvell driver to use skb_put and hci_opcode_pack
The Marvell driver has some weird quirks on how to construct proper SKBs
with Bluetooth HCI commands. Fix it to use skb_put properly and also
use hci_opcode_pack instead of self-crafted macro.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | drivers/bluetooth/btmrvl_main.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index 61168ec3bd27..f5a3dc5c067c 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c | |||
@@ -172,14 +172,13 @@ int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd) | |||
172 | goto exit; | 172 | goto exit; |
173 | } | 173 | } |
174 | 174 | ||
175 | cmd = (struct btmrvl_cmd *) skb->tail; | 175 | cmd = skb_put(skb, sizeof(*cmd)); |
176 | cmd->ocf_ogf = cpu_to_le16((OGF << 10) | BT_CMD_MODULE_CFG_REQ); | 176 | cmd->ocf_ogf = cpu_to_le16(hci_opcode_pack(OGF, BT_CMD_MODULE_CFG_REQ)); |
177 | cmd->length = 1; | 177 | cmd->length = 1; |
178 | cmd->data[0] = subcmd; | 178 | cmd->data[0] = subcmd; |
179 | 179 | ||
180 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; | 180 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; |
181 | 181 | ||
182 | skb_put(skb, sizeof(*cmd)); | ||
183 | skb->dev = (void *) priv->btmrvl_dev.hcidev; | 182 | skb->dev = (void *) priv->btmrvl_dev.hcidev; |
184 | skb_queue_head(&priv->adapter->tx_queue, skb); | 183 | skb_queue_head(&priv->adapter->tx_queue, skb); |
185 | 184 | ||
@@ -223,13 +222,12 @@ static int btmrvl_enable_hs(struct btmrvl_private *priv) | |||
223 | goto exit; | 222 | goto exit; |
224 | } | 223 | } |
225 | 224 | ||
226 | cmd = (struct btmrvl_cmd *) skb->tail; | 225 | cmd = skb_put(skb, sizeof(*cmd)); |
227 | cmd->ocf_ogf = cpu_to_le16((OGF << 10) | BT_CMD_HOST_SLEEP_ENABLE); | 226 | cmd->ocf_ogf = cpu_to_le16(hci_opcode_pack(OGF, BT_CMD_HOST_SLEEP_ENABLE)); |
228 | cmd->length = 0; | 227 | cmd->length = 0; |
229 | 228 | ||
230 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; | 229 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; |
231 | 230 | ||
232 | skb_put(skb, sizeof(*cmd)); | ||
233 | skb->dev = (void *) priv->btmrvl_dev.hcidev; | 231 | skb->dev = (void *) priv->btmrvl_dev.hcidev; |
234 | skb_queue_head(&priv->adapter->tx_queue, skb); | 232 | skb_queue_head(&priv->adapter->tx_queue, skb); |
235 | 233 | ||
@@ -270,16 +268,14 @@ int btmrvl_prepare_command(struct btmrvl_private *priv) | |||
270 | goto exit; | 268 | goto exit; |
271 | } | 269 | } |
272 | 270 | ||
273 | cmd = (struct btmrvl_cmd *) skb->tail; | 271 | cmd = skb_put(skb, sizeof(*cmd)); |
274 | cmd->ocf_ogf = cpu_to_le16((OGF << 10) | | 272 | cmd->ocf_ogf = cpu_to_le16(hci_opcode_pack(OGF, BT_CMD_HOST_SLEEP_CONFIG)); |
275 | BT_CMD_HOST_SLEEP_CONFIG); | ||
276 | cmd->length = 2; | 273 | cmd->length = 2; |
277 | cmd->data[0] = (priv->btmrvl_dev.gpio_gap & 0xff00) >> 8; | 274 | cmd->data[0] = (priv->btmrvl_dev.gpio_gap & 0xff00) >> 8; |
278 | cmd->data[1] = (u8) (priv->btmrvl_dev.gpio_gap & 0x00ff); | 275 | cmd->data[1] = (u8) (priv->btmrvl_dev.gpio_gap & 0x00ff); |
279 | 276 | ||
280 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; | 277 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; |
281 | 278 | ||
282 | skb_put(skb, sizeof(*cmd)); | ||
283 | skb->dev = (void *) priv->btmrvl_dev.hcidev; | 279 | skb->dev = (void *) priv->btmrvl_dev.hcidev; |
284 | skb_queue_head(&priv->adapter->tx_queue, skb); | 280 | skb_queue_head(&priv->adapter->tx_queue, skb); |
285 | 281 | ||
@@ -297,9 +293,8 @@ int btmrvl_prepare_command(struct btmrvl_private *priv) | |||
297 | goto exit; | 293 | goto exit; |
298 | } | 294 | } |
299 | 295 | ||
300 | cmd = (struct btmrvl_cmd *) skb->tail; | 296 | cmd = skb_put(skb, sizeof(*cmd)); |
301 | cmd->ocf_ogf = cpu_to_le16((OGF << 10) | | 297 | cmd->ocf_ogf = cpu_to_le16(hci_opcode_pack(OGF, BT_CMD_AUTO_SLEEP_MODE)); |
302 | BT_CMD_AUTO_SLEEP_MODE); | ||
303 | cmd->length = 1; | 298 | cmd->length = 1; |
304 | 299 | ||
305 | if (priv->btmrvl_dev.psmode) | 300 | if (priv->btmrvl_dev.psmode) |
@@ -309,7 +304,6 @@ int btmrvl_prepare_command(struct btmrvl_private *priv) | |||
309 | 304 | ||
310 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; | 305 | bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; |
311 | 306 | ||
312 | skb_put(skb, sizeof(*cmd)); | ||
313 | skb->dev = (void *) priv->btmrvl_dev.hcidev; | 307 | skb->dev = (void *) priv->btmrvl_dev.hcidev; |
314 | skb_queue_head(&priv->adapter->tx_queue, skb); | 308 | skb_queue_head(&priv->adapter->tx_queue, skb); |
315 | 309 | ||