netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] tg3: use <linux/io.h> and <linux/uaccess.h> instead <asm/io.h> and <asm/uaccess.h>
@ 2011-03-01 17:04 Javier Martinez Canillas
  2011-03-01 17:04 ` [PATCH 1/5] tg3: use usleep_range not msleep for small sleeps Javier Martinez Canillas
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Javier Martinez Canillas @ 2011-03-01 17:04 UTC (permalink / raw)
  To: Matt Carlson
  Cc: Michael Chan, Grant Likely, netdev, kernelnewbies,
	Javier Martinez Canillas

It is proper style to include linux/foo.h instead asm/foo.h if both exist

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
---
 drivers/net/tg3.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 6be4185..4410d73 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -48,9 +48,9 @@
 #include <net/ip.h>
 
 #include <asm/system.h>
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/byteorder.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 #ifdef CONFIG_SPARC
 #include <asm/idprom.h>
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 1/5] tg3: use usleep_range not msleep for small sleeps
  2011-03-01 17:04 [PATCH 1/5] tg3: use <linux/io.h> and <linux/uaccess.h> instead <asm/io.h> and <asm/uaccess.h> Javier Martinez Canillas
@ 2011-03-01 17:04 ` Javier Martinez Canillas
  2011-03-03  4:55   ` David Miller
  2011-03-01 17:04 ` [PATCH 3/5] tg3: Enclose macro with complex values in parenthesis Javier Martinez Canillas
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Javier Martinez Canillas @ 2011-03-01 17:04 UTC (permalink / raw)
  To: Matt Carlson
  Cc: Michael Chan, Grant Likely, netdev, kernelnewbies,
	Javier Martinez Canillas


Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
---
 drivers/net/tg3.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 6be4185..3310c7a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -2410,7 +2410,7 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp,
 
 		if (tmp & EEPROM_ADDR_COMPLETE)
 			break;
-		msleep(1);
+		usleep_range(1000, 2000);
 	}
 	if (!(tmp & EEPROM_ADDR_COMPLETE))
 		return -EBUSY;
@@ -2688,7 +2688,7 @@ static int tg3_power_down_prepare(struct tg3 *tp)
 			tg3_read_mem(tp, NIC_SRAM_FW_ASF_STATUS_MBOX, &val);
 			if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
 				break;
-			msleep(1);
+			usleep_range(1000, 2000);
 		}
 	}
 	if (tp->tg3_flags & TG3_FLAG_WOL_CAP)
@@ -8901,7 +8901,7 @@ static int tg3_test_interrupt(struct tg3 *tp)
 			break;
 		}
 
-		msleep(10);
+		usleep_range(10000, 20000);
 	}
 
 	tg3_disable_ints(tp);
@@ -11863,7 +11863,7 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
 	      (EEPROM_DEFAULT_CLOCK_PERIOD <<
 	       EEPROM_ADDR_CLKPERD_SHIFT)));
 
