public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: patrizio.bassi@gmail.com
Cc: Jens Axboe <axboe@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] e1000 C style badness
Date: Wed, 18 Jan 2006 20:02:33 +1100	[thread overview]
Message-ID: <43CE0429.3090708@yahoo.com.au> (raw)
In-Reply-To: <43CE02BD.8060309@gmail.com>

Patrizio Bassi wrote:
> Jens Axboe ha scritto:
> 
>>Hi,
>>
>>Recent e1000 updates introduced variable declarations after code. Fix
>>those up again.
>>
>>Signed-off-by: Jens Axboe <axboe@suse.de>
>>
>>diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
>>index d0a5d16..ca68a04 100644
>>--- a/drivers/net/e1000/e1000_main.c
>>+++ b/drivers/net/e1000/e1000_main.c
>>@@ -2142,9 +2142,11 @@ e1000_leave_82542_rst(struct e1000_adapt
>> 		e1000_pci_set_mwi(&adapter->hw);
>> 
>> 	if(netif_running(netdev)) {
>>+		struct e1000_rx_ring *ring;
>>+
>> 		e1000_configure_rx(adapter);
>> 		/* No need to loop, because 82542 supports only 1 queue */
>>-		struct e1000_rx_ring *ring = &adapter->rx_ring[0];
>>+		ring = &adapter->rx_ring[0];
>> 		adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
>> 	}
>> }
>>@@ -3583,8 +3585,8 @@ e1000_clean_rx_irq(struct e1000_adapter 
>> 	rx_desc = E1000_RX_DESC(*rx_ring, i);
>> 
>> 	while(rx_desc->status & E1000_RXD_STAT_DD) {
>>-		buffer_info = &rx_ring->buffer_info[i];
>> 		u8 status;
>>+		buffer_info = &rx_ring->buffer_info[i];
>> #ifdef CONFIG_E1000_NAPI
>> 		if(*work_done >= work_to_do)
>> 			break;
>>
> 
> 
> Shouldn't variables declaration be on top of function and not on top of
> a block (like if, while, for...)?
> 

Any block is OK, and they all have the same nice symmetry - variables
come into scope at the top and go out of scope at the bottom.

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

  parent reply	other threads:[~2006-01-18  9:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5wgyi-18w-7@gated-at.bofh.it>
2006-01-18  8:56 ` [PATCH] e1000 C style badness Patrizio Bassi
2006-01-18  9:00   ` Jens Axboe
2006-01-18  9:02   ` Nick Piggin [this message]
2006-01-18 11:30     ` Patrizio Bassi
2006-01-18  8:07 Jens Axboe
2006-01-18  8:37 ` Jens Axboe
2006-01-18 17:53   ` Jon Smirl
2006-01-18 18:13     ` Jeff Garzik
2006-01-18 18:20       ` Jens Axboe
2006-01-18 19:10         ` Jesse Brandeburg
2006-01-19  8:02           ` Jens Axboe
2006-01-21  6:52             ` Jesse Brandeburg
2006-01-21 11:42               ` Jens Axboe

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=43CE0429.3090708@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrizio.bassi@gmail.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