Re: [PATCH] e1000 C style badness

From: Jens Axboe
Date: Wed Jan 18 2006 - 03:56:36 EST


On Wed, Jan 18 2006, 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@xxxxxxx>
> >
> > 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...)?

No, that's not necessary. But they should be before actual code inside
that block.

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/