-	msleep(1);
+	usleep_range(1000, 2000);
 
 	/* Enable seeprom accesses. */
 	tw32_f(GRC_LOCAL_CTRL,
@@ -11956,7 +11956,7 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp,
 
 			if (val & EEPROM_ADDR_COMPLETE)
 				break;
-			msleep(1);
+			usleep_range(1000, 2000);
 		}
 		if (!(val & EEPROM_ADDR_COMPLETE)) {
 			rc = -EBUSY;
@@ -12263,7 +12263,7 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
 	pci_read_config_word(tp->pdev, tp->pm_cap + PCI_PM_CTRL, &pmcsr);
 	pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
 	pci_write_config_word(tp->pdev, tp->pm_cap + PCI_PM_CTRL, pmcsr);
-	msleep(1);
+	usleep_range(1000, 2000);
 
 	/* Make sure register accesses (indirect or otherwise)
 	 * will function correctly.
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/5] tg3: Enclose macro with complex values in parenthesis
  2011-03-01 17:04 [PATCH 1/5] tg3: use <linux/io.h> and <linux/uaccess.h> instead <asm/io.h> and <asm/uaccess.h> Javier Martinez Canillas
  2011-03-01 17:04 ` [PATCH 1/5] tg3: use usleep_range not msleep for small sleeps Javier Martinez Canillas
@ 2011-03-01 17:04 ` Javier Martinez Canillas
  2011-03-03  4:56   ` David Miller
  2011-03-01 17:04 ` [PATCH 4/5] tg3: Don't use IRQF_SAMPLE_RANDOM Javier Martinez Canillas
  2011-03-01 17:04 ` [PATCH 5/5] tg3: Fix inline keyword usage Javier Martinez Canillas
  3 siblings, 1 reply; 9+ messages in thread
From: Javier Martinez Canillas @ 2011-03-01 17:04 UTC (permalink / raw)
  To: Matt Carlson
  Cc: Michael Chan, Grant Likely, netdev, kernelnewbies,
	Javier Martinez Canillas

Macros with complex values should be enclosed in parenthesis.
Change accordingly.

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
---
 drivers/net/tg3.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 6dc7a8a..c67eb19 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -513,16 +513,16 @@ static void tg3_write32_mbox_5906(struct tg3 *tp, u32 off, u32 val)
 	writel(val, tp->regs + off + GRCMBOX_BASE);
 }
 
-#define tw32_mailbox(reg, val)		tp->write32_mbox(tp, reg, val)
+#define tw32_mailbox(reg, val)		(tp->write32_mbox(tp, reg, val))
 #define tw32_mailbox_f(reg, val)	tw32_mailbox_flush(tp, (reg), (val))
-#define tw32_rx_mbox(reg, val)		tp->write32_rx_mbox(tp, reg, val)
-#define tw32_tx_mbox(reg, val)		tp->write32_tx_mbox(tp, reg, val)
-#define tr32_mailbox(reg)		tp->read32_mbox(tp, reg)
+#define tw32_rx_mbox(reg, val)		(tp->write32_rx_mbox(tp, reg, val))
+#define tw32_tx_mbox(reg, val)		(tp->write32_tx_mbox(tp, reg, val))
+#define tr32_mailbox(reg)		(tp->read32_mbox(tp, reg))
 
-#define tw32(reg, val)			tp->write32(tp, reg, val)
+#define tw32(reg, val)			(tp->write32(tp, reg, val))
 #define tw32_f(reg, val)		_tw32_flush(tp, (reg), (val), 0)
 #define tw32_wait_f(reg, val, us)	_tw32_flush(tp, (reg), (val), (us))
-#define tr32(reg)			tp->read32(tp, reg)
+#define tr32(reg)			(tp->read32(tp, reg))
 
 static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
 {
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/5] tg3: Don't use IRQF_SAMPLE_RANDOM
  2011-03-01 17:04 [PATCH 1/5] tg3: use <linux/io.h> and <linux/uaccess.h> instead <asm/io.h> and <asm/uaccess.h> Javier Martinez Canillas
  2011-03-01 17:04 ` [PATCH 1/5] tg3: use usleep_range not msleep for small sleeps Javier Martinez Canillas
  2011-03-01 17:04 ` [PATCH 3/5] tg3: Enclose macro with complex values in parenthesis Javier Martinez Canillas
@ 2011-03-01 17:04 ` Javier Martinez Canillas
  2011-03-01 17:04 ` [PATCH 5/5] tg3: Fix inline keyword usage Javier Martinez Canillas
  3 siblings, 0 replies; 9+ messages in thread
From: Javier Martinez Canillas @ 2011-03-01 17:04 UTC (permalink / raw)
  To: Matt Carlson
  Cc: Michael Chan, Grant Likely, netdev, kernelnewbies,
	Javier Martinez Canillas

This flag is scheduled for removal so we shouldn't used it.

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
---
 drivers/net/tg3.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index c67eb19..58c6049 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8844,12 +8844,11 @@ static int tg3_request_irq(struct tg3 *tp, int irq_num)
 		fn = tg3_msi;
 		if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI)
 			fn = tg3_msi_1shot;
-		flags = IRQF_SAMPLE_RANDOM;
 	} else {
 		fn = tg3_interrupt;
 		if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS)
 			fn = tg3_interrupt_tagged;
-		flags = IRQF_SHARED | IRQF_SAMPLE_RANDOM;
+		flags = IRQF_SHARED;
 	}
 
 	return request_irq(tnapi->irq_vec, fn, flags, name, tnapi);
@@ -8880,7 +8879,7 @@ static int tg3_test_interrupt(struct tg3 *tp)
 	}
 
 	err = request_irq(tnapi->irq_vec, tg3_test_isr,
-			  IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, tnapi);
+			  IRQF_SHARED, dev->name, tnapi);
 	if (err)
 		return err;
 
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/5] tg3: Fix inline keyword usage
  2011-03-01 17:04 [PATCH 1/5] tg3: use <linux/io.h> and <linux/uaccess.h> instead <asm/io.h> and <asm/uaccess.h> Javier Martinez Canillas
                   ` (2 preceding siblings ...)
  2011-03-01 17:04 ` [PATCH 4/5] tg3: Don't use IRQF_SAMPLE_RANDOM Javier Martinez Canillas
@ 2011-03-01 17:04 ` Javier Martinez Canillas
  3 siblings, 0 replies; 9+ messages in thread
From: Javier Martinez Canillas @ 2011-03-01 17:04 UTC (permalink / raw)
  To: Matt Carlson
  Cc: Michael Chan, Grant Likely, netdev, kernelnewbies,
	Javier Martinez Canillas

The correct usage is "static inline void" not "static void inline".

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
---
 drivers/net/tg3.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 58c6049..d7e564d 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -13061,7 +13061,7 @@ done:
 
 static struct pci_dev * __devinit tg3_find_peer(struct tg3 *);
 
-static void inline vlan_features_add(struct net_device *dev, unsigned long flags)
+static inline void vlan_features_add(struct net_device *dev, unsigned long flags)
 {
 	dev->vlan_features |= flags;
 }
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/5] tg3: use usleep_range not msleep for small sleeps
  2011-03-01 17:04 ` [PATCH 1/5] tg3: use usleep_range not msleep for small sleeps Javier Martinez Canillas
@ 2011-03-03  4:55   ` David Miller
  2011-03-03 12:14     ` Javier Martinez Canillas
  0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2011-03-03  4:55 UTC (permalink / raw)
  To: martinez.javier; +Cc: mcarlson, mchan, grant.likely, netdev, kernelnewbies

From: Javier Martinez Canillas <martinez.javier@gmail.com>
Date: Tue,  1 Mar 2011 18:04:26 +0100

> 
> Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>

Why?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/5] tg3: Enclose macro with complex values in parenthesis
  2011-03-01 17:04 ` [PATCH 3/5] tg3: Enclose macro with complex values in parenthesis Javier Martinez Canillas
@ 2011-03-03  4:56   ` David Miller
  2011-03-03 11:54     ` Javier Martinez Canillas
  0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2011-03-03  4:56 UTC (permalink / raw)
  To: martinez.javier; +Cc: mcarlson, mchan, grant.likely, netdev, kernelnewbies

From: Javier Martinez Canillas <martinez.javier@gmail.com>
Date: Tue,  1 Mar 2011 18:04:27 +0100

> Macros with complex values should be enclosed in parenthesis.
> Change accordingly.
> 
> Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>

This seems unnecessary, what problem do the current macro definitions
create?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/5] tg3: Enclose macro with complex values in parenthesis
  2011-03-03  4:56   ` David Miller
@ 2011-03-03 11:54     ` Javier Martinez Canillas
  0 siblings, 0 replies; 9+ messages in thread
From: Javier Martinez Canillas @ 2011-03-03 11:54 UTC (permalink / raw)
  To: David Miller; +Cc: mcarlson, mchan, grant.likely, netdev, kernelnewbies

>
> This seems unnecessary, what problem do the current macro definitions
> create?
>

Probably the change is unnecessary, the only value is that it silences
a checkpatch error:

ERROR: Macros with complex values should be enclosed in parenthesis

Sorry for the noise.

-- 
-----------------------------------------
Javier Martínez Canillas
(+34) 682 39 81 69
PhD Student in High Performance Computing
Computer Architecture and Operating System Department (CAOS)
Universitat Autònoma de Barcelona
Barcelona, Spain

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/5] tg3: use usleep_range not msleep for small sleeps
  2011-03-03  4:55   ` David Miller
@ 2011-03-03 12:14     ` Javier Martinez Canillas
  0 siblings, 0 replies; 9+ messages in thread
From: Javier Martinez Canillas @ 2011-03-03 12:14 UTC (permalink / raw)
  To: David Miller; +Cc: mcarlson, mchan, grant.likely, netdev, kernelnewbies

>
>>
>> Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
>
> Why?
>

As I understand msleep() will stop for a minimum of two jiffies and
that resolution is too low in systems with small HZ values (big
jiffies).
Using msleep() (with small values) in this systems will sleep for more
time than the caller expects.

I used usleep_range() because it is a finer precision implementations of msleep.

Sorry if I'm wrong or the sleep precision is not a concern in this
driver and the change doesn't add any value.

Thanks a lot.

-- 
-----------------------------------------
Javier Martínez Canillas
(+34) 682 39 81 69
PhD Student in High Performance Computing
Computer Architecture and Operating System Department (CAOS)
Universitat Autònoma de Barcelona
Barcelona, Spain

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-03-03 12:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01 17:04 [PATCH 1/5] tg3: use <linux/io.h> and <linux/uaccess.h> instead <asm/io.h> and <asm/uaccess.h> Javier Martinez Canillas
2011-03-01 17:04 ` [PATCH 1/5] tg3: use usleep_range not msleep for small sleeps Javier Martinez Canillas
2011-03-03  4:55   ` David Miller
2011-03-03 12:14     ` Javier Martinez Canillas
2011-03-01 17:04 ` [PATCH 3/5] tg3: Enclose macro with complex values in parenthesis Javier Martinez Canillas
2011-03-03  4:56   ` David Miller
2011-03-03 11:54     ` Javier Martinez Canillas
2011-03-01 17:04 ` [PATCH 4/5] tg3: Don't use IRQF_SAMPLE_RANDOM Javier Martinez Canillas
2011-03-01 17:04 ` [PATCH 5/5] tg3: Fix inline keyword usage Javier Martinez Canillas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).