diff options
author | Mark Einon <mark.einon@gmail.com> | 2011-10-23 05:22:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-23 05:35:13 -0400 |
commit | 09a3fc2bf18ee3655d359872283cad40f40c512d (patch) | |
tree | 625df7fcfc090b1b7caf244b407dc9fff03982d8 /drivers | |
parent | 8310c602383d916fde45ed879e5a355272ec5f20 (diff) |
staging: et131x: Mainly whitespace changes to appease checkpatch
- Whitespace changes to appease checkpatch warnings
- Removed unneeded braces around single line if/else
Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/et131x/et131x.c | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 8d36da0ce9ca..98c6974da889 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c | |||
@@ -1935,8 +1935,8 @@ void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) | |||
1935 | */ | 1935 | */ |
1936 | rx_local->fbr[0]->local_full = ET_DMA10_WRAP; | 1936 | rx_local->fbr[0]->local_full = ET_DMA10_WRAP; |
1937 | writel( | 1937 | writel( |
1938 | ((rx_local->fbr[0]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, | 1938 | ((rx_local->fbr[0]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, |
1939 | &rx_dma->fbr1_min_des); | 1939 | &rx_dma->fbr1_min_des); |
1940 | 1940 | ||
1941 | #ifdef USE_FBR0 | 1941 | #ifdef USE_FBR0 |
1942 | /* Now's the best time to initialize FBR0 contents */ | 1942 | /* Now's the best time to initialize FBR0 contents */ |
@@ -1959,8 +1959,8 @@ void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) | |||
1959 | */ | 1959 | */ |
1960 | rx_local->fbr[1]->local_full = ET_DMA10_WRAP; | 1960 | rx_local->fbr[1]->local_full = ET_DMA10_WRAP; |
1961 | writel( | 1961 | writel( |
1962 | ((rx_local->fbr[1]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, | 1962 | ((rx_local->fbr[1]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1, |
1963 | &rx_dma->fbr0_min_des); | 1963 | &rx_dma->fbr0_min_des); |
1964 | #endif | 1964 | #endif |
1965 | 1965 | ||
1966 | /* Program the number of packets we will receive before generating an | 1966 | /* Program the number of packets we will receive before generating an |
@@ -2383,14 +2383,16 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
2383 | } | 2383 | } |
2384 | 2384 | ||
2385 | #ifdef USE_FBR0 | 2385 | #ifdef USE_FBR0 |
2386 | adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[1]->num_entries + | 2386 | adapter->rx_ring.psr_num_entries = |
2387 | adapter->rx_ring.fbr[0]->num_entries; | 2387 | adapter->rx_ring.fbr[1]->num_entries + |
2388 | adapter->rx_ring.fbr[0]->num_entries; | ||
2388 | #else | 2389 | #else |
2389 | adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[0]->num_entries; | 2390 | adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[0]->num_entries; |
2390 | #endif | 2391 | #endif |
2391 | 2392 | ||
2392 | /* Allocate an area of memory for Free Buffer Ring 1 */ | 2393 | /* Allocate an area of memory for Free Buffer Ring 1 */ |
2393 | bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff; | 2394 | bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + |
2395 | 0xfff; | ||
2394 | rx_ring->fbr[0]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, | 2396 | rx_ring->fbr[0]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, |
2395 | bufsize, | 2397 | bufsize, |
2396 | &rx_ring->fbr[0]->ring_physaddr, | 2398 | &rx_ring->fbr[0]->ring_physaddr, |
@@ -2421,7 +2423,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
2421 | 2423 | ||
2422 | #ifdef USE_FBR0 | 2424 | #ifdef USE_FBR0 |
2423 | /* Allocate an area of memory for Free Buffer Ring 0 */ | 2425 | /* Allocate an area of memory for Free Buffer Ring 0 */ |
2424 | bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff; | 2426 | bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + |
2427 | 0xfff; | ||
2425 | rx_ring->fbr[1]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, | 2428 | rx_ring->fbr[1]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, |
2426 | bufsize, | 2429 | bufsize, |
2427 | &rx_ring->fbr[1]->ring_physaddr, | 2430 | &rx_ring->fbr[1]->ring_physaddr, |
@@ -2471,7 +2474,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
2471 | (FBR_CHUNKS * rx_ring->fbr[0]->buffsize) + fbr1_align - 1; | 2474 | (FBR_CHUNKS * rx_ring->fbr[0]->buffsize) + fbr1_align - 1; |
2472 | rx_ring->fbr[0]->mem_virtaddrs[i] = | 2475 | rx_ring->fbr[0]->mem_virtaddrs[i] = |
2473 | dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize, | 2476 | dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize, |
2474 | &rx_ring->fbr[0]->mem_physaddrs[i], GFP_KERNEL); | 2477 | &rx_ring->fbr[0]->mem_physaddrs[i], |
2478 | GFP_KERNEL); | ||
2475 | 2479 | ||
2476 | if (!rx_ring->fbr[0]->mem_virtaddrs[i]) { | 2480 | if (!rx_ring->fbr[0]->mem_virtaddrs[i]) { |
2477 | dev_err(&adapter->pdev->dev, | 2481 | dev_err(&adapter->pdev->dev, |
@@ -2523,7 +2527,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
2523 | ((FBR_CHUNKS + 1) * rx_ring->fbr[1]->buffsize) - 1; | 2527 | ((FBR_CHUNKS + 1) * rx_ring->fbr[1]->buffsize) - 1; |
2524 | rx_ring->fbr[1]->mem_virtaddrs[i] = | 2528 | rx_ring->fbr[1]->mem_virtaddrs[i] = |
2525 | dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize, | 2529 | dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize, |
2526 | &rx_ring->fbr[1]->mem_physaddrs[i], GFP_KERNEL); | 2530 | &rx_ring->fbr[1]->mem_physaddrs[i], |
2531 | GFP_KERNEL); | ||
2527 | 2532 | ||
2528 | if (!rx_ring->fbr[1]->mem_virtaddrs[i]) { | 2533 | if (!rx_ring->fbr[1]->mem_virtaddrs[i]) { |
2529 | dev_err(&adapter->pdev->dev, | 2534 | dev_err(&adapter->pdev->dev, |
@@ -2675,10 +2680,11 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) | |||
2675 | 2680 | ||
2676 | /* Now the FIFO itself */ | 2681 | /* Now the FIFO itself */ |
2677 | rx_ring->fbr[0]->ring_virtaddr = (void *)((u8 *) | 2682 | rx_ring->fbr[0]->ring_virtaddr = (void *)((u8 *) |
2678 | rx_ring->fbr[0]->ring_virtaddr - rx_ring->fbr[0]->offset); | 2683 | rx_ring->fbr[0]->ring_virtaddr - rx_ring->fbr[0]->offset); |
2679 | 2684 | ||
2680 | bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) | 2685 | bufsize = |
2681 | + 0xfff; | 2686 | (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + |
2687 | 0xfff; | ||
2682 | 2688 | ||
2683 | dma_free_coherent(&adapter->pdev->dev, bufsize, | 2689 | dma_free_coherent(&adapter->pdev->dev, bufsize, |
2684 | rx_ring->fbr[0]->ring_virtaddr, | 2690 | rx_ring->fbr[0]->ring_virtaddr, |
@@ -2709,15 +2715,16 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) | |||
2709 | 2715 | ||
2710 | /* Now the FIFO itself */ | 2716 | /* Now the FIFO itself */ |
2711 | rx_ring->fbr[1]->ring_virtaddr = (void *)((u8 *) | 2717 | rx_ring->fbr[1]->ring_virtaddr = (void *)((u8 *) |
2712 | rx_ring->fbr[1]->ring_virtaddr - rx_ring->fbr[1]->offset); | 2718 | rx_ring->fbr[1]->ring_virtaddr - rx_ring->fbr[1]->offset); |
2713 | 2719 | ||
2714 | bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) | 2720 | bufsize = |
2715 | + 0xfff; | 2721 | (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + |
2722 | 0xfff; | ||
2716 | 2723 | ||
2717 | dma_free_coherent(&adapter->pdev->dev, | 2724 | dma_free_coherent(&adapter->pdev->dev, |
2718 | bufsize, | 2725 | bufsize, |
2719 | rx_ring->fbr[1]->ring_virtaddr, | 2726 | rx_ring->fbr[1]->ring_virtaddr, |
2720 | rx_ring->fbr[1]->ring_physaddr); | 2727 | rx_ring->fbr[1]->ring_physaddr); |
2721 | 2728 | ||
2722 | rx_ring->fbr[1]->ring_virtaddr = NULL; | 2729 | rx_ring->fbr[1]->ring_virtaddr = NULL; |
2723 | } | 2730 | } |
@@ -2857,9 +2864,9 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd) | |||
2857 | spin_lock_irqsave(&adapter->fbr_lock, flags); | 2864 | spin_lock_irqsave(&adapter->fbr_lock, flags); |
2858 | 2865 | ||
2859 | if (ring_index == 1) { | 2866 | if (ring_index == 1) { |
2860 | struct fbr_desc *next = | 2867 | struct fbr_desc *next = (struct fbr_desc *) |
2861 | (struct fbr_desc *) (rx_local->fbr[0]->ring_virtaddr) + | 2868 | (rx_local->fbr[0]->ring_virtaddr) + |
2862 | INDEX10(rx_local->fbr[0]->local_full); | 2869 | INDEX10(rx_local->fbr[0]->local_full); |
2863 | 2870 | ||
2864 | /* Handle the Free Buffer Ring advancement here. Write | 2871 | /* Handle the Free Buffer Ring advancement here. Write |
2865 | * the PA / Buffer Index for the returned buffer into | 2872 | * the PA / Buffer Index for the returned buffer into |
@@ -2869,9 +2876,10 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd) | |||
2869 | next->addr_lo = rx_local->fbr[0]->bus_low[buff_index]; | 2876 | next->addr_lo = rx_local->fbr[0]->bus_low[buff_index]; |
2870 | next->word2 = buff_index; | 2877 | next->word2 = buff_index; |
2871 | 2878 | ||
2872 | writel(bump_free_buff_ring(&rx_local->fbr[0]->local_full, | 2879 | writel(bump_free_buff_ring( |
2873 | rx_local->fbr[0]->num_entries - 1), | 2880 | &rx_local->fbr[0]->local_full, |
2874 | &rx_dma->fbr1_full_offset); | 2881 | rx_local->fbr[0]->num_entries - 1), |
2882 | &rx_dma->fbr1_full_offset); | ||
2875 | } | 2883 | } |
2876 | #ifdef USE_FBR0 | 2884 | #ifdef USE_FBR0 |
2877 | else { | 2885 | else { |
@@ -3109,8 +3117,8 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter) | |||
3109 | * 1 for FBR0 etc | 3117 | * 1 for FBR0 etc |
3110 | */ | 3118 | */ |
3111 | memcpy(skb_put(skb, rfd->len), | 3119 | memcpy(skb_put(skb, rfd->len), |
3112 | rx_local->fbr[(ring_index == 0 ? 1 : 0)]->virt[buff_index], | 3120 | rx_local->fbr[(ring_index == 0 ? 1 : 0)]->virt[buff_index], |
3113 | rfd->len); | 3121 | rfd->len); |
3114 | 3122 | ||
3115 | skb->dev = adapter->netdev; | 3123 | skb->dev = adapter->netdev; |
3116 | skb->protocol = eth_type_trans(skb, adapter->netdev); | 3124 | skb->protocol = eth_type_trans(skb, adapter->netdev); |
@@ -3212,11 +3220,13 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) | |||
3212 | */ | 3220 | */ |
3213 | desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX) + 4096 - 1; | 3221 | desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX) + 4096 - 1; |
3214 | tx_ring->tx_desc_ring = | 3222 | tx_ring->tx_desc_ring = |
3215 | (struct tx_desc *) dma_alloc_coherent(&adapter->pdev->dev, desc_size, | 3223 | (struct tx_desc *) dma_alloc_coherent(&adapter->pdev->dev, |
3216 | &tx_ring->tx_desc_ring_pa, GFP_KERNEL); | 3224 | desc_size, |
3225 | &tx_ring->tx_desc_ring_pa, | ||
3226 | GFP_KERNEL); | ||
3217 | if (!adapter->tx_ring.tx_desc_ring) { | 3227 | if (!adapter->tx_ring.tx_desc_ring) { |
3218 | dev_err(&adapter->pdev->dev, | 3228 | dev_err(&adapter->pdev->dev, |
3219 | "Cannot alloc memory for Tx Ring\n"); | 3229 | "Cannot alloc memory for Tx Ring\n"); |
3220 | return -ENOMEM; | 3230 | return -ENOMEM; |
3221 | } | 3231 | } |
3222 | 3232 | ||
@@ -4871,7 +4881,8 @@ int et131x_close(struct net_device *netdev) | |||
4871 | * | 4881 | * |
4872 | * Returns 0 on success, errno on failure (as defined in errno.h) | 4882 | * Returns 0 on success, errno on failure (as defined in errno.h) |
4873 | */ | 4883 | */ |
4874 | static int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd) | 4884 | static int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, |
4885 | int cmd) | ||
4875 | { | 4886 | { |
4876 | struct et131x_adapter *adapter = netdev_priv(netdev); | 4887 | struct et131x_adapter *adapter = netdev_priv(netdev); |
4877 | 4888 | ||
@@ -5030,7 +5041,8 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) | |||
5030 | struct et131x_adapter *adapter = netdev_priv(netdev); | 5041 | struct et131x_adapter *adapter = netdev_priv(netdev); |
5031 | 5042 | ||
5032 | /* stop the queue if it's getting full */ | 5043 | /* stop the queue if it's getting full */ |
5033 | if(adapter->tx_ring.used >= NUM_TCB - 1 && !netif_queue_stopped(netdev)) | 5044 | if (adapter->tx_ring.used >= NUM_TCB - 1 && |
5045 | !netif_queue_stopped(netdev)) | ||
5034 | netif_stop_queue(netdev); | 5046 | netif_stop_queue(netdev); |
5035 | 5047 | ||
5036 | /* Save the timestamp for the TX timeout watchdog */ | 5048 | /* Save the timestamp for the TX timeout watchdog */ |
@@ -5041,11 +5053,10 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) | |||
5041 | 5053 | ||
5042 | /* Check status and manage the netif queue if necessary */ | 5054 | /* Check status and manage the netif queue if necessary */ |
5043 | if (status != 0) { | 5055 | if (status != 0) { |
5044 | if (status == -ENOMEM) { | 5056 | if (status == -ENOMEM) |
5045 | status = NETDEV_TX_BUSY; | 5057 | status = NETDEV_TX_BUSY; |
5046 | } else { | 5058 | else |
5047 | status = NETDEV_TX_OK; | 5059 | status = NETDEV_TX_OK; |
5048 | } | ||
5049 | } | 5060 | } |
5050 | return status; | 5061 | return status; |
5051 | } | 5062 | } |