Commit 6dbc9c89 authored by Yoann Padioleau's avatar Yoann Padioleau Committed by David S. Miller

[PATCH] dev->priv to netdev_priv(dev), for drivers/net/wireless

Replacing accesses to dev->priv to netdev_priv(dev). The replacment
is safe when netdev_priv is used to access a private structure that is
right next to the net_device structure in memory. Cf
http://groups.google.com/group/comp.os.linux.development.system/browse_thread/thread/de19321bcd94dbb8/0d74a4adcd6177bd
This is the case when the net_device structure was allocated with
a call to alloc_netdev or one of its derivative.
Signed-off-by: default avatarYoann Padioleau <padator@wanadoo.fr>
Cc: mcgrof@gmail.com
Cc: linux-wireless@vger.kernel.org
Cc: akpm@linux-foundation.org
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8951554d
...@@ -435,7 +435,7 @@ static int arlan_sysctl_info(ctl_table * ctl, int write, struct file *filp, ...@@ -435,7 +435,7 @@ static int arlan_sysctl_info(ctl_table * ctl, int write, struct file *filp,
goto final; goto final;
} }
else else
priva = arlan_device[devnum]->priv; priva = netdev_priv(arlan_device[devnum]);
if (priva == NULL) if (priva == NULL)
{ {
...@@ -654,7 +654,7 @@ static int arlan_sysctl_info161719(ctl_table * ctl, int write, struct file *filp ...@@ -654,7 +654,7 @@ static int arlan_sysctl_info161719(ctl_table * ctl, int write, struct file *filp
goto final; goto final;
} }
else else
priva = arlan_device[devnum]->priv; priva = netdev_priv(arlan_device[devnum]);
if (priva == NULL) if (priva == NULL)
{ {
printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n "); printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
...@@ -688,7 +688,7 @@ static int arlan_sysctl_infotxRing(ctl_table * ctl, int write, struct file *filp ...@@ -688,7 +688,7 @@ static int arlan_sysctl_infotxRing(ctl_table * ctl, int write, struct file *filp
goto final; goto final;
} }
else else
priva = arlan_device[devnum]->priv; priva = netdev_priv(arlan_device[devnum]);
if (priva == NULL) if (priva == NULL)
{ {
printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n "); printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
...@@ -716,7 +716,7 @@ static int arlan_sysctl_inforxRing(ctl_table * ctl, int write, struct file *filp ...@@ -716,7 +716,7 @@ static int arlan_sysctl_inforxRing(ctl_table * ctl, int write, struct file *filp
pos += sprintf(arlan_drive_info + pos, "No device found here \n"); pos += sprintf(arlan_drive_info + pos, "No device found here \n");
goto final; goto final;
} else } else
priva = arlan_device[devnum]->priv; priva = netdev_priv(arlan_device[devnum]);
if (priva == NULL) if (priva == NULL)
{ {
printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n "); printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
...@@ -745,7 +745,7 @@ static int arlan_sysctl_info18(ctl_table * ctl, int write, struct file *filp, ...@@ -745,7 +745,7 @@ static int arlan_sysctl_info18(ctl_table * ctl, int write, struct file *filp,
goto final; goto final;
} }
else else
priva = arlan_device[devnum]->priv; priva = netdev_priv(arlan_device[devnum]);
if (priva == NULL) if (priva == NULL)
{ {
printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n "); printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");
...@@ -780,7 +780,7 @@ static int arlan_configure(ctl_table * ctl, int write, struct file *filp, ...@@ -780,7 +780,7 @@ static int arlan_configure(ctl_table * ctl, int write, struct file *filp,
} }
else if (arlan_device[devnum] != NULL) else if (arlan_device[devnum] != NULL)
{ {
priv = arlan_device[devnum]->priv; priv = netdev_priv(arlan_device[devnum]);
arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_CONF); arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_CONF);
} }
...@@ -805,7 +805,7 @@ static int arlan_sysctl_reset(ctl_table * ctl, int write, struct file *filp, ...@@ -805,7 +805,7 @@ static int arlan_sysctl_reset(ctl_table * ctl, int write, struct file *filp,
} }
else if (arlan_device[devnum] != NULL) else if (arlan_device[devnum] != NULL)
{ {
priv = arlan_device[devnum]->priv; priv = netdev_priv(arlan_device[devnum]);
arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_RESET); arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_RESET);
} else } else
......
...@@ -272,7 +272,7 @@ static int sandisk_enable_wireless(struct net_device *dev) ...@@ -272,7 +272,7 @@ static int sandisk_enable_wireless(struct net_device *dev)
{ {
int res, ret = 0; int res, ret = 0;
conf_reg_t reg; conf_reg_t reg;
struct hostap_interface *iface = dev->priv; struct hostap_interface *iface = netdev_priv(dev);
local_info_t *local = iface->local; local_info_t *local = iface->local;
tuple_t tuple; tuple_t tuple;
cisparse_t *parse = NULL; cisparse_t *parse = NULL;
......
...@@ -3424,7 +3424,7 @@ static void prism2_suspend(struct net_device *dev) ...@@ -3424,7 +3424,7 @@ static void prism2_suspend(struct net_device *dev)
struct local_info *local; struct local_info *local;
union iwreq_data wrqu; union iwreq_data wrqu;
iface = dev->priv; iface = netdev_priv(dev);
local = iface->local; local = iface->local;
/* Send disconnect event, e.g., to trigger reassociation after resume /* Send disconnect event, e.g., to trigger reassociation after resume
......
...@@ -3088,7 +3088,7 @@ static int prism2_ioctl_priv_download(local_info_t *local, struct iw_point *p) ...@@ -3088,7 +3088,7 @@ static int prism2_ioctl_priv_download(local_info_t *local, struct iw_point *p)
static int prism2_set_genericelement(struct net_device *dev, u8 *elem, static int prism2_set_genericelement(struct net_device *dev, u8 *elem,
size_t len) size_t len)
{ {
struct hostap_interface *iface = dev->priv; struct hostap_interface *iface = netdev_priv(dev);
local_info_t *local = iface->local; local_info_t *local = iface->local;
u8 *buf; u8 *buf;
...@@ -3116,7 +3116,7 @@ static int prism2_ioctl_siwauth(struct net_device *dev, ...@@ -3116,7 +3116,7 @@ static int prism2_ioctl_siwauth(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_param *data, char *extra) struct iw_param *data, char *extra)
{ {
struct hostap_interface *iface = dev->priv; struct hostap_interface *iface = netdev_priv(dev);
local_info_t *local = iface->local; local_info_t *local = iface->local;
switch (data->flags & IW_AUTH_INDEX) { switch (data->flags & IW_AUTH_INDEX) {
...@@ -3182,7 +3182,7 @@ static int prism2_ioctl_giwauth(struct net_device *dev, ...@@ -3182,7 +3182,7 @@ static int prism2_ioctl_giwauth(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_param *data, char *extra) struct iw_param *data, char *extra)
{ {
struct hostap_interface *iface = dev->priv; struct hostap_interface *iface = netdev_priv(dev);
local_info_t *local = iface->local; local_info_t *local = iface->local;
switch (data->flags & IW_AUTH_INDEX) { switch (data->flags & IW_AUTH_INDEX) {
...@@ -3221,7 +3221,7 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev, ...@@ -3221,7 +3221,7 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_point *erq, char *extra) struct iw_point *erq, char *extra)
{ {
struct hostap_interface *iface = dev->priv; struct hostap_interface *iface = netdev_priv(dev);
local_info_t *local = iface->local; local_info_t *local = iface->local;
struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
int i, ret = 0; int i, ret = 0;
...@@ -3395,7 +3395,7 @@ static int prism2_ioctl_giwencodeext(struct net_device *dev, ...@@ -3395,7 +3395,7 @@ static int prism2_ioctl_giwencodeext(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_point *erq, char *extra) struct iw_point *erq, char *extra)
{ {
struct hostap_interface *iface = dev->priv; struct hostap_interface *iface = netdev_priv(dev);
local_info_t *local = iface->local; local_info_t *local = iface->local;
struct ieee80211_crypt_data **crypt; struct ieee80211_crypt_data **crypt;
void *sta_ptr; void *sta_ptr;
...@@ -3716,7 +3716,7 @@ static int prism2_ioctl_giwgenie(struct net_device *dev, ...@@ -3716,7 +3716,7 @@ static int prism2_ioctl_giwgenie(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_point *data, char *extra) struct iw_point *data, char *extra)
{ {
struct hostap_interface *iface = dev->priv; struct hostap_interface *iface = netdev_priv(dev);
local_info_t *local = iface->local; local_info_t *local = iface->local;
int len = local->generic_elem_len - 2; int len = local->generic_elem_len - 2;
...@@ -3755,7 +3755,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev, ...@@ -3755,7 +3755,7 @@ static int prism2_ioctl_siwmlme(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_point *data, char *extra) struct iw_point *data, char *extra)
{ {
struct hostap_interface *iface = dev->priv; struct hostap_interface *iface = netdev_priv(dev);
local_info_t *local = iface->local; local_info_t *local = iface->local;
struct iw_mlme *mlme = (struct iw_mlme *) extra; struct iw_mlme *mlme = (struct iw_mlme *) extra;
u16 reason; u16 reason;
......
...@@ -190,7 +190,7 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev, ...@@ -190,7 +190,7 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev,
static void __devexit orinoco_tmd_remove_one(struct pci_dev *pdev) static void __devexit orinoco_tmd_remove_one(struct pci_dev *pdev)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct orinoco_private *priv = dev->priv; struct orinoco_private *priv = netdev_priv(dev);
struct orinoco_pci_card *card = priv->card; struct orinoco_pci_card *card = priv->card;
unregister_netdev(dev); unregister_netdev(dev);
......
...@@ -1753,7 +1753,7 @@ prism54_get_oid(struct net_device *ndev, struct iw_request_info *info, ...@@ -1753,7 +1753,7 @@ prism54_get_oid(struct net_device *ndev, struct iw_request_info *info,
int rvalue; int rvalue;
enum oid_num_t n = dwrq->flags; enum oid_num_t n = dwrq->flags;
rvalue = mgt_get_request((islpci_private *) ndev->priv, n, 0, NULL, &r); rvalue = mgt_get_request(netdev_priv(ndev), n, 0, NULL, &r);
dwrq->length = mgt_response_to_str(n, &r, extra); dwrq->length = mgt_response_to_str(n, &r, extra);
if ((isl_oid[n].flags & OID_FLAG_TYPE) != OID_TYPE_U32) if ((isl_oid[n].flags & OID_FLAG_TYPE) != OID_TYPE_U32)
kfree(r.ptr); kfree(r.ptr);
...@@ -1766,7 +1766,7 @@ prism54_set_u32(struct net_device *ndev, struct iw_request_info *info, ...@@ -1766,7 +1766,7 @@ prism54_set_u32(struct net_device *ndev, struct iw_request_info *info,
{ {
u32 oid = uwrq[0], u = uwrq[1]; u32 oid = uwrq[0], u = uwrq[1];
return mgt_set_request((islpci_private *) ndev->priv, oid, 0, &u); return mgt_set_request(netdev_priv(ndev), oid, 0, &u);
} }
static int static int
...@@ -1775,7 +1775,7 @@ prism54_set_raw(struct net_device *ndev, struct iw_request_info *info, ...@@ -1775,7 +1775,7 @@ prism54_set_raw(struct net_device *ndev, struct iw_request_info *info,
{ {
u32 oid = dwrq->flags; u32 oid = dwrq->flags;
return mgt_set_request((islpci_private *) ndev->priv, oid, 0, extra); return mgt_set_request(netdev_priv(ndev), oid, 0, extra);
} }
void void
......
This diff is collapsed.
...@@ -2572,7 +2572,7 @@ static struct strip *strip_alloc(void) ...@@ -2572,7 +2572,7 @@ static struct strip *strip_alloc(void)
return NULL; /* If no more memory, return */ return NULL; /* If no more memory, return */
strip_info = dev->priv; strip_info = netdev_priv(dev);
strip_info->dev = dev; strip_info->dev = dev;
strip_info->magic = STRIP_MAGIC; strip_info->magic = STRIP_MAGIC;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment