diff options
author | Joe Perches <joe@perches.com> | 2010-11-30 15:19:11 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-12-02 15:16:42 -0500 |
commit | 44b23b488d44e56d467764ecb661830e5b02b308 (patch) | |
tree | 7b88e233916b01efcbf59d1ccc8f3cbcb6bacfaa /drivers/net/wireless/ath/ath9k/hif_usb.c | |
parent | eb272441fc14ad126abfa46de8a9c58bda8added (diff) |
ath9k: hif_usb: Reduce indent 1 column
Invert test and return early.
Move variable declarations to local scope.
Don't initialize variables to 0 unnecessarily.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/hif_usb.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hif_usb.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index ae842dbf9b50..63bf9a713ce0 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -363,9 +363,9 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, | |||
363 | struct sk_buff *skb) | 363 | struct sk_buff *skb) |
364 | { | 364 | { |
365 | struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER]; | 365 | struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER]; |
366 | int index = 0, i = 0, chk_idx, len = skb->len; | 366 | int index = 0, i = 0, len = skb->len; |
367 | int rx_remain_len = 0, rx_pkt_len = 0; | 367 | int rx_remain_len, rx_pkt_len; |
368 | u16 pkt_len, pkt_tag, pool_index = 0; | 368 | u16 pool_index = 0; |
369 | u8 *ptr; | 369 | u8 *ptr; |
370 | 370 | ||
371 | spin_lock(&hif_dev->rx_lock); | 371 | spin_lock(&hif_dev->rx_lock); |
@@ -399,64 +399,64 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, | |||
399 | spin_unlock(&hif_dev->rx_lock); | 399 | spin_unlock(&hif_dev->rx_lock); |
400 | 400 | ||
401 | while (index < len) { | 401 | while (index < len) { |
402 | u16 pkt_len; | ||
403 | u16 pkt_tag; | ||
404 | u16 pad_len; | ||
405 | int chk_idx; | ||
406 | |||
402 | ptr = (u8 *) skb->data; | 407 | ptr = (u8 *) skb->data; |
403 | 408 | ||
404 | pkt_len = ptr[index] + (ptr[index+1] << 8); | 409 | pkt_len = ptr[index] + (ptr[index+1] << 8); |
405 | pkt_tag = ptr[index+2] + (ptr[index+3] << 8); | 410 | pkt_tag = ptr[index+2] + (ptr[index+3] << 8); |
406 | 411 | ||
407 | if (pkt_tag == ATH_USB_RX_STREAM_MODE_TAG) { | 412 | if (pkt_tag != ATH_USB_RX_STREAM_MODE_TAG) { |
408 | u16 pad_len; | 413 | RX_STAT_INC(skb_dropped); |
409 | 414 | return; | |
410 | pad_len = 4 - (pkt_len & 0x3); | 415 | } |
411 | if (pad_len == 4) | 416 | |
412 | pad_len = 0; | 417 | pad_len = 4 - (pkt_len & 0x3); |
413 | 418 | if (pad_len == 4) | |
414 | chk_idx = index; | 419 | pad_len = 0; |
415 | index = index + 4 + pkt_len + pad_len; | 420 | |
416 | 421 | chk_idx = index; | |
417 | if (index > MAX_RX_BUF_SIZE) { | 422 | index = index + 4 + pkt_len + pad_len; |
418 | spin_lock(&hif_dev->rx_lock); | 423 | |
419 | hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE; | 424 | if (index > MAX_RX_BUF_SIZE) { |
420 | hif_dev->rx_transfer_len = | 425 | spin_lock(&hif_dev->rx_lock); |
421 | MAX_RX_BUF_SIZE - chk_idx - 4; | 426 | hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE; |
422 | hif_dev->rx_pad_len = pad_len; | 427 | hif_dev->rx_transfer_len = |
423 | 428 | MAX_RX_BUF_SIZE - chk_idx - 4; | |
424 | nskb = __dev_alloc_skb(pkt_len + 32, | 429 | hif_dev->rx_pad_len = pad_len; |
425 | GFP_ATOMIC); | 430 | |
426 | if (!nskb) { | 431 | nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); |
427 | dev_err(&hif_dev->udev->dev, | 432 | if (!nskb) { |
428 | "ath9k_htc: RX memory allocation" | 433 | dev_err(&hif_dev->udev->dev, |
429 | " error\n"); | 434 | "ath9k_htc: RX memory allocation error\n"); |
430 | spin_unlock(&hif_dev->rx_lock); | ||
431 | goto err; | ||
432 | } | ||
433 | skb_reserve(nskb, 32); | ||
434 | RX_STAT_INC(skb_allocated); | ||
435 | |||
436 | memcpy(nskb->data, &(skb->data[chk_idx+4]), | ||
437 | hif_dev->rx_transfer_len); | ||
438 | |||
439 | /* Record the buffer pointer */ | ||
440 | hif_dev->remain_skb = nskb; | ||
441 | spin_unlock(&hif_dev->rx_lock); | 435 | spin_unlock(&hif_dev->rx_lock); |
442 | } else { | 436 | goto err; |
443 | nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); | ||
444 | if (!nskb) { | ||
445 | dev_err(&hif_dev->udev->dev, | ||
446 | "ath9k_htc: RX memory allocation" | ||
447 | " error\n"); | ||
448 | goto err; | ||
449 | } | ||
450 | skb_reserve(nskb, 32); | ||
451 | RX_STAT_INC(skb_allocated); | ||
452 | |||
453 | memcpy(nskb->data, &(skb->data[chk_idx+4]), pkt_len); | ||
454 | skb_put(nskb, pkt_len); | ||
455 | skb_pool[pool_index++] = nskb; | ||
456 | } | 437 | } |
438 | skb_reserve(nskb, 32); | ||
439 | RX_STAT_INC(skb_allocated); | ||
440 | |||
441 | memcpy(nskb->data, &(skb->data[chk_idx+4]), | ||
442 | hif_dev->rx_transfer_len); | ||
443 | |||
444 | /* Record the buffer pointer */ | ||
445 | hif_dev->remain_skb = nskb; | ||
446 | spin_unlock(&hif_dev->rx_lock); | ||
457 | } else { | 447 | } else { |
458 | RX_STAT_INC(skb_dropped); | 448 | nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); |
459 | return; | 449 | if (!nskb) { |
450 | dev_err(&hif_dev->udev->dev, | ||
451 | "ath9k_htc: RX memory allocation error\n"); | ||
452 | goto err; | ||
453 | } | ||
454 | skb_reserve(nskb, 32); | ||
455 | RX_STAT_INC(skb_allocated); | ||
456 | |||
457 | memcpy(nskb->data, &(skb->data[chk_idx+4]), pkt_len); | ||
458 | skb_put(nskb, pkt_len); | ||
459 | skb_pool[pool_index++] = nskb; | ||
460 | } | 460 | } |
461 | } | 461 | } |
462 | 462 | ||