staging-p80211: Kill directly reference of netdev->priv
Subsystems (3)
PATCH 1/1 staging-p80211: Kill directly reference of netdev->priv
In this driver, netdev's private data is wlandevice_t.
And the wlandev(type of wlandevice_t) is exist before netdev be allocated. So use netdev->ml_priv to point to the private data.
I am not sure whether I should consider the kernel version older than 2.3.38. Because in those kernels, netdevice_t is "structure dev" instead of "structure net_device" and of course "dev->ml_priv" will cause compile error. But before my patch, in function wlan_setup(), there is a ether_setup(net_device) which already broke kernels which older than 2.3.38.
Compile test only.
--- drivers/staging/wlan-ng/p80211netdev.c | 20 +++++----- drivers/staging/wlan-ng/p80211wext.c | 58 ++++++++++++++++---------------- 2 files changed, 39 insertions(+), 39 deletions(-)
drivers/staging/wlan-ng/p80211netdev.c +10 -10
@@ -244,7 +244,7 @@ static int p80211knetdev_init( netdevice_t *netdev)static struct net_device_stats *p80211knetdev_get_stats (netdevice_t *netdev) { -wlandevice_t *wlandev = (wlandevice_t *)netdev->priv; +wlandevice_t *wlandev = netdev->ml_priv;DBFENTER ;/* TODO: review the MIB stats for items that correspond to
@@ -272,7 +272,7 @@ p80211knetdev_get_stats(netdevice_t *netdev)static int p80211knetdev_open (netdevice_t *netdev ) {int result =0 ;/* success */ -wlandevice_t *wlandev = (wlandevice_t *)(netdev->priv); +wlandevice_t *wlandev = netdev->ml_priv;DBFENTER ;
@@ -315,7 +315,7 @@ static int p80211knetdev_open( netdevice_t *netdev )static int p80211knetdev_stop (netdevice_t *netdev ) {int result =0 ; -wlandevice_t *wlandev = (wlandevice_t *)(netdev->priv); +wlandevice_t *wlandev = netdev->ml_priv;DBFENTER ;
@@ -460,7 +460,7 @@ static int p80211knetdev_hard_start_xmit( struct sk_buff *skb, netdevice_t *netd {int result =0 ;int txresult =-1 ; -wlandevice_t *wlandev = (wlandevice_t *)netdev->priv; +wlandevice_t *wlandev = netdev->ml_priv;p80211_hdr_t p80211_hdr;p80211_metawep_t p80211_wep;
@@ -603,7 +603,7 @@ static int p80211knetdev_hard_start_xmit( struct sk_buff *skb, netdevice_t *netd----------------------------------------------------------------*/ static void p80211knetdev_set_multicast_list (netdevice_t *dev) { -wlandevice_t *wlandev = (wlandevice_t *)dev->priv; +wlandevice_t *wlandev = dev->ml_priv;DBFENTER ;
@@ -696,7 +696,7 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) {int result =0 ;p80211ioctl_req_t *req = (p80211ioctl_req_t *)ifr; -wlandevice_t *wlandev = (wlandevice_t *)dev->priv; +wlandevice_t *wlandev = dev->ml_priv;UINT8 *msgbuf;DBFENTER ;
@@ -812,7 +812,7 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr) dot11req.msgcode = DIDmsg_dot11req_mibset; dot11req.msglen =sizeof (p80211msg_dot11req_mibset_t);memcpy (dot11req.devname, - ((wlandevice_t *)(dev->priv))->name, + ((wlandevice_t *)dev->ml_priv)->name,WLAN_DEVNAMELEN_MAX -1 );/* Set up the mibattribute argument */
@@ -833,7 +833,7 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr) resultcode->data =0 ;/* now fire the request */ - result =p80211req_dorequest (dev->priv, (UINT8 *)&dot11req); + result =p80211req_dorequest (dev->ml_priv, (UINT8 *)&dot11req);/* If the request wasn't successful, report an error and don't * change the netdev address
@@ -917,7 +917,7 @@ int wlan_setup(wlandevice_t *wlandev)memset ( dev,0 ,sizeof (netdevice_t));ether_setup (dev); wlandev->netdev = dev; - dev->priv = wlandev; + dev->ml_priv = wlandev; dev->hard_start_xmit = p80211knetdev_hard_start_xmit; dev->get_stats = p80211knetdev_get_stats;#ifdef HAVE_PRIVATE_IOCTL
@@ -1487,7 +1487,7 @@ void p80211_resume(wlandevice_t *wlandev)static void p80211knetdev_tx_timeout (netdevice_t *netdev) { -wlandevice_t *wlandev = (wlandevice_t *)netdev->priv; +wlandevice_t *wlandev = netdev->ml_priv;DBFENTER ;if (wlandev->tx_timeout) {
drivers/staging/wlan-ng/p80211wext.c +29 -29
232 lines not on this page · raw message
Signature · 1 line
1.5.3.4
Quoted 9 lines · Wang Chen
In this driver, netdev's private data is
wlandevice_t.
And thewlandev(type of wlandevice_t)is exist before netdev be allocated. So usenetdev->ml_privto point to the private data.I am not sure whether I should consider the kernel version older than 2.3.38. Because in those kernels,
netdevice_tis "structure dev" instead of "structurenet_device" and of course "dev->ml_priv" will cause compile error. But before my patch, in functionwlan_setup(), there is aether_setup(net_device)which already broke kernels which older than 2.3.38.
Heh, no we only need to support the current mainline kernel with this driver, no old 2.3.x versions :)
thanks for the patch, I'll queue it up,
greg k-h
Re: [PATCH next] staging-p80211: Kill directly reference of c
Greg KH said the following on 2008-12-5 23:44:
Quoted 5 lines · Wang Chen
Quoted 4 lines
In this driver, netdev's private data is
wlandevice_t.
And thewlandev(type of wlandevice_t)is exist before netdev be allocated. So usenetdev->ml_privto point to the private data.
Quoted 9 lines
Quoted 5 lines
I am not sure whether I should consider the kernel version older than 2.3.38. Because in those kernels,
netdevice_tis "structure dev" instead of "structurenet_device" and of course "dev->ml_priv" will cause compile error. But before my patch, in functionwlan_setup(), there is aether_setup(net_device)which already broke kernels which older than 2.3.38.Heh, no we only need to support the current mainline kernel with this driver, no old 2.3.x versions :)
Thanks for your explanation.
Quoted 2 lines
thanks for the patch, I'll queue it up,
I'm doing this "kill netdev->priv" work on Dave's net-next tree now. So, will it be better to let Dave apply this to his net-next instead you apply it?
Just suggestion :)
David Miller
maintainerRe: [PATCH next] staging-p80211: Kill directly reference of c
From: Wang Chen <[email protected]>
Date: Sat, 06 Dec 2008 10:28:45 +0800
Quoted 7 lines
Greg KH said the following on 2008-12-5 23:44:
Quoted 1 line
thanks for the patch, I'll queue it up,
I'm doing this "kill
netdev->priv" work on Dave's net-next tree now. So, will it be better to let Dave apply this to his net-next instead you apply it?
Just suggestion :)
Yes, I would prefer it be done this way so I can do the final kill of the netdev->priv member without having to wait for a dependency on the staging tree :)
Greg KH
Acked-byRe: [PATCH next] staging-p80211: Kill directly reference of c
Quoted 6 lines · David Miller
From: Wang Chen <[email protected]>
Date: Sat, 06 Dec 2008 10:28:45 +0800Quoted 3 lines
Greg KH said the following on 2008-12-5 23:44:
Quoted 1 line
thanks for the patch, I'll queue it up,
Quoted 8 lines
Quoted 4 lines
I'm doing this "kill
netdev->priv" work on Dave's net-next tree now. So, will it be better to let Dave apply this to his net-next instead you apply it?
Just suggestion :)Yes, I would prefer it be done this way so I can do the final kill of the
netdev->privmember without having to wait for a dependency on the staging tree :)
Feel free to take it yourself, I have no objection to anyone else taking drivers/staging/ patches if they want to. You're the first one to be so brave :)
You can add a:
to the patch.
thanks,
greg k-h
David Miller
maintainerRe: [PATCH next] staging-p80211: Kill directly reference of c
From: Greg KH <[email protected]>
Date: Fri, 5 Dec 2008 18:41:23 -0800
Quoted 16 lines · David Miller
Quoted 6 lines
From: Wang Chen <[email protected]>
Date: Sat, 06 Dec 2008 10:28:45 +0800Quoted 3 lines
Greg KH said the following on 2008-12-5 23:44:
Quoted 1 line
thanks for the patch, I'll queue it up,
Quoted 8 lines
Quoted 4 lines
I'm doing this "kill
netdev->priv" work on Dave's net-next tree now. So, will it be better to let Dave apply this to his net-next instead you apply it?
Just suggestion :)Yes, I would prefer it be done this way so I can do the final kill of the
netdev->privmember without having to wait for a dependency on the staging tree :)
Quoted 7 lines
Feel free to take it yourself, I have no objection to anyone else taking
drivers/staging/patches if they want to. You're the first one to be so brave :)You can add a:
to the patch.
Great, I'll do that, thanks Greg!
From: Wang Chen <[email protected]>
Date: Fri, 05 Dec 2008 23:14:53 +0800
Quoted 10 lines
In this driver, netdev's private data is
wlandevice_t.
And thewlandev(type of wlandevice_t)is exist before netdev be allocated. So usenetdev->ml_privto point to the private data.I am not sure whether I should consider the kernel version older than 2.3.38. Because in those kernels,
netdevice_tis "structure dev" instead of "structurenet_device" and of course "dev->ml_priv" will cause compile error. But before my patch, in functionwlan_setup(), there is aether_setup(net_device)which already broke kernels which older than 2.3.38.
Quoted 3 lines
Compile test only.
Signed-off-by Wang Chen <[email protected]>
Applied.