* [PATCH] netdev: octeon_mgmt: ISO C90 forbids mixed declarations and code
@ 2014-09-13 19:05 Heinrich Schuchardt
2014-09-13 19:11 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2014-09-13 19:05 UTC (permalink / raw)
To: David Daney
Cc: David S. Miller, Luka Perkov, Willem de Bruijn, Russell King,
netdev, linux-kernel, Heinrich Schuchardt
Compiling with OCTEON_MGMT_ETHERNET gives a warning
drivers/net/ethernet/octeon/octeon_mgmt.c:295:4:
warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
The patch cleans up the code.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
drivers/net/ethernet/octeon/octeon_mgmt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index 979c698..8af453a 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -254,6 +254,7 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
struct sk_buff *skb;
int cleaned = 0;
unsigned long flags;
+ u64 ns;
mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT);
while (mix_orcnt.s.orcnt) {
@@ -292,7 +293,7 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
struct skb_shared_hwtstamps ts;
memset(&ts, 0, sizeof(ts));
/* Read the timestamp */
- u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
+ ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
/* Remove the timestamp from the FIFO */
cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0);
/* Tell the kernel about the timestamp */
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] netdev: octeon_mgmt: ISO C90 forbids mixed declarations and code
2014-09-13 19:05 [PATCH] netdev: octeon_mgmt: ISO C90 forbids mixed declarations and code Heinrich Schuchardt
@ 2014-09-13 19:11 ` Joe Perches
2014-09-13 20:03 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2014-09-13 19:11 UTC (permalink / raw)
To: Heinrich Schuchardt
Cc: David Daney, David S. Miller, Luka Perkov, Willem de Bruijn,
Russell King, netdev, linux-kernel
On Sat, 2014-09-13 at 21:05 +0200, Heinrich Schuchardt wrote:
> Compiling with OCTEON_MGMT_ETHERNET gives a warning
> drivers/net/ethernet/octeon/octeon_mgmt.c:295:4:
> warning: ISO C90 forbids mixed declarations and code
> [-Wdeclaration-after-statement]
Maybe better to move the memset after the declaration.
> diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
[]
> @@ -254,6 +254,7 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
> struct sk_buff *skb;
> int cleaned = 0;
> unsigned long flags;
> + u64 ns;
>
> mix_orcnt.u64 = cvmx_read_csr(p->mix + MIX_ORCNT);
> while (mix_orcnt.s.orcnt) {
> @@ -292,7 +293,7 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
> struct skb_shared_hwtstamps ts;
> memset(&ts, 0, sizeof(ts));
> /* Read the timestamp */
> - u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
> + ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
> /* Remove the timestamp from the FIFO */
> cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0);
> /* Tell the kernel about the timestamp */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] netdev: octeon_mgmt: ISO C90 forbids mixed declarations and code
2014-09-13 19:11 ` Joe Perches
@ 2014-09-13 20:03 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2014-09-13 20:03 UTC (permalink / raw)
To: joe
Cc: xypron.glpk, david.daney, luka, willemb, rmk+kernel, netdev,
linux-kernel
From: Joe Perches <joe@perches.com>
Date: Sat, 13 Sep 2014 12:11:12 -0700
> On Sat, 2014-09-13 at 21:05 +0200, Heinrich Schuchardt wrote:
>> Compiling with OCTEON_MGMT_ETHERNET gives a warning
>> drivers/net/ethernet/octeon/octeon_mgmt.c:295:4:
>> warning: ISO C90 forbids mixed declarations and code
>> [-Wdeclaration-after-statement]
>
> Maybe better to move the memset after the declaration.
Totally agree, keep the variable in the innermost scope
in which it is used.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-13 20:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-13 19:05 [PATCH] netdev: octeon_mgmt: ISO C90 forbids mixed declarations and code Heinrich Schuchardt
2014-09-13 19:11 ` Joe Perches
2014-09-13 20:03 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.