diff options
| author | David S. Miller <davem@davemloft.net> | 2010-02-01 02:34:58 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2010-02-01 02:34:58 -0500 |
| commit | 1e98cadb0d2b9f945f35beee4a0ce667f3c6dbe4 (patch) | |
| tree | 0b5940be30331d461cd4421abe7829b392ab6e62 /net | |
| parent | 71cc1fa9f2d71eb2eba9b8e71e27cff9863e55f3 (diff) | |
| parent | 6bf8268f9a91f1065c99503161ebd061492bebe3 (diff) | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6
Diffstat (limited to 'net')
| -rw-r--r-- | net/bluetooth/hidp/core.c | 70 | ||||
| -rw-r--r-- | net/bluetooth/l2cap.c | 14 |
2 files changed, 42 insertions, 42 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 18e7f5a43dc4..6cf526d06e21 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
| @@ -243,6 +243,39 @@ static void hidp_input_report(struct hidp_session *session, struct sk_buff *skb) | |||
| 243 | input_sync(dev); | 243 | input_sync(dev); |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | static int __hidp_send_ctrl_message(struct hidp_session *session, | ||
| 247 | unsigned char hdr, unsigned char *data, int size) | ||
| 248 | { | ||
| 249 | struct sk_buff *skb; | ||
| 250 | |||
| 251 | BT_DBG("session %p data %p size %d", session, data, size); | ||
| 252 | |||
| 253 | if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) { | ||
| 254 | BT_ERR("Can't allocate memory for new frame"); | ||
| 255 | return -ENOMEM; | ||
| 256 | } | ||
| 257 | |||
| 258 | *skb_put(skb, 1) = hdr; | ||
| 259 | if (data && size > 0) | ||
| 260 | memcpy(skb_put(skb, size), data, size); | ||
| 261 | |||
| 262 | skb_queue_tail(&session->ctrl_transmit, skb); | ||
| 263 | |||
| 264 | return 0; | ||
| 265 | } | ||
| 266 | |||
| 267 | static inline int hidp_send_ctrl_message(struct hidp_session *session, | ||
| 268 | unsigned char hdr, unsigned char *data, int size) | ||
| 269 | { | ||
| 270 | int err; | ||
| 271 | |||
| 272 | err = __hidp_send_ctrl_message(session, hdr, data, size); | ||
| 273 | |||
| 274 | hidp_schedule(session); | ||
| 275 | |||
| 276 | return err; | ||
| 277 | } | ||
| 278 | |||
| 246 | static int hidp_queue_report(struct hidp_session *session, | 279 | static int hidp_queue_report(struct hidp_session *session, |
| 247 | unsigned char *data, int size) | 280 | unsigned char *data, int size) |
| 248 | { | 281 | { |
| @@ -282,7 +315,9 @@ static int hidp_send_report(struct hidp_session *session, struct hid_report *rep | |||
| 282 | 315 | ||
| 283 | static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count) | 316 | static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count) |
| 284 | { | 317 | { |
| 285 | if (hidp_queue_report(hid->driver_data, data, count)) | 318 | if (hidp_send_ctrl_message(hid->driver_data, |
| 319 | HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE, | ||
| 320 | data, count)) | ||
| 286 | return -ENOMEM; | 321 | return -ENOMEM; |
| 287 | return count; | 322 | return count; |
| 288 | } | 323 | } |
| @@ -307,39 +342,6 @@ static inline void hidp_del_timer(struct hidp_session *session) | |||
| 307 | del_timer(&session->timer); | 342 | del_timer(&session->timer); |
| 308 | } | 343 | } |
| 309 | 344 | ||
| 310 | static int __hidp_send_ctrl_message(struct hidp_session *session, | ||
| 311 | unsigned char hdr, unsigned char *data, int size) | ||
| 312 | { | ||
| 313 | struct sk_buff *skb; | ||
| 314 | |||
| 315 | BT_DBG("session %p data %p size %d", session, data, size); | ||
| 316 | |||
| 317 | if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) { | ||
| 318 | BT_ERR("Can't allocate memory for new frame"); | ||
| 319 | return -ENOMEM; | ||
| 320 | } | ||
| 321 | |||
| 322 | *skb_put(skb, 1) = hdr; | ||
| 323 | if (data && size > 0) | ||
| 324 | memcpy(skb_put(skb, size), data, size); | ||
| 325 | |||
| 326 | skb_queue_tail(&session->ctrl_transmit, skb); | ||
| 327 | |||
| 328 | return 0; | ||
| 329 | } | ||
| 330 | |||
| 331 | static inline int hidp_send_ctrl_message(struct hidp_session *session, | ||
| 332 | unsigned char hdr, unsigned char *data, int size) | ||
| 333 | { | ||
| 334 | int err; | ||
| 335 | |||
| 336 | err = __hidp_send_ctrl_message(session, hdr, data, size); | ||
| 337 | |||
| 338 | hidp_schedule(session); | ||
| 339 | |||
| 340 | return err; | ||
| 341 | } | ||
| 342 | |||
| 343 | static void hidp_process_handshake(struct hidp_session *session, | 345 | static void hidp_process_handshake(struct hidp_session *session, |
| 344 | unsigned char param) | 346 | unsigned char param) |
| 345 | { | 347 | { |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 1120cf14a548..400efa26ddba 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
| @@ -1368,7 +1368,6 @@ static int l2cap_ertm_send(struct sock *sk) | |||
| 1368 | 1368 | ||
| 1369 | while ((skb = sk->sk_send_head) && (!l2cap_tx_window_full(sk)) && | 1369 | while ((skb = sk->sk_send_head) && (!l2cap_tx_window_full(sk)) && |
| 1370 | !(pi->conn_state & L2CAP_CONN_REMOTE_BUSY)) { | 1370 | !(pi->conn_state & L2CAP_CONN_REMOTE_BUSY)) { |
| 1371 | tx_skb = skb_clone(skb, GFP_ATOMIC); | ||
| 1372 | 1371 | ||
| 1373 | if (pi->remote_max_tx && | 1372 | if (pi->remote_max_tx && |
| 1374 | bt_cb(skb)->retries == pi->remote_max_tx) { | 1373 | bt_cb(skb)->retries == pi->remote_max_tx) { |
| @@ -1376,6 +1375,8 @@ static int l2cap_ertm_send(struct sock *sk) | |||
| 1376 | break; | 1375 | break; |
| 1377 | } | 1376 | } |
| 1378 | 1377 | ||
| 1378 | tx_skb = skb_clone(skb, GFP_ATOMIC); | ||
| 1379 | |||
| 1379 | bt_cb(skb)->retries++; | 1380 | bt_cb(skb)->retries++; |
| 1380 | 1381 | ||
| 1381 | control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE); | 1382 | control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE); |
| @@ -3518,7 +3519,6 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk | |||
| 3518 | struct l2cap_pinfo *pi; | 3519 | struct l2cap_pinfo *pi; |
| 3519 | u16 control, len; | 3520 | u16 control, len; |
| 3520 | u8 tx_seq; | 3521 | u8 tx_seq; |
| 3521 | int err; | ||
| 3522 | 3522 | ||
| 3523 | sk = l2cap_get_chan_by_scid(&conn->chan_list, cid); | 3523 | sk = l2cap_get_chan_by_scid(&conn->chan_list, cid); |
| 3524 | if (!sk) { | 3524 | if (!sk) { |
| @@ -3570,13 +3570,11 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk | |||
| 3570 | goto drop; | 3570 | goto drop; |
| 3571 | 3571 | ||
| 3572 | if (__is_iframe(control)) | 3572 | if (__is_iframe(control)) |
| 3573 | err = l2cap_data_channel_iframe(sk, control, skb); | 3573 | l2cap_data_channel_iframe(sk, control, skb); |
| 3574 | else | 3574 | else |
| 3575 | err = l2cap_data_channel_sframe(sk, control, skb); | 3575 | l2cap_data_channel_sframe(sk, control, skb); |
| 3576 | 3576 | ||
| 3577 | if (!err) | 3577 | goto done; |
| 3578 | goto done; | ||
| 3579 | break; | ||
| 3580 | 3578 | ||
| 3581 | case L2CAP_MODE_STREAMING: | 3579 | case L2CAP_MODE_STREAMING: |
| 3582 | control = get_unaligned_le16(skb->data); | 3580 | control = get_unaligned_le16(skb->data); |
| @@ -3602,7 +3600,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk | |||
| 3602 | else | 3600 | else |
| 3603 | pi->expected_tx_seq = tx_seq + 1; | 3601 | pi->expected_tx_seq = tx_seq + 1; |
| 3604 | 3602 | ||
| 3605 | err = l2cap_sar_reassembly_sdu(sk, skb, control); | 3603 | l2cap_sar_reassembly_sdu(sk, skb, control); |
| 3606 | 3604 | ||
| 3607 | goto done; | 3605 | goto done; |
| 3608 | 3606 | ||
