Subject: Re: [PATCH 17/32] rt2x00: Put net_device structure in data_ring

From: Ivo van Doorn <[email-masked]>
Date: Fri, 28 Apr 2006 15:41:16 +0200

On Friday 28 April 2006 13:45, Ingo Oeser wrote:
> Hi Ivo,
> 
> Ivo van Doorn wrote:
> > diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2400pci.c wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
> > --- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2400pci.c	2006-04-27 21:48:21.000000000 +0200
> > +++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2400pci.c	2006-04-27 21:49:08.000000000 +0200
> > @@ -760,10 +760,8 @@ rt2400pci_write_tx_desc(
> >  static void
> >  rt2400pci_beacondone(void *data)
> >  {
> > -	struct data_ring	*ring = (struct data_ring*)data;
> > -	struct rt2x00_pci	*rt2x00pci = (struct rt2x00_pci*)ring->dev;
> > -	struct net_device	*net_dev = pci_get_drvdata(rt2x00pci->pci_dev);
> > -	struct sk_buff		*skb;
> > +	struct data_ring		*ring = (struct data_ring*)data;
> 
> No need for a cast here. 
> In C you can cast from any struct pointer to void pointer and back
> without problems.
> 
> > @@ -784,8 +782,8 @@ static void
> >  rt2400pci_rxdone(void *data)
> >  {
> >  	struct data_ring	*ring = (struct data_ring*)data;
> 
> No need for casting.
> 
> > @@ -835,8 +834,8 @@ static void
> >  rt2400pci_txdone(void *data)
> >  {
> >  	struct data_ring	*ring = (struct data_ring*)data;
> 
> No need for casting.
> 
> > diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500pci.c wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
> > --- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500pci.c	2006-04-27 21:48:21.000000000 +0200
> > +++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500pci.c	2006-04-27 21:49:08.000000000 +0200
> > @@ -834,10 +834,8 @@ rt2500pci_write_tx_desc(
> >  static void
> >  rt2500pci_beacondone(void *data)
> >  {
> > -	struct data_ring	*ring = (struct data_ring*)data;
> > -	struct rt2x00_pci	*rt2x00pci = (struct rt2x00_pci*)ring->dev;
> > -	struct net_device	*net_dev = pci_get_drvdata(rt2x00pci->pci_dev);
> > -	struct sk_buff		*skb;
> > +	struct data_ring		*ring = (struct data_ring*)data;
> 
> No need for casting.
> 
> Many more of them.
> 
> I guess you could just do a fgrep for "*ring = (struct data_ring*)data;"

Thanks,

Not only the data_ring has unneeded casts, but they are also found on some other locations.
I'll create a patch that removes them all.