mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Einon <mark.einon@gmail.com>
To: gregkh@suse.de
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	o.hartmann@telovital.com, alan@linux.intel.com,
	Mark Einon <mark.einon@gmail.com>
Subject: [PATCH 5/8] staging: et131x: Fix add_timer() from et131x_open
Date: Sat,  1 Oct 2011 11:14:14 +0100	[thread overview]
Message-ID: <1317464057-18231-5-git-send-email-mark.einon@gmail.com> (raw)
In-Reply-To: <1317464057-18231-1-git-send-email-mark.einon@gmail.com>

The error_timer was only getting initialised and an initial jiffies value set following a probe.
This could result in the timer needlessly expiring immediately after et131x_open is called.
Now this is all done from the open call instead.

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

diff --git a/drivers/staging/et131x/README b/drivers/staging/et131x/README
index 42c388d..a0ebaa0 100644
--- a/drivers/staging/et131x/README
+++ b/drivers/staging/et131x/README
@@ -9,7 +9,6 @@ Note, the powermanagement options were removed from the vendor provided
 driver as they did not build properly at the time.
 
 TODO:
-	- add_timer call in et131x_netdev.c is correct?
 	- Implement a few more kernel Parameter (set mac )
 
 Please send patches to:
diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h
index 15486d1..c8f5ab1 100644
--- a/drivers/staging/et131x/et131x.h
+++ b/drivers/staging/et131x/et131x.h
@@ -52,6 +52,7 @@
 int et131x_init_eeprom(struct et131x_adapter *adapter);
 
 /* et131x_initpci.c */
+void et131x_error_timer_handler(unsigned long data);
 void et131x_configure_global_regs(struct et131x_adapter *adapter);
 void et131x_enable_interrupts(struct et131x_adapter *adapter);
 void et131x_disable_interrupts(struct et131x_adapter *adapter);
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c
index e166fde..8bff4a0 100644
--- a/drivers/staging/et131x/et131x_initpci.c
+++ b/drivers/staging/et131x/et131x_initpci.c
@@ -750,10 +750,6 @@ static int __devinit et131x_pci_setup(struct pci_dev *pdev,
 	/* Copy address into the net_device struct */
 	memcpy(netdev->dev_addr, adapter->addr, ETH_ALEN);
 
-	adapter->error_timer.expires = jiffies + TX_ERROR_PERIOD * HZ / 1000;
-	adapter->error_timer.function = et131x_error_timer_handler;
-	adapter->error_timer.data = (unsigned long)adapter;
-
 	/* Init variable for counting how long we do not have link status */
 	adapter->boot_coma = 0;
 	et1310_disable_phy_coma(adapter);
@@ -795,9 +791,6 @@ static int __devinit et131x_pci_setup(struct pci_dev *pdev,
 	/* Setup et1310 as per the documentation */
 	et131x_adapter_setup(adapter);
 
-	/* Create a timer to count errors received by the NIC */
-	init_timer(&adapter->error_timer);
-
 	/* We can enable interrupts now
 	 *
 	 *  NOTE - Because registration of interrupt handler is done in the
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 6ec4a0f..2184682 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -187,6 +187,10 @@ int et131x_open(struct net_device *netdev)
 	struct et131x_adapter *adapter = netdev_priv(netdev);
 
 	/* Start the timer to track NIC errors */
+	init_timer(&adapter->error_timer);
+	adapter->error_timer.expires = jiffies + TX_ERROR_PERIOD * HZ / 1000;
+	adapter->error_timer.function = et131x_error_timer_handler;
+	adapter->error_timer.data = (unsigned long)adapter;
 	add_timer(&adapter->error_timer);
 
 	/* Register our IRQ */
-- 
1.7.6.4


  parent reply	other threads:[~2011-10-01 10:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-01 10:14 [PATCH 1/8] staging: et131x: Remove TODO entry 'alloc_etherdev initilising memory with zero' Mark Einon
2011-10-01 10:14 ` [PATCH 2/8] staging: et131x: Introduce et1310_in_phy_coma() call Mark Einon
2011-10-01 10:14 ` [PATCH 3/8] staging: et131x: Remove adapter->bmsr, replace with phydev equivalents Mark Einon
2011-10-01 10:14 ` [PATCH 4/8] staging: et131x: Add pci suspend & resume functions Mark Einon
2011-10-01 11:03   ` Francois Romieu
2011-10-01 14:02     ` Mark Einon
2011-10-01 19:36       ` Francois Romieu
2011-10-01 10:14 ` Mark Einon [this message]
2011-10-01 10:14 ` [PATCH 6/8] staging: et131x: Update TODO file for kernel parameters Mark Einon
2011-10-01 10:14 ` [PATCH 7/8] staging: et131x: Updating copyright statements and module authors Mark Einon
2011-10-01 19:58   ` Dan Carpenter
2011-10-02 18:54     ` Mark Einon
2011-10-01 10:14 ` [PATCH 8/8] staging: et131x: Fix indefinite low power sleep Mark Einon

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=1317464057-18231-5-git-send-email-mark.einon@gmail.com \
    --to=mark.einon@gmail.com \
    --cc=alan@linux.intel.com \
    --cc=devel@driverdev.osuosl.org \
    --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

Powered by JetHome