aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/micrel
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2020-05-29 00:21:41 +0200
committerDavid S. Miller <davem@davemloft.net>2020-05-28 16:30:04 -0700
commit144ad36c3d3b53045a2b3f334bd735f469cb8ea8 (patch)
treeac40dc70dc1abbf25d053ba12a505196e356e8f8 /drivers/net/ethernet/micrel
parentnet: ks8851: Split out SPI specific code from probe() and remove() (diff)
downloadlinux-dev-144ad36c3d3b53045a2b3f334bd735f469cb8ea8.tar.xz
linux-dev-144ad36c3d3b53045a2b3f334bd735f469cb8ea8.zip
net: ks8851: Factor out TX work flush function
While the SPI version of the KS8851 requires a TX worker thread to pump data via SPI, the parallel bus version can write data into the TX FIFO directly in .ndo_start_xmit, as the parallel bus access is much faster and does not sleep. Factor out this TX work flush part, so it can be overridden by the parallel bus driver. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Marek Vasut <marex@denx.de> Cc: David S. Miller <davem@davemloft.net> Cc: Lukas Wunner <lukas@wunner.de> Cc: Petr Stetiar <ynezz@true.cz> Cc: YueHaibing <yuehaibing@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/micrel')
-rw-r--r--drivers/net/ethernet/micrel/ks8851.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index 4283ba5bee81..458c86903ac0 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -782,6 +782,17 @@ static void ks8851_tx_work(struct work_struct *work)
}
/**
+ * ks8851_flush_tx_work - flush outstanding TX work
+ * @ks: The device state
+ */
+static void ks8851_flush_tx_work(struct ks8851_net *ks)
+{
+ struct ks8851_net_spi *kss = to_ks8851_spi(ks);
+
+ flush_work(&kss->tx_work);
+}
+
+/**
* ks8851_net_open - open network device
* @dev: The network device being opened.
*
@@ -880,11 +891,8 @@ static int ks8851_net_open(struct net_device *dev)
static int ks8851_net_stop(struct net_device *dev)
{
struct ks8851_net *ks = netdev_priv(dev);
- struct ks8851_net_spi *kss;
unsigned long flags;
- kss = to_ks8851_spi(ks);
-
netif_info(ks, ifdown, dev, "shutting down\n");
netif_stop_queue(dev);
@@ -896,7 +904,7 @@ static int ks8851_net_stop(struct net_device *dev)
ks8851_unlock(ks, &flags);
/* stop any outstanding work */
- flush_work(&kss->tx_work);
+ ks8851_flush_tx_work(ks);
flush_work(&ks->rxctrl_work);
ks8851_lock(ks, &flags);