aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl3501_cs.c
diff options
context:
space:
mode:
authorYoann Padioleau <padator@wanadoo.fr>2007-08-03 13:37:16 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:37 -0400
commit6dbc9c89fb242873bd3e83890e59da3d6e462025 (patch)
tree9e70567b27c3245b3bcd641cb63a29f8f648719a /drivers/net/wireless/wl3501_cs.c
parent8951554dba0c7962ae72faece66e8f5085a777d6 (diff)
[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: Yoann Padioleau <padator@wanadoo.fr> Cc: mcgrof@gmail.com Cc: linux-wireless@vger.kernel.org Cc: akpm@linux-foundation.org Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl3501_cs.c')
-rw-r--r--drivers/net/wireless/wl3501_cs.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index c8b5c2271938..72f3d97e7cb4 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -859,7 +859,7 @@ static int wl3501_esbq_confirm(struct wl3501_card *this)
859 859
860static void wl3501_online(struct net_device *dev) 860static void wl3501_online(struct net_device *dev)
861{ 861{
862 struct wl3501_card *this = dev->priv; 862 struct wl3501_card *this = netdev_priv(dev);
863 863
864 printk(KERN_INFO "%s: Wireless LAN online. BSSID: " 864 printk(KERN_INFO "%s: Wireless LAN online. BSSID: "
865 "%02X %02X %02X %02X %02X %02X\n", dev->name, 865 "%02X %02X %02X %02X %02X %02X\n", dev->name,
@@ -907,7 +907,7 @@ static int wl3501_mgmt_association(struct wl3501_card *this)
907 907
908static void wl3501_mgmt_join_confirm(struct net_device *dev, u16 addr) 908static void wl3501_mgmt_join_confirm(struct net_device *dev, u16 addr)
909{ 909{
910 struct wl3501_card *this = dev->priv; 910 struct wl3501_card *this = netdev_priv(dev);
911 struct wl3501_join_confirm sig; 911 struct wl3501_join_confirm sig;
912 912
913 dprintk(3, "entry"); 913 dprintk(3, "entry");
@@ -1046,7 +1046,7 @@ static inline void wl3501_start_confirm_interrupt(struct net_device *dev,
1046static inline void wl3501_assoc_confirm_interrupt(struct net_device *dev, 1046static inline void wl3501_assoc_confirm_interrupt(struct net_device *dev,
1047 u16 addr) 1047 u16 addr)
1048{ 1048{
1049 struct wl3501_card *this = dev->priv; 1049 struct wl3501_card *this = netdev_priv(dev);
1050 struct wl3501_assoc_confirm sig; 1050 struct wl3501_assoc_confirm sig;
1051 1051
1052 dprintk(3, "entry"); 1052 dprintk(3, "entry");
@@ -1075,7 +1075,7 @@ static inline void wl3501_rx_interrupt(struct net_device *dev)
1075 int morepkts; 1075 int morepkts;
1076 u16 addr; 1076 u16 addr;
1077 u8 sig_id; 1077 u8 sig_id;
1078 struct wl3501_card *this = dev->priv; 1078 struct wl3501_card *this = netdev_priv(dev);
1079 1079
1080 dprintk(3, "entry"); 1080 dprintk(3, "entry");
1081loop: 1081loop:
@@ -1257,7 +1257,7 @@ fail:
1257 1257
1258static int wl3501_close(struct net_device *dev) 1258static int wl3501_close(struct net_device *dev)
1259{ 1259{
1260 struct wl3501_card *this = dev->priv; 1260 struct wl3501_card *this = netdev_priv(dev);
1261 int rc = -ENODEV; 1261 int rc = -ENODEV;
1262 unsigned long flags; 1262 unsigned long flags;
1263 struct pcmcia_device *link; 1263 struct pcmcia_device *link;
@@ -1289,7 +1289,7 @@ static int wl3501_close(struct net_device *dev)
1289 */ 1289 */
1290static int wl3501_reset(struct net_device *dev) 1290static int wl3501_reset(struct net_device *dev)
1291{ 1291{
1292 struct wl3501_card *this = dev->priv; 1292 struct wl3501_card *this = netdev_priv(dev);
1293 int rc = -ENODEV; 1293 int rc = -ENODEV;
1294 1294
1295 wl3501_block_interrupt(this); 1295 wl3501_block_interrupt(this);
@@ -1318,7 +1318,7 @@ out:
1318 1318
1319static void wl3501_tx_timeout(struct net_device *dev) 1319static void wl3501_tx_timeout(struct net_device *dev)
1320{ 1320{
1321 struct wl3501_card *this = dev->priv; 1321 struct wl3501_card *this = netdev_priv(dev);
1322 struct net_device_stats *stats = &this->stats; 1322 struct net_device_stats *stats = &this->stats;
1323 unsigned long flags; 1323 unsigned long flags;
1324 int rc; 1324 int rc;
@@ -1344,7 +1344,7 @@ static void wl3501_tx_timeout(struct net_device *dev)
1344static int wl3501_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 1344static int wl3501_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1345{ 1345{
1346 int enabled, rc; 1346 int enabled, rc;
1347 struct wl3501_card *this = dev->priv; 1347 struct wl3501_card *this = netdev_priv(dev);
1348 unsigned long flags; 1348 unsigned long flags;
1349 1349
1350 spin_lock_irqsave(&this->lock, flags); 1350 spin_lock_irqsave(&this->lock, flags);
@@ -1371,7 +1371,7 @@ static int wl3501_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1371static int wl3501_open(struct net_device *dev) 1371static int wl3501_open(struct net_device *dev)
1372{ 1372{
1373 int rc = -ENODEV; 1373 int rc = -ENODEV;
1374 struct wl3501_card *this = dev->priv; 1374 struct wl3501_card *this = netdev_priv(dev);
1375 unsigned long flags; 1375 unsigned long flags;
1376 struct pcmcia_device *link; 1376 struct pcmcia_device *link;
1377 link = this->p_dev; 1377 link = this->p_dev;
@@ -1410,14 +1410,14 @@ fail:
1410 1410
1411static struct net_device_stats *wl3501_get_stats(struct net_device *dev) 1411static struct net_device_stats *wl3501_get_stats(struct net_device *dev)
1412{ 1412{
1413 struct wl3501_card *this = dev->priv; 1413 struct wl3501_card *this = netdev_priv(dev);
1414 1414
1415 return &this->stats; 1415 return &this->stats;
1416} 1416}
1417 1417
1418static struct iw_statistics *wl3501_get_wireless_stats(struct net_device *dev) 1418static struct iw_statistics *wl3501_get_wireless_stats(struct net_device *dev)
1419{ 1419{
1420 struct wl3501_card *this = dev->priv; 1420 struct wl3501_card *this = netdev_priv(dev);
1421 struct iw_statistics *wstats = &this->wstats; 1421 struct iw_statistics *wstats = &this->wstats;
1422 u32 value; /* size checked: it is u32 */ 1422 u32 value; /* size checked: it is u32 */
1423 1423
@@ -1497,7 +1497,7 @@ static int wl3501_get_name(struct net_device *dev, struct iw_request_info *info,
1497static int wl3501_set_freq(struct net_device *dev, struct iw_request_info *info, 1497static int wl3501_set_freq(struct net_device *dev, struct iw_request_info *info,
1498 union iwreq_data *wrqu, char *extra) 1498 union iwreq_data *wrqu, char *extra)
1499{ 1499{
1500 struct wl3501_card *this = dev->priv; 1500 struct wl3501_card *this = netdev_priv(dev);
1501 int channel = wrqu->freq.m; 1501 int channel = wrqu->freq.m;
1502 int rc = -EINVAL; 1502 int rc = -EINVAL;
1503 1503
@@ -1511,7 +1511,7 @@ static int wl3501_set_freq(struct net_device *dev, struct iw_request_info *info,
1511static int wl3501_get_freq(struct net_device *dev, struct iw_request_info *info, 1511static int wl3501_get_freq(struct net_device *dev, struct iw_request_info *info,
1512 union iwreq_data *wrqu, char *extra) 1512 union iwreq_data *wrqu, char *extra)
1513{ 1513{
1514 struct wl3501_card *this = dev->priv; 1514 struct wl3501_card *this = netdev_priv(dev);
1515 1515
1516 wrqu->freq.m = wl3501_chan2freq[this->chan - 1] * 100000; 1516 wrqu->freq.m = wl3501_chan2freq[this->chan - 1] * 100000;
1517 wrqu->freq.e = 1; 1517 wrqu->freq.e = 1;
@@ -1526,7 +1526,7 @@ static int wl3501_set_mode(struct net_device *dev, struct iw_request_info *info,
1526 if (wrqu->mode == IW_MODE_INFRA || 1526 if (wrqu->mode == IW_MODE_INFRA ||
1527 wrqu->mode == IW_MODE_ADHOC || 1527 wrqu->mode == IW_MODE_ADHOC ||
1528 wrqu->mode == IW_MODE_AUTO) { 1528 wrqu->mode == IW_MODE_AUTO) {
1529 struct wl3501_card *this = dev->priv; 1529 struct wl3501_card *this = netdev_priv(dev);
1530 1530
1531 this->net_type = wrqu->mode; 1531 this->net_type = wrqu->mode;
1532 rc = wl3501_reset(dev); 1532 rc = wl3501_reset(dev);
@@ -1537,7 +1537,7 @@ static int wl3501_set_mode(struct net_device *dev, struct iw_request_info *info,
1537static int wl3501_get_mode(struct net_device *dev, struct iw_request_info *info, 1537static int wl3501_get_mode(struct net_device *dev, struct iw_request_info *info,
1538 union iwreq_data *wrqu, char *extra) 1538 union iwreq_data *wrqu, char *extra)
1539{ 1539{
1540 struct wl3501_card *this = dev->priv; 1540 struct wl3501_card *this = netdev_priv(dev);
1541 1541
1542 wrqu->mode = this->net_type; 1542 wrqu->mode = this->net_type;
1543 return 0; 1543 return 0;
@@ -1546,7 +1546,7 @@ static int wl3501_get_mode(struct net_device *dev, struct iw_request_info *info,
1546static int wl3501_get_sens(struct net_device *dev, struct iw_request_info *info, 1546static int wl3501_get_sens(struct net_device *dev, struct iw_request_info *info,
1547 union iwreq_data *wrqu, char *extra) 1547 union iwreq_data *wrqu, char *extra)
1548{ 1548{
1549 struct wl3501_card *this = dev->priv; 1549 struct wl3501_card *this = netdev_priv(dev);
1550 1550
1551 wrqu->sens.value = this->rssi; 1551 wrqu->sens.value = this->rssi;
1552 wrqu->sens.disabled = !wrqu->sens.value; 1552 wrqu->sens.disabled = !wrqu->sens.value;
@@ -1577,7 +1577,7 @@ static int wl3501_get_range(struct net_device *dev,
1577static int wl3501_set_wap(struct net_device *dev, struct iw_request_info *info, 1577static int wl3501_set_wap(struct net_device *dev, struct iw_request_info *info,
1578 union iwreq_data *wrqu, char *extra) 1578 union iwreq_data *wrqu, char *extra)
1579{ 1579{
1580 struct wl3501_card *this = dev->priv; 1580 struct wl3501_card *this = netdev_priv(dev);
1581 static const u8 bcast[ETH_ALEN] = { 255, 255, 255, 255, 255, 255 }; 1581 static const u8 bcast[ETH_ALEN] = { 255, 255, 255, 255, 255, 255 };
1582 int rc = -EINVAL; 1582 int rc = -EINVAL;
1583 1583
@@ -1597,7 +1597,7 @@ out:
1597static int wl3501_get_wap(struct net_device *dev, struct iw_request_info *info, 1597static int wl3501_get_wap(struct net_device *dev, struct iw_request_info *info,
1598 union iwreq_data *wrqu, char *extra) 1598 union iwreq_data *wrqu, char *extra)
1599{ 1599{
1600 struct wl3501_card *this = dev->priv; 1600 struct wl3501_card *this = netdev_priv(dev);
1601 1601
1602 wrqu->ap_addr.sa_family = ARPHRD_ETHER; 1602 wrqu->ap_addr.sa_family = ARPHRD_ETHER;
1603 memcpy(wrqu->ap_addr.sa_data, this->bssid, ETH_ALEN); 1603 memcpy(wrqu->ap_addr.sa_data, this->bssid, ETH_ALEN);
@@ -1616,7 +1616,7 @@ static int wl3501_set_scan(struct net_device *dev, struct iw_request_info *info,
1616static int wl3501_get_scan(struct net_device *dev, struct iw_request_info *info, 1616static int wl3501_get_scan(struct net_device *dev, struct iw_request_info *info,
1617 union iwreq_data *wrqu, char *extra) 1617 union iwreq_data *wrqu, char *extra)
1618{ 1618{
1619 struct wl3501_card *this = dev->priv; 1619 struct wl3501_card *this = netdev_priv(dev);
1620 int i; 1620 int i;
1621 char *current_ev = extra; 1621 char *current_ev = extra;
1622 struct iw_event iwe; 1622 struct iw_event iwe;
@@ -1666,7 +1666,7 @@ static int wl3501_set_essid(struct net_device *dev,
1666 struct iw_request_info *info, 1666 struct iw_request_info *info,
1667 union iwreq_data *wrqu, char *extra) 1667 union iwreq_data *wrqu, char *extra)
1668{ 1668{
1669 struct wl3501_card *this = dev->priv; 1669 struct wl3501_card *this = netdev_priv(dev);
1670 1670
1671 if (wrqu->data.flags) { 1671 if (wrqu->data.flags) {
1672 iw_set_mgmt_info_element(IW_MGMT_INFO_ELEMENT_SSID, 1672 iw_set_mgmt_info_element(IW_MGMT_INFO_ELEMENT_SSID,
@@ -1683,7 +1683,7 @@ static int wl3501_get_essid(struct net_device *dev,
1683 struct iw_request_info *info, 1683 struct iw_request_info *info,
1684 union iwreq_data *wrqu, char *extra) 1684 union iwreq_data *wrqu, char *extra)
1685{ 1685{
1686 struct wl3501_card *this = dev->priv; 1686 struct wl3501_card *this = netdev_priv(dev);
1687 unsigned long flags; 1687 unsigned long flags;
1688 1688
1689 spin_lock_irqsave(&this->lock, flags); 1689 spin_lock_irqsave(&this->lock, flags);
@@ -1697,7 +1697,7 @@ static int wl3501_get_essid(struct net_device *dev,
1697static int wl3501_set_nick(struct net_device *dev, struct iw_request_info *info, 1697static int wl3501_set_nick(struct net_device *dev, struct iw_request_info *info,
1698 union iwreq_data *wrqu, char *extra) 1698 union iwreq_data *wrqu, char *extra)
1699{ 1699{
1700 struct wl3501_card *this = dev->priv; 1700 struct wl3501_card *this = netdev_priv(dev);
1701 1701
1702 if (wrqu->data.length > sizeof(this->nick)) 1702 if (wrqu->data.length > sizeof(this->nick))
1703 return -E2BIG; 1703 return -E2BIG;
@@ -1708,7 +1708,7 @@ static int wl3501_set_nick(struct net_device *dev, struct iw_request_info *info,
1708static int wl3501_get_nick(struct net_device *dev, struct iw_request_info *info, 1708static int wl3501_get_nick(struct net_device *dev, struct iw_request_info *info,
1709 union iwreq_data *wrqu, char *extra) 1709 union iwreq_data *wrqu, char *extra)
1710{ 1710{
1711 struct wl3501_card *this = dev->priv; 1711 struct wl3501_card *this = netdev_priv(dev);
1712 1712
1713 strlcpy(extra, this->nick, 32); 1713 strlcpy(extra, this->nick, 32);
1714 wrqu->data.length = strlen(extra); 1714 wrqu->data.length = strlen(extra);
@@ -1733,7 +1733,7 @@ static int wl3501_get_rts_threshold(struct net_device *dev,
1733 union iwreq_data *wrqu, char *extra) 1733 union iwreq_data *wrqu, char *extra)
1734{ 1734{
1735 u16 threshold; /* size checked: it is u16 */ 1735 u16 threshold; /* size checked: it is u16 */
1736 struct wl3501_card *this = dev->priv; 1736 struct wl3501_card *this = netdev_priv(dev);
1737 int rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_RTS_THRESHOLD, 1737 int rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_RTS_THRESHOLD,
1738 &threshold, sizeof(threshold)); 1738 &threshold, sizeof(threshold));
1739 if (!rc) { 1739 if (!rc) {
@@ -1749,7 +1749,7 @@ static int wl3501_get_frag_threshold(struct net_device *dev,
1749 union iwreq_data *wrqu, char *extra) 1749 union iwreq_data *wrqu, char *extra)
1750{ 1750{
1751 u16 threshold; /* size checked: it is u16 */ 1751 u16 threshold; /* size checked: it is u16 */
1752 struct wl3501_card *this = dev->priv; 1752 struct wl3501_card *this = netdev_priv(dev);
1753 int rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_FRAG_THRESHOLD, 1753 int rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_FRAG_THRESHOLD,
1754 &threshold, sizeof(threshold)); 1754 &threshold, sizeof(threshold));
1755 if (!rc) { 1755 if (!rc) {
@@ -1765,7 +1765,7 @@ static int wl3501_get_txpow(struct net_device *dev,
1765 union iwreq_data *wrqu, char *extra) 1765 union iwreq_data *wrqu, char *extra)
1766{ 1766{
1767 u16 txpow; 1767 u16 txpow;
1768 struct wl3501_card *this = dev->priv; 1768 struct wl3501_card *this = netdev_priv(dev);
1769 int rc = wl3501_get_mib_value(this, 1769 int rc = wl3501_get_mib_value(this,
1770 WL3501_MIB_ATTR_CURRENT_TX_PWR_LEVEL, 1770 WL3501_MIB_ATTR_CURRENT_TX_PWR_LEVEL,
1771 &txpow, sizeof(txpow)); 1771 &txpow, sizeof(txpow));
@@ -1787,7 +1787,7 @@ static int wl3501_get_retry(struct net_device *dev,
1787 union iwreq_data *wrqu, char *extra) 1787 union iwreq_data *wrqu, char *extra)
1788{ 1788{
1789 u8 retry; /* size checked: it is u8 */ 1789 u8 retry; /* size checked: it is u8 */
1790 struct wl3501_card *this = dev->priv; 1790 struct wl3501_card *this = netdev_priv(dev);
1791 int rc = wl3501_get_mib_value(this, 1791 int rc = wl3501_get_mib_value(this,
1792 WL3501_MIB_ATTR_LONG_RETRY_LIMIT, 1792 WL3501_MIB_ATTR_LONG_RETRY_LIMIT,
1793 &retry, sizeof(retry)); 1793 &retry, sizeof(retry));
@@ -1814,7 +1814,7 @@ static int wl3501_get_encode(struct net_device *dev,
1814 union iwreq_data *wrqu, char *extra) 1814 union iwreq_data *wrqu, char *extra)
1815{ 1815{
1816 u8 implemented, restricted, keys[100], len_keys, tocopy; 1816 u8 implemented, restricted, keys[100], len_keys, tocopy;
1817 struct wl3501_card *this = dev->priv; 1817 struct wl3501_card *this = netdev_priv(dev);
1818 int rc = wl3501_get_mib_value(this, 1818 int rc = wl3501_get_mib_value(this,
1819 WL3501_MIB_ATTR_PRIV_OPT_IMPLEMENTED, 1819 WL3501_MIB_ATTR_PRIV_OPT_IMPLEMENTED,
1820 &implemented, sizeof(implemented)); 1820 &implemented, sizeof(implemented));
@@ -1852,7 +1852,7 @@ static int wl3501_get_power(struct net_device *dev,
1852 union iwreq_data *wrqu, char *extra) 1852 union iwreq_data *wrqu, char *extra)
1853{ 1853{
1854 u8 pwr_state; 1854 u8 pwr_state;
1855 struct wl3501_card *this = dev->priv; 1855 struct wl3501_card *this = netdev_priv(dev);
1856 int rc = wl3501_get_mib_value(this, 1856 int rc = wl3501_get_mib_value(this,
1857 WL3501_MIB_ATTR_CURRENT_PWR_STATE, 1857 WL3501_MIB_ATTR_CURRENT_PWR_STATE,
1858 &pwr_state, sizeof(pwr_state)); 1858 &pwr_state, sizeof(pwr_state));
@@ -1937,7 +1937,7 @@ static int wl3501_probe(struct pcmcia_device *p_dev)
1937 dev->tx_timeout = wl3501_tx_timeout; 1937 dev->tx_timeout = wl3501_tx_timeout;
1938 dev->watchdog_timeo = 5 * HZ; 1938 dev->watchdog_timeo = 5 * HZ;
1939 dev->get_stats = wl3501_get_stats; 1939 dev->get_stats = wl3501_get_stats;
1940 this = dev->priv; 1940 this = netdev_priv(dev);
1941 this->wireless_data.spy_data = &this->spy_data; 1941 this->wireless_data.spy_data = &this->spy_data;
1942 this->p_dev = p_dev; 1942 this->p_dev = p_dev;
1943 dev->wireless_data = &this->wireless_data; 1943 dev->wireless_data = &this->wireless_data;
@@ -2006,7 +2006,7 @@ static int wl3501_config(struct pcmcia_device *link)
2006 2006
2007 SET_MODULE_OWNER(dev); 2007 SET_MODULE_OWNER(dev);
2008 2008
2009 this = dev->priv; 2009 this = netdev_priv(dev);
2010 /* 2010 /*
2011 * At this point, the dev_node_t structure(s) should be initialized and 2011 * At this point, the dev_node_t structure(s) should be initialized and
2012 * arranged in a linked list at link->dev_node. 2012 * arranged in a linked list at link->dev_node.
@@ -2079,7 +2079,7 @@ static int wl3501_suspend(struct pcmcia_device *link)
2079{ 2079{
2080 struct net_device *dev = link->priv; 2080 struct net_device *dev = link->priv;
2081 2081
2082 wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND); 2082 wl3501_pwr_mgmt(netdev_priv(dev), WL3501_SUSPEND);
2083 if (link->open) 2083 if (link->open)
2084 netif_device_detach(dev); 2084 netif_device_detach(dev);
2085 2085
@@ -2090,7 +2090,7 @@ static int wl3501_resume(struct pcmcia_device *link)
2090{ 2090{
2091 struct net_device *dev = link->priv; 2091 struct net_device *dev = link->priv;
2092 2092
2093 wl3501_pwr_mgmt(dev->priv, WL3501_RESUME); 2093 wl3501_pwr_mgmt(netdev_priv(dev), WL3501_RESUME);
2094 if (link->open) { 2094 if (link->open) {
2095 wl3501_reset(dev); 2095 wl3501_reset(dev);
2096 netif_device_attach(dev); 2096 netif_device_attach(dev);