public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Einon <mark.einon@gmail.com>
To: gregkh@suse.de
Cc: greg@kroah.com, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org, o.hartmann@telovital.com,
	Mark Einon <mark.einon@gmail.com>
Subject: [PATCH 8/8] staging: et131x: Update tx trans_start on device close to prevent tx_timeout
Date: Tue, 23 Aug 2011 23:40:40 +0100	[thread overview]
Message-ID: <1314139240-869-9-git-send-email-mark.einon@gmail.com> (raw)
In-Reply-To: <1314139240-869-1-git-send-email-mark.einon@gmail.com>

Updating the tx trans_start before closing the device prevents a possible tx_timeout occuring during the closing process.
Tested on an ET1310 device.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
 drivers/staging/et131x/et131x_netdev.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 70a0da3..7555a24 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -153,7 +153,7 @@ int et131x_open(struct net_device *netdev)
 	result = request_irq(netdev->irq, et131x_isr, IRQF_SHARED,
 					netdev->name, netdev);
 	if (result) {
-		dev_err(&adapter->pdev->dev, "c ould not register IRQ %d\n",
+		dev_err(&adapter->pdev->dev, "could not register IRQ %d\n",
 			netdev->irq);
 		return result;
 	}
@@ -182,6 +182,9 @@ int et131x_close(struct net_device *netdev)
 {
 	struct et131x_adapter *adapter = netdev_priv(netdev);
 
+	/* Save the timestamp for the TX watchdog, prevent a timeout */
+	netdev->trans_start = jiffies;
+
 	/* First thing is to stop the queue */
 	netif_stop_queue(netdev);
 
@@ -449,6 +452,10 @@ void et131x_tx_timeout(struct net_device *netdev)
 	struct tcb *tcb;
 	unsigned long flags;
 
+	/* If the device is closed, ignore the timeout */
+	if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE));
+		return;
+
 	/* Any nonrecoverable hardware error?
 	 * Checks adapter->flags for any failure in phy reading
 	 */
@@ -685,12 +692,12 @@ struct net_device *et131x_device_alloc(void)
 		return NULL;
 	}
 
-	/* Setup the function registration table (and other data) for a
+	/*
+	 * Setup the function registration table (and other data) for a
 	 * net_device
 	 */
-
 	netdev->watchdog_timeo = ET131X_TX_TIMEOUT;
-	netdev->netdev_ops = &et131x_netdev_ops;
+	netdev->netdev_ops     = &et131x_netdev_ops;
 
 	/* netdev->ethtool_ops        = &et131x_ethtool_ops; */
 
-- 
1.7.6


  parent reply	other threads:[~2011-08-23 22:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02 21:47 [PATCH 5/5] staging: et131x: Fix free IRQ from IRQ context warning after tx_timeout Mark Einon
2011-08-23 18:50 ` Greg KH
2011-08-23 20:43   ` Mark Einon
2011-08-23 21:03     ` Greg KH
2011-08-23 21:07       ` Mark Einon
2011-08-23 22:40 ` [PATCH 0/8] [RESEND] staging: et131x: Code cleanups Mark Einon
2011-08-23 22:40   ` [PATCH 1/8] [RESEND] staging: et131x: Remove unecessary *etdev NULL check in et1310_phy_init() Mark Einon
2011-08-23 22:40   ` [PATCH 2/8] [RESEND] staging: et131x: Converting et1310_tx.c function and local names from CamelCase Mark Einon
2011-08-23 22:40   ` [PATCH 3/8] [RESEND] staging: et131x: Converting et1310_adapter.h variable " Mark Einon
2011-08-23 22:40   ` [PATCH 4/8] [RESEND] staging: et131x: Removing commented out code implemented elsewhere Mark Einon
2011-08-23 22:40   ` [PATCH 5/8] [RESEND] staging: et131x: Rename var name 'etdev' to 'adapter' throughout module Mark Einon
2011-08-23 22:40   ` [PATCH 6/8] [RESEND] staging: et131x: Fix link detection signalling Mark Einon
2011-08-23 22:40   ` [PATCH 7/8] [RESEND] staging: et131x: Fix free IRQ from IRQ context warning after tx_timeout Mark Einon
2011-08-23 22:40   ` Mark Einon [this message]
2011-08-23 23:25   ` [PATCH 0/8] [RESEND] staging: et131x: Code cleanups Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314139240-869-9-git-send-email-mark.einon@gmail.com \
    --to=mark.einon@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=greg@kroah.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o.hartmann@telovital.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox