Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36cdc743 authored by Russell King's avatar Russell King Committed by David S. Miller
Browse files

net: fec: replace delayed work with standard work



As of "better implementation of iMX6 ERR006358 quirk", we no longer have
a requirement for a delayed work.  Moreover, the work is now only used
for timeout purposes, so the timeout flag is also pointless - we set it
each time we queue the work, and the work clears it.

Replace the fec_enet_delayed_work struct with a standard work_struct,
resulting in simplified timeout handling code.

Acked-by: default avatarFugang Duan <B38611@freescale.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ccea2968
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -256,11 +256,6 @@ struct bufdesc_ex {
#define FLAG_RX_CSUM_ENABLED	(BD_ENET_RX_ICE | BD_ENET_RX_PCR)
#define FLAG_RX_CSUM_ERROR	(BD_ENET_RX_ICE | BD_ENET_RX_PCR)

struct fec_enet_delayed_work {
	struct delayed_work delay_work;
	bool timeout;
};

/* The FEC buffer descriptors track the ring buffers.  The rx_bd_base and
 * tx_bd_base always point to the base of the buffer descriptors.  The
 * cur_rx and cur_tx point to the currently available buffer.
@@ -326,6 +321,8 @@ struct fec_enet_private {
	struct	napi_struct napi;
	int	csum_flags;

	struct work_struct tx_timeout_work;

	struct ptp_clock *ptp_clock;
	struct ptp_clock_info ptp_caps;
	unsigned long last_overflow_check;
@@ -338,7 +335,6 @@ struct fec_enet_private {
	int hwts_rx_en;
	int hwts_tx_en;
	struct timer_list time_keep;
	struct fec_enet_delayed_work delay_work;
	struct regulator *reg_phy;
};

+14 −20
Original line number Diff line number Diff line
@@ -1020,20 +1020,15 @@ fec_timeout(struct net_device *ndev)

	ndev->stats.tx_errors++;

	fep->delay_work.timeout = true;
	schedule_delayed_work(&(fep->delay_work.delay_work), 0);
	schedule_work(&fep->tx_timeout_work);
}

static void fec_enet_work(struct work_struct *work)
static void fec_enet_timeout_work(struct work_struct *work)
{
	struct fec_enet_private *fep =
		container_of(work,
			     struct fec_enet_private,
			     delay_work.delay_work.work);
		container_of(work, struct fec_enet_private, tx_timeout_work);
	struct net_device *ndev = fep->netdev;

	if (fep->delay_work.timeout) {
		fep->delay_work.timeout = false;
	rtnl_lock();
	if (netif_device_present(ndev) || netif_running(ndev)) {
		napi_disable(&fep->napi);
@@ -1045,7 +1040,6 @@ static void fec_enet_work(struct work_struct *work)
	}
	rtnl_unlock();
}
}

static void
fec_enet_tx(struct net_device *ndev)
@@ -2642,7 +2636,7 @@ fec_probe(struct platform_device *pdev)
	if (fep->bufdesc_ex && fep->ptp_clock)
		netdev_info(ndev, "registered PHC device %d\n", fep->dev_id);

	INIT_DELAYED_WORK(&(fep->delay_work.delay_work), fec_enet_work);
	INIT_WORK(&fep->tx_timeout_work, fec_enet_timeout_work);
	return 0;

failed_register:
@@ -2667,7 +2661,7 @@ fec_drv_remove(struct platform_device *pdev)
	struct net_device *ndev = platform_get_drvdata(pdev);
	struct fec_enet_private *fep = netdev_priv(ndev);

	cancel_delayed_work_sync(&(fep->delay_work.delay_work));
	cancel_work_sync(&fep->tx_timeout_work);
	unregister_netdev(ndev);
	fec_enet_mii_remove(fep);
	del_timer_sync(&fep->time_keep);