Ignoring checkpatch for some lines - now just over 80 chars, but much more readable. Signed-off-by: Mark Einon <mark.einon@xxxxxxxxx> --- drivers/staging/et131x/et131x.c | 120 +++++++++++++-------------------------- 1 file changed, 40 insertions(+), 80 deletions(-) diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index a8f7cd7..55a6d59 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -872,8 +872,8 @@ static void et131x_tx_dma_enable(struct et131x_adapter *adapter) /* Setup the transmit dma configuration register for normal * operation */ - writel(ET_TXDMA_SNGL_EPKT|(PARM_DMA_CACHE_DEF << ET_TXDMA_CACHE_SHIFT), - &adapter->regs->txdma.csr); + writel(ET_TXDMA_SNGL_EPKT | (PARM_DMA_CACHE_DEF << ET_TXDMA_CACHE_SHIFT), + &adapter->regs->txdma.csr); } static inline void add_10bit(u32 *v, int n) @@ -978,12 +978,10 @@ static void et1310_config_mac_regs2(struct et131x_adapter *adapter) } /* We need to enable Rx/Tx */ - cfg1 |= ET_MAC_CFG1_RX_ENABLE | ET_MAC_CFG1_TX_ENABLE | - ET_MAC_CFG1_TX_FLOW; + cfg1 |= ET_MAC_CFG1_RX_ENABLE | ET_MAC_CFG1_TX_ENABLE | ET_MAC_CFG1_TX_FLOW; /* Initialize loop back to off */ cfg1 &= ~(ET_MAC_CFG1_LOOPBACK | ET_MAC_CFG1_RX_FLOW); - if (adapter->flowcontrol == FLOW_RXONLY || - adapter->flowcontrol == FLOW_BOTH) + if (adapter->flowcontrol == FLOW_RXONLY || adapter->flowcontrol == FLOW_BOTH) cfg1 |= ET_MAC_CFG1_RX_FLOW; writel(cfg1, &mac->cfg1); @@ -1807,8 +1805,7 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) writel(0, &rx_dma->psr_full_offset); psr_num_des = readl(&rx_dma->psr_num_des) & ET_RXDMA_PSR_NUM_DES_MASK; - writel((psr_num_des * LO_MARK_PERCENT_FOR_PSR) / 100, - &rx_dma->psr_min_des); + writel((psr_num_des * LO_MARK_PERCENT_FOR_PSR) / 100, &rx_dma->psr_min_des); spin_lock_irqsave(&adapter->rcv_lock, flags); @@ -1837,10 +1834,8 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) } /* Now's the best time to initialize FBR contents */ - fbr_entry = - (struct fbr_desc *) rx_local->fbr[id]->ring_virtaddr; - for (entry = 0; - entry < rx_local->fbr[id]->num_entries; entry++) { + fbr_entry = (struct fbr_desc *) rx_local->fbr[id]->ring_virtaddr; + for (entry = 0; entry < rx_local->fbr[id]->num_entries; entry++) { fbr_entry->addr_hi = rx_local->fbr[id]->bus_high[entry]; fbr_entry->addr_lo = rx_local->fbr[id]->bus_low[entry]; fbr_entry->word2 = entry; @@ -1850,10 +1845,8 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) /* Set the address and parameters of Free buffer ring 1 and 0 * into the 1310's registers */ - writel(upper_32_bits(rx_local->fbr[id]->ring_physaddr), - base_hi); - writel(lower_32_bits(rx_local->fbr[id]->ring_physaddr), - base_lo); + writel(upper_32_bits(rx_local->fbr[id]->ring_physaddr), base_hi); + writel(lower_32_bits(rx_local->fbr[id]->ring_physaddr), base_lo); writel(rx_local->fbr[id]->num_entries - 1, num_des); writel(ET_DMA10_WRAP, full_offset); @@ -1862,8 +1855,7 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) */ rx_local->fbr[id]->local_full = ET_DMA10_WRAP; writel(((rx_local->fbr[id]->num_entries * - LO_MARK_PERCENT_FOR_RX) / 100) - 1, - min_des); + LO_MARK_PERCENT_FOR_RX) / 100) - 1, min_des); } /* Program the number of packets we will receive before generating an @@ -1894,19 +1886,15 @@ static void et131x_config_tx_dma_regs(struct et131x_adapter *adapter) struct txdma_regs __iomem *txdma = &adapter->regs->txdma; /* Load the hardware with the start of the transmit descriptor ring. */ - writel(upper_32_bits(adapter->tx_ring.tx_desc_ring_pa), - &txdma->pr_base_hi); - writel(lower_32_bits(adapter->tx_ring.tx_desc_ring_pa), - &txdma->pr_base_lo); + writel(upper_32_bits(adapter->tx_ring.tx_desc_ring_pa), &txdma->pr_base_hi); + writel(lower_32_bits(adapter->tx_ring.tx_desc_ring_pa), &txdma->pr_base_lo); /* Initialise the transmit DMA engine */ writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des); /* Load the completion writeback physical address */ - writel(upper_32_bits(adapter->tx_ring.tx_status_pa), - &txdma->dma_wb_base_hi); - writel(lower_32_bits(adapter->tx_ring.tx_status_pa), - &txdma->dma_wb_base_lo); + writel(upper_32_bits(adapter->tx_ring.tx_status_pa), &txdma->dma_wb_base_hi); + writel(lower_32_bits(adapter->tx_ring.tx_status_pa), &txdma->dma_wb_base_lo); *adapter->tx_ring.tx_status = 0; @@ -1975,8 +1963,7 @@ static void et131x_enable_interrupts(struct et131x_adapter *adapter) u32 mask; /* Enable all global interrupts */ - if (adapter->flowcontrol == FLOW_TXONLY || - adapter->flowcontrol == FLOW_BOTH) + if (adapter->flowcontrol == FLOW_TXONLY || adapter->flowcontrol == FLOW_BOTH) mask = INT_MASK_ENABLE; else mask = INT_MASK_ENABLE_NO_FLOW; @@ -2001,8 +1988,7 @@ static void et131x_disable_interrupts(struct et131x_adapter *adapter) static void et131x_tx_dma_disable(struct et131x_adapter *adapter) { /* Setup the tramsmit dma configuration register */ - writel(ET_TXDMA_CSR_HALT | ET_TXDMA_SNGL_EPKT, - &adapter->regs->txdma.csr); + writel(ET_TXDMA_CSR_HALT | ET_TXDMA_SNGL_EPKT, &adapter->regs->txdma.csr); } /* et131x_enable_txrx - Enable tx/rx queues @@ -2061,9 +2047,7 @@ static void et131x_init_send(struct et131x_adapter *adapter) /* Go through and set up each TCB */ for (ct = 0; ct++ < NUM_TCB; tcb++) - /* Set the link pointer in HW TCB to the next TCB in the - * chain - */ + /* Set the HW TCB link pointer to the next TCB in the chain */ tcb->next = tcb + 1; /* Set the tail pointer */ @@ -2116,7 +2100,6 @@ static void et1310_enable_phy_coma(struct et131x_adapter *adapter) spin_unlock_irqrestore(&adapter->send_hw_lock, flags); /* Wait for outstanding Receive packets */ - et131x_disable_txrx(adapter->netdev); /* Gate off JAGCore 3 clock domains */ @@ -2133,9 +2116,7 @@ static void et1310_enable_phy_coma(struct et131x_adapter *adapter) */ static void et1310_disable_phy_coma(struct et131x_adapter *adapter) { - u32 pmcsr; - - pmcsr = readl(&adapter->regs->global.pm_csr); + u32 pmcsr = readl(&adapter->regs->global.pm_csr); /* Disable phy_sw_coma register and re-enable JAGCore clocks */ pmcsr |= ET_PMCSR_INIT; @@ -2253,8 +2234,7 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) for (id = 0; id < NUM_FBRS; id++) { /* Allocate an area of memory for Free Buffer Ring */ - bufsize = - (sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries); + bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries); rx_ring->fbr[id]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, bufsize, @@ -2270,8 +2250,7 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) for (id = 0; id < NUM_FBRS; id++) { fbr_chunksize = (FBR_CHUNKS * rx_ring->fbr[id]->buffsize); - for (i = 0; - i < (rx_ring->fbr[id]->num_entries / FBR_CHUNKS); i++) { + for (i = 0; i < (rx_ring->fbr[id]->num_entries / FBR_CHUNKS); i++) { dma_addr_t fbr_tmp_physaddr; rx_ring->fbr[id]->mem_virtaddrs[i] = dma_alloc_coherent( @@ -2391,11 +2370,9 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) index < (rx_ring->fbr[id]->num_entries / FBR_CHUNKS); index++) { if (rx_ring->fbr[id]->mem_virtaddrs[index]) { - bufsize = - rx_ring->fbr[id]->buffsize * FBR_CHUNKS; + bufsize = rx_ring->fbr[id]->buffsize * FBR_CHUNKS; - dma_free_coherent(&adapter->pdev->dev, - bufsize, + dma_free_coherent(&adapter->pdev->dev, bufsize, rx_ring->fbr[id]->mem_virtaddrs[index], rx_ring->fbr[id]->mem_physaddrs[index]); @@ -2403,8 +2380,7 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) } } - bufsize = - sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries; + bufsize = sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries; dma_free_coherent(&adapter->pdev->dev, bufsize, rx_ring->fbr[id]->ring_virtaddr, @@ -2535,7 +2511,7 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd) writel(bump_free_buff_ring( &rx_local->fbr[ring_index]->local_full, rx_local->fbr[ring_index]->num_entries - 1), - offset); + offset); spin_unlock_irqrestore(&adapter->fbr_lock, flags); } else { @@ -2607,8 +2583,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter) /* Indicate that we have used this PSR entry. */ /* FIXME wrap 12 */ add_12bit(&rx_local->local_psr_full, 1); - if ( - (rx_local->local_psr_full & 0xFFF) > rx_local->psr_num_entries - 1) { + if ((rx_local->local_psr_full & 0xFFF) > rx_local->psr_num_entries - 1) { /* Clear psr full and toggle the wrap bit */ rx_local->local_psr_full &= ~0xFFF; rx_local->local_psr_full ^= 0x1000; @@ -2659,8 +2634,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter) } /* Determine if this is a multicast packet coming in */ - if ((word0 & ALCATEL_MULTICAST_PKT) && - !(word0 & ALCATEL_BROADCAST_PKT)) { + if ((word0 & ALCATEL_MULTICAST_PKT) && !(word0 & ALCATEL_BROADCAST_PKT)) { /* Promiscuous mode and Multicast mode are not mutually * exclusive as was first thought. I guess Promiscuous is just * considered a super-set of the other filters. Generally filter @@ -2668,8 +2642,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter) */ if ((adapter->packet_filter & ET131X_PACKET_TYPE_MULTICAST) && !(adapter->packet_filter & ET131X_PACKET_TYPE_PROMISCUOUS) - && !(adapter->packet_filter & - ET131X_PACKET_TYPE_ALL_MULTICAST)) { + && !(adapter->packet_filter & ET131X_PACKET_TYPE_ALL_MULTICAST)) { buf = rx_local->fbr[ring_index]->virt[buff_index]; /* Loop through our list to see if the destination @@ -2819,8 +2792,7 @@ static int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) &tx_ring->tx_desc_ring_pa, GFP_KERNEL); if (!adapter->tx_ring.tx_desc_ring) { - dev_err(&adapter->pdev->dev, - "Cannot alloc memory for Tx Ring\n"); + dev_err(&adapter->pdev->dev, "Cannot alloc memory for Tx Ring\n"); return -ENOMEM; } @@ -3040,8 +3012,7 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb) spin_unlock(&adapter->tcb_send_qlock); /* Write the new write pointer back to the device. */ - writel(adapter->tx_ring.send_idx, - &adapter->regs->txdma.service_request); + writel(adapter->tx_ring.send_idx, &adapter->regs->txdma.service_request); /* For Gig only, we use Tx Interrupt coalescing. Enable the software * timer to wake us up if this packet isn't followed by N more. @@ -3205,8 +3176,7 @@ static inline void free_send_packet(struct et131x_adapter *adapter, * they point to */ do { - desc = (struct tx_desc *) - (adapter->tx_ring.tx_desc_ring + + desc = (struct tx_desc *) (adapter->tx_ring.tx_desc_ring + INDEX10(tcb->index_start)); dma_addr = desc->addr_lo; @@ -3217,8 +3187,7 @@ static inline void free_send_packet(struct et131x_adapter *adapter, desc->len_vlan, DMA_TO_DEVICE); add_10bit(&tcb->index_start, 1); - if (INDEX10(tcb->index_start) >= - NUM_DESC_PER_RING_TX) { + if (INDEX10(tcb->index_start) >= NUM_DESC_PER_RING_TX) { tcb->index_start &= ~ET_DMA10_MASK; tcb->index_start ^= ET_DMA10_WRAP; } @@ -3536,8 +3505,7 @@ static void et131x_get_drvinfo(struct net_device *netdev, strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); strlcpy(info->version, DRIVER_VERSION, sizeof(info->version)); - strlcpy(info->bus_info, pci_name(adapter->pdev), - sizeof(info->bus_info)); + strlcpy(info->bus_info, pci_name(adapter->pdev), sizeof(info->bus_info)); } static struct ethtool_ops et131x_ethtool_ops = { @@ -3568,15 +3536,13 @@ static void et131x_hwaddr_init(struct et131x_adapter *adapter) * working with so we need to copy the current * address into the permanent address */ - memcpy(adapter->rom_addr, - adapter->addr, ETH_ALEN); + memcpy(adapter->rom_addr, adapter->addr, ETH_ALEN); } else { /* We do not have an override address, so set the * current address to the permanent address and add * it to the device */ - memcpy(adapter->addr, - adapter->rom_addr, ETH_ALEN); + memcpy(adapter->addr, adapter->rom_addr, ETH_ALEN); } } @@ -3737,15 +3703,13 @@ static int et131x_adapter_memory_alloc(struct et131x_adapter *adapter) /* Allocate memory for the Tx Ring */ status = et131x_tx_dma_memory_alloc(adapter); if (status != 0) { - dev_err(&adapter->pdev->dev, - "et131x_tx_dma_memory_alloc FAILED\n"); + dev_err(&adapter->pdev->dev, "et131x_tx_dma_memory_alloc FAILED\n"); return status; } /* Receive buffer memory allocation */ status = et131x_rx_dma_memory_alloc(adapter); if (status != 0) { - dev_err(&adapter->pdev->dev, - "et131x_rx_dma_memory_alloc FAILED\n"); + dev_err(&adapter->pdev->dev, "et131x_rx_dma_memory_alloc FAILED\n"); et131x_tx_dma_memory_free(adapter); return status; } @@ -3753,8 +3717,7 @@ static int et131x_adapter_memory_alloc(struct et131x_adapter *adapter) /* Init receive data structures */ status = et131x_init_recv(adapter); if (status) { - dev_err(&adapter->pdev->dev, - "et131x_init_recv FAILED\n"); + dev_err(&adapter->pdev->dev, "et131x_init_recv FAILED\n"); et131x_adapter_memory_free(adapter); } return status; @@ -4550,8 +4513,7 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) struct et131x_adapter *adapter = netdev_priv(netdev); /* stop the queue if it's getting full */ - if (adapter->tx_ring.used >= NUM_TCB - 1 && - !netif_queue_stopped(netdev)) + if (adapter->tx_ring.used >= NUM_TCB - 1 && !netif_queue_stopped(netdev)) netif_stop_queue(netdev); /* Save the timestamp for the TX timeout watchdog */ @@ -4608,8 +4570,7 @@ static void et131x_tx_timeout(struct net_device *netdev) tcb->count++; if (tcb->count > NIC_SEND_HANG_THRESHOLD) { - spin_unlock_irqrestore(&adapter->tcb_send_qlock, - flags); + spin_unlock_irqrestore(&adapter->tcb_send_qlock, flags); dev_warn(&adapter->pdev->dev, "Send stuck - reset. tcb->WrIndex %x, flags 0x%08x\n", @@ -4710,8 +4671,7 @@ static int et131x_set_mac_addr(struct net_device *netdev, void *new_mac) memcpy(netdev->dev_addr, address->sa_data, netdev->addr_len); - netdev_info(netdev, "Setting MAC address to %pM\n", - netdev->dev_addr); + netdev_info(netdev, "Setting MAC address to %pM\n", netdev->dev_addr); /* Free Rx DMA memory */ et131x_adapter_memory_free(adapter); -- 1.7.10.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel