diff options
Diffstat (limited to 'drivers/net/ethernet/micrel/ksz884x.c')
-rw-r--r-- | drivers/net/ethernet/micrel/ksz884x.c | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index bb646b65cc95..9ed264ed7070 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -/** +/* * drivers/net/ethernet/micrel/ksx884x.c - Micrel KSZ8841/2 PCI Ethernet driver * * Copyright (c) 2009-2010 Micrel, Inc. @@ -959,7 +959,7 @@ struct ksz_sw_desc { * struct ksz_dma_buf - OS dependent DMA buffer data structure * @skb: Associated socket buffer. * @dma: Associated physical DMA address. - * len: Actual len used. + * @len: Actual len used. */ struct ksz_dma_buf { struct sk_buff *skb; @@ -1254,6 +1254,7 @@ struct ksz_port_info { * @multi_list_size: Multicast address list size. * @enabled: Indication of hardware enabled. * @rx_stop: Indication of receive process stop. + * @reserved2: none * @features: Hardware features to enable. * @overrides: Hardware features to override. * @parent: Pointer to parent, network device private structure. @@ -1447,7 +1448,7 @@ struct dev_info { * struct dev_priv - Network device private data structure * @adapter: Adapter device information. * @port: Port information. - * @monitor_time_info: Timer to monitor ports. + * @monitor_timer_info: Timer to monitor ports. * @proc_sem: Semaphore for proc accessing. * @id: Device ID. * @mii_if: MII interface information. @@ -1566,6 +1567,7 @@ static inline void hw_restore_intr(struct ksz_hw *hw, uint interrupt) /** * hw_block_intr - block hardware interrupts + * @hw: The hardware instance. * * This function blocks all interrupts of the hardware and returns the current * interrupt enable mask so that interrupts can be restored later. @@ -1649,8 +1651,7 @@ static inline void set_tx_len(struct ksz_desc *desc, u32 len) #define HW_DELAY(hw, reg) \ do { \ - u16 dummy; \ - dummy = readw(hw->io + reg); \ + readw(hw->io + reg); \ } while (0) /** @@ -1819,6 +1820,7 @@ static void port_r_mib_cnt(struct ksz_hw *hw, int port, u16 addr, u64 *cnt) * port_r_mib_pkt - read dropped packet counts * @hw: The hardware instance. * @port: The port index. + * @last: last one * @cnt: Buffer to store the receive and transmit dropped packet counts. * * This routine reads the dropped packet counts of the port. @@ -1972,7 +1974,7 @@ static void port_cfg(struct ksz_hw *hw, int port, int offset, u16 bits, * port_chk_shift - check port bit * @hw: The hardware instance. * @port: The port index. - * @offset: The offset of the register. + * @addr: The offset of the register. * @shift: Number of bits to shift. * * This function checks whether the specified port is set in the register or @@ -1994,7 +1996,7 @@ static int port_chk_shift(struct ksz_hw *hw, int port, u32 addr, int shift) * port_cfg_shift - set port bit * @hw: The hardware instance. * @port: The port index. - * @offset: The offset of the register. + * @addr: The offset of the register. * @shift: Number of bits to shift. * @set: The flag indicating whether the port is to be set or not. * @@ -4425,6 +4427,8 @@ static int ksz_alloc_desc(struct dev_info *adapter) /** * free_dma_buf - release DMA buffer resources * @adapter: Adapter information structure. + * @dma_buf: pointer to buf + * @direction: to or from device * * This routine is just a helper function to release the DMA buffer resources. */ @@ -4562,6 +4566,7 @@ static void ksz_free_desc(struct dev_info *adapter) * ksz_free_buffers - free buffers used in the descriptors * @adapter: Adapter information structure. * @desc_info: Descriptor information structure. + * @direction: to or from device * * This local routine frees buffers used in the DMA buffers. */ @@ -4721,7 +4726,8 @@ static void send_packet(struct sk_buff *skb, struct net_device *dev) /** * transmit_cleanup - clean up transmit descriptors - * @dev: Network device. + * @hw_priv: Network device. + * @normal: break if owned * * This routine is called to clean up the transmitted buffers. */ @@ -4777,7 +4783,7 @@ static void transmit_cleanup(struct dev_info *hw_priv, int normal) /** * transmit_done - transmit done processing - * @dev: Network device. + * @hw_priv: Network device. * * This routine is called when the transmit interrupt is triggered, indicating * either a packet is sent successfully or there are transmit errors. @@ -4883,6 +4889,7 @@ unlock: /** * netdev_tx_timeout - transmit timeout processing * @dev: Network device. + * @txqueue: index of hanging queue * * This routine is called when the transmit timer expires. That indicates the * hardware is not running correctly because transmit interrupts are not @@ -4978,7 +4985,6 @@ static inline int rx_proc(struct net_device *dev, struct ksz_hw* hw, struct dev_info *hw_priv = priv->adapter; struct ksz_dma_buf *dma_buf; struct sk_buff *skb; - int rx_status; /* Received length includes 4-byte CRC. */ packet_len = status.rx.frame_len - 4; @@ -5014,7 +5020,7 @@ static inline int rx_proc(struct net_device *dev, struct ksz_hw* hw, dev->stats.rx_bytes += packet_len; /* Notify upper layer for received packet. */ - rx_status = netif_rx(skb); + netif_rx(skb); return 0; } @@ -5159,9 +5165,9 @@ release_packet: return received; } -static void rx_proc_task(unsigned long data) +static void rx_proc_task(struct tasklet_struct *t) { - struct dev_info *hw_priv = (struct dev_info *) data; + struct dev_info *hw_priv = from_tasklet(hw_priv, t, rx_tasklet); struct ksz_hw *hw = &hw_priv->hw; if (!hw->enabled) @@ -5181,9 +5187,9 @@ static void rx_proc_task(unsigned long data) } } -static void tx_proc_task(unsigned long data) +static void tx_proc_task(struct tasklet_struct *t) { - struct dev_info *hw_priv = (struct dev_info *) data; + struct dev_info *hw_priv = from_tasklet(hw_priv, t, tx_tasklet); struct ksz_hw *hw = &hw_priv->hw; hw_ack_intr(hw, KS884X_INT_TX_MASK); @@ -5436,10 +5442,8 @@ static int prepare_hardware(struct net_device *dev) rc = request_irq(dev->irq, netdev_intr, IRQF_SHARED, dev->name, dev); if (rc) return rc; - tasklet_init(&hw_priv->rx_tasklet, rx_proc_task, - (unsigned long) hw_priv); - tasklet_init(&hw_priv->tx_tasklet, tx_proc_task, - (unsigned long) hw_priv); + tasklet_setup(&hw_priv->rx_tasklet, rx_proc_task); + tasklet_setup(&hw_priv->tx_tasklet, tx_proc_task); hw->promiscuous = 0; hw->all_multi = 0; @@ -5829,8 +5833,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /* Get address of MII PHY in use. */ case SIOCGMIIPHY: data->phy_id = priv->id; - - /* Fallthrough... */ + fallthrough; /* Read MII PHY register. */ case SIOCGMIIREG: @@ -6078,14 +6081,6 @@ static void netdev_get_drvinfo(struct net_device *dev, sizeof(info->bus_info)); } -/** - * netdev_get_regs_len - get length of register dump - * @dev: Network device. - * - * This function returns the length of the register dump. - * - * Return length of the register dump. - */ static struct hw_regs { int start; int end; @@ -6099,6 +6094,14 @@ static struct hw_regs { { 0, 0 } }; +/** + * netdev_get_regs_len - get length of register dump + * @dev: Network device. + * + * This function returns the length of the register dump. + * + * Return length of the register dump. + */ static int netdev_get_regs_len(struct net_device *dev) { struct hw_regs *range = hw_regs_range; @@ -6240,6 +6243,8 @@ static int netdev_get_eeprom_len(struct net_device *dev) return EEPROM_SIZE * 2; } +#define EEPROM_MAGIC 0x10A18842 + /** * netdev_get_eeprom - get EEPROM data * @dev: Network device. @@ -6250,8 +6255,6 @@ static int netdev_get_eeprom_len(struct net_device *dev) * * Return 0 if successful; otherwise an error code. */ -#define EEPROM_MAGIC 0x10A18842 - static int netdev_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data) { @@ -6388,7 +6391,7 @@ static int netdev_set_pauseparam(struct net_device *dev, /** * netdev_get_ringparam - get tx/rx ring parameters * @dev: Network device. - * @pause: Ethtool RING settings data structure. + * @ring: Ethtool RING settings data structure. * * This procedure returns the TX/RX ring settings. */ @@ -6509,7 +6512,6 @@ static void netdev_get_ethtool_stats(struct net_device *dev, int i; int n; int p; - int rc; u64 counter[TOTAL_PORT_COUNTER_NUM]; mutex_lock(&hw_priv->lock); @@ -6530,19 +6532,19 @@ static void netdev_get_ethtool_stats(struct net_device *dev, if (1 == port->mib_port_cnt && n < SWITCH_PORT_NUM) { p = n; - rc = wait_event_interruptible_timeout( + wait_event_interruptible_timeout( hw_priv->counter[p].counter, 2 == hw_priv->counter[p].read, HZ * 1); } else for (i = 0, p = n; i < port->mib_port_cnt - n; i++, p++) { if (0 == i) { - rc = wait_event_interruptible_timeout( + wait_event_interruptible_timeout( hw_priv->counter[p].counter, 2 == hw_priv->counter[p].read, HZ * 2); } else if (hw->port_mib[p].cnt_ptr) { - rc = wait_event_interruptible_timeout( + wait_event_interruptible_timeout( hw_priv->counter[p].counter, 2 == hw_priv->counter[p].read, HZ * 1); @@ -6693,7 +6695,7 @@ static void mib_monitor(struct timer_list *t) /** * dev_monitor - periodic monitoring - * @ptr: Network device pointer. + * @t: timer list containing a network device pointer. * * This routine is run in a kernel timer to monitor the network device. */ |