diff mbox

[net-next,2/2] drivers/net: Remove casts of void *

Message ID 1308060028.18987.6.camel@Joe-Laptop
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Joe Perches June 14, 2011, 2 p.m. UTC
On Tue, 2011-06-14 at 11:21 +0200, Geert Uytterhoeven wrote:
> On Tue, Jun 14, 2011 at 06:02, Joe Perches <joe@perches.com> wrote:
> > Unnecessary casts of void * clutter the code.
> > --- a/drivers/net/a2065.c
> > +++ b/drivers/net/a2065.c
> > @@ -426,7 +426,7 @@ static irqreturn_t lance_interrupt (int irq, void *dev_id)
> >        volatile struct lance_regs *ll;
> >        int csr0;
> >
> > -       dev = (struct net_device *) dev_id;
> > +       dev = dev_id;
> 
> I think it would look better if you merge this line with the line that
> defines "dev".

I think so too, but I also think it should look like below
and that's something better done in a separate pass, don't
you think?



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Geert Uytterhoeven June 14, 2011, 2:02 p.m. UTC | #1
Hi Joe,

On Tue, Jun 14, 2011 at 16:00, Joe Perches <joe@perches.com> wrote:
> On Tue, 2011-06-14 at 11:21 +0200, Geert Uytterhoeven wrote:
>> On Tue, Jun 14, 2011 at 06:02, Joe Perches <joe@perches.com> wrote:
>> > Unnecessary casts of void * clutter the code.
>> > --- a/drivers/net/a2065.c
>> > +++ b/drivers/net/a2065.c
>> > @@ -426,7 +426,7 @@ static irqreturn_t lance_interrupt (int irq, void *dev_id)
>> >        volatile struct lance_regs *ll;
>> >        int csr0;
>> >
>> > -       dev = (struct net_device *) dev_id;
>> > +       dev = dev_id;
>>
>> I think it would look better if you merge this line with the line that
>> defines "dev".
>
> I think so too, but I also think it should look like below
> and that's something better done in a separate pass, don't
> you think?
>
> diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
> index deaa8bc..25ea98a 100644
> --- a/drivers/net/a2065.c
> +++ b/drivers/net/a2065.c
> @@ -421,16 +421,11 @@ static int lance_tx (struct net_device *dev)
>
>  static irqreturn_t lance_interrupt (int irq, void *dev_id)
>  {
> -       struct net_device *dev;
> -       struct lance_private *lp;
> -       volatile struct lance_regs *ll;
> +       struct net_device *dev = dev_id;
> +       struct lance_private *lp = netdev_priv(dev);
> +       volatile struct lance_regs *ll = lp->ll;
>        int csr0;
>
> -       dev = (struct net_device *) dev_id;
> -
> -       lp = netdev_priv(dev);
> -       ll = lp->ll;
> -
>        ll->rap = LE_CSR0;              /* LANCE Controller Status */
>        csr0 = ll->rdp;

Definitely better!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index deaa8bc..25ea98a 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -421,16 +421,11 @@  static int lance_tx (struct net_device *dev)
 
 static irqreturn_t lance_interrupt (int irq, void *dev_id)
 {
-	struct net_device *dev;
-	struct lance_private *lp;
-	volatile struct lance_regs *ll;
+	struct net_device *dev = dev_id;
+	struct lance_private *lp = netdev_priv(dev);
+	volatile struct lance_regs *ll = lp->ll;
 	int csr0;
 
-	dev = (struct net_device *) dev_id;
-
-	lp = netdev_priv(dev);
-	ll = lp->ll;
-
 	ll->rap = LE_CSR0;		/* LANCE Controller Status */
 	csr0 = ll->rdp;