aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2x00
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2009-05-01 02:02:47 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-06 15:15:01 -0400
commit928841b1538df117658ec5977bcf336c27f7747b (patch)
treeea2b5ac0353b5bbdab4c10402403a0da5a108bd4 /drivers/net/wireless/ipw2x00
parent8bce6121706dd82c266c3f527e592abfb3e164d1 (diff)
Wireless: remove driver_data direct access of struct device
In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions. Cc: John W. Linville <linville@tuxdriver.com> Cc: linux-wireless@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ipw2x00')
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c8
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c47
2 files changed, 28 insertions, 27 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 97e5647ff050..742432388ca3 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -3488,7 +3488,7 @@ static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL);
3488static ssize_t show_cfg(struct device *d, struct device_attribute *attr, 3488static ssize_t show_cfg(struct device *d, struct device_attribute *attr,
3489 char *buf) 3489 char *buf)
3490{ 3490{
3491 struct ipw2100_priv *p = d->driver_data; 3491 struct ipw2100_priv *p = dev_get_drvdata(d);
3492 return sprintf(buf, "0x%08x\n", (int)p->config); 3492 return sprintf(buf, "0x%08x\n", (int)p->config);
3493} 3493}
3494 3494
@@ -3497,7 +3497,7 @@ static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL);
3497static ssize_t show_status(struct device *d, struct device_attribute *attr, 3497static ssize_t show_status(struct device *d, struct device_attribute *attr,
3498 char *buf) 3498 char *buf)
3499{ 3499{
3500 struct ipw2100_priv *p = d->driver_data; 3500 struct ipw2100_priv *p = dev_get_drvdata(d);
3501 return sprintf(buf, "0x%08x\n", (int)p->status); 3501 return sprintf(buf, "0x%08x\n", (int)p->status);
3502} 3502}
3503 3503
@@ -3506,7 +3506,7 @@ static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
3506static ssize_t show_capability(struct device *d, struct device_attribute *attr, 3506static ssize_t show_capability(struct device *d, struct device_attribute *attr,
3507 char *buf) 3507 char *buf)
3508{ 3508{
3509 struct ipw2100_priv *p = d->driver_data; 3509 struct ipw2100_priv *p = dev_get_drvdata(d);
3510 return sprintf(buf, "0x%08x\n", (int)p->capability); 3510 return sprintf(buf, "0x%08x\n", (int)p->capability);
3511} 3511}
3512 3512
@@ -4224,7 +4224,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr,
4224 1 - SW based RF kill active (sysfs) 4224 1 - SW based RF kill active (sysfs)
4225 2 - HW based RF kill active 4225 2 - HW based RF kill active
4226 3 - Both HW and SW baed RF kill active */ 4226 3 - Both HW and SW baed RF kill active */
4227 struct ipw2100_priv *priv = (struct ipw2100_priv *)d->driver_data; 4227 struct ipw2100_priv *priv = dev_get_drvdata(d);
4228 int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | 4228 int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) |
4229 (rf_kill_active(priv) ? 0x2 : 0x0); 4229 (rf_kill_active(priv) ? 0x2 : 0x0);
4230 return sprintf(buf, "%i\n", val); 4230 return sprintf(buf, "%i\n", val);
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 9a123fbcc359..c3b3dfe43d1a 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -1527,7 +1527,7 @@ static DEVICE_ATTR(led, S_IWUSR | S_IRUGO, show_led, store_led);
1527static ssize_t show_status(struct device *d, 1527static ssize_t show_status(struct device *d,
1528 struct device_attribute *attr, char *buf) 1528 struct device_attribute *attr, char *buf)
1529{ 1529{
1530 struct ipw_priv *p = d->driver_data; 1530 struct ipw_priv *p = dev_get_drvdata(d);
1531 return sprintf(buf, "0x%08x\n", (int)p->status); 1531 return sprintf(buf, "0x%08x\n", (int)p->status);
1532} 1532}
1533 1533
@@ -1536,7 +1536,7 @@ static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
1536static ssize_t show_cfg(struct device *d, struct device_attribute *attr, 1536static ssize_t show_cfg(struct device *d, struct device_attribute *attr,
1537 char *buf) 1537 char *buf)
1538{ 1538{
1539 struct ipw_priv *p = d->driver_data; 1539 struct ipw_priv *p = dev_get_drvdata(d);
1540 return sprintf(buf, "0x%08x\n", (int)p->config); 1540 return sprintf(buf, "0x%08x\n", (int)p->config);
1541} 1541}
1542 1542
@@ -1545,7 +1545,7 @@ static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL);
1545static ssize_t show_nic_type(struct device *d, 1545static ssize_t show_nic_type(struct device *d,
1546 struct device_attribute *attr, char *buf) 1546 struct device_attribute *attr, char *buf)
1547{ 1547{
1548 struct ipw_priv *priv = d->driver_data; 1548 struct ipw_priv *priv = dev_get_drvdata(d);
1549 return sprintf(buf, "TYPE: %d\n", priv->nic_type); 1549 return sprintf(buf, "TYPE: %d\n", priv->nic_type);
1550} 1550}
1551 1551
@@ -1555,7 +1555,7 @@ static ssize_t show_ucode_version(struct device *d,
1555 struct device_attribute *attr, char *buf) 1555 struct device_attribute *attr, char *buf)
1556{ 1556{
1557 u32 len = sizeof(u32), tmp = 0; 1557 u32 len = sizeof(u32), tmp = 0;
1558 struct ipw_priv *p = d->driver_data; 1558 struct ipw_priv *p = dev_get_drvdata(d);
1559 1559
1560 if (ipw_get_ordinal(p, IPW_ORD_STAT_UCODE_VERSION, &tmp, &len)) 1560 if (ipw_get_ordinal(p, IPW_ORD_STAT_UCODE_VERSION, &tmp, &len))
1561 return 0; 1561 return 0;
@@ -1569,7 +1569,7 @@ static ssize_t show_rtc(struct device *d, struct device_attribute *attr,
1569 char *buf) 1569 char *buf)
1570{ 1570{
1571 u32 len = sizeof(u32), tmp = 0; 1571 u32 len = sizeof(u32), tmp = 0;
1572 struct ipw_priv *p = d->driver_data; 1572 struct ipw_priv *p = dev_get_drvdata(d);
1573 1573
1574 if (ipw_get_ordinal(p, IPW_ORD_STAT_RTC, &tmp, &len)) 1574 if (ipw_get_ordinal(p, IPW_ORD_STAT_RTC, &tmp, &len))
1575 return 0; 1575 return 0;
@@ -1586,14 +1586,15 @@ static DEVICE_ATTR(rtc, S_IWUSR | S_IRUGO, show_rtc, NULL);
1586static ssize_t show_eeprom_delay(struct device *d, 1586static ssize_t show_eeprom_delay(struct device *d,
1587 struct device_attribute *attr, char *buf) 1587 struct device_attribute *attr, char *buf)
1588{ 1588{
1589 int n = ((struct ipw_priv *)d->driver_data)->eeprom_delay; 1589 struct ipw_priv *p = dev_get_drvdata(d);
1590 int n = p->eeprom_delay;
1590 return sprintf(buf, "%i\n", n); 1591 return sprintf(buf, "%i\n", n);
1591} 1592}
1592static ssize_t store_eeprom_delay(struct device *d, 1593static ssize_t store_eeprom_delay(struct device *d,
1593 struct device_attribute *attr, 1594 struct device_attribute *attr,
1594 const char *buf, size_t count) 1595 const char *buf, size_t count)
1595{ 1596{
1596 struct ipw_priv *p = d->driver_data; 1597 struct ipw_priv *p = dev_get_drvdata(d);
1597 sscanf(buf, "%i", &p->eeprom_delay); 1598 sscanf(buf, "%i", &p->eeprom_delay);
1598 return strnlen(buf, count); 1599 return strnlen(buf, count);
1599} 1600}
@@ -1605,7 +1606,7 @@ static ssize_t show_command_event_reg(struct device *d,
1605 struct device_attribute *attr, char *buf) 1606 struct device_attribute *attr, char *buf)
1606{ 1607{
1607 u32 reg = 0; 1608 u32 reg = 0;
1608 struct ipw_priv *p = d->driver_data; 1609 struct ipw_priv *p = dev_get_drvdata(d);
1609 1610
1610 reg = ipw_read_reg32(p, IPW_INTERNAL_CMD_EVENT); 1611 reg = ipw_read_reg32(p, IPW_INTERNAL_CMD_EVENT);
1611 return sprintf(buf, "0x%08x\n", reg); 1612 return sprintf(buf, "0x%08x\n", reg);
@@ -1615,7 +1616,7 @@ static ssize_t store_command_event_reg(struct device *d,
1615 const char *buf, size_t count) 1616 const char *buf, size_t count)
1616{ 1617{
1617 u32 reg; 1618 u32 reg;
1618 struct ipw_priv *p = d->driver_data; 1619 struct ipw_priv *p = dev_get_drvdata(d);
1619 1620
1620 sscanf(buf, "%x", &reg); 1621 sscanf(buf, "%x", &reg);
1621 ipw_write_reg32(p, IPW_INTERNAL_CMD_EVENT, reg); 1622 ipw_write_reg32(p, IPW_INTERNAL_CMD_EVENT, reg);
@@ -1629,7 +1630,7 @@ static ssize_t show_mem_gpio_reg(struct device *d,
1629 struct device_attribute *attr, char *buf) 1630 struct device_attribute *attr, char *buf)
1630{ 1631{
1631 u32 reg = 0; 1632 u32 reg = 0;
1632 struct ipw_priv *p = d->driver_data; 1633 struct ipw_priv *p = dev_get_drvdata(d);
1633 1634
1634 reg = ipw_read_reg32(p, 0x301100); 1635 reg = ipw_read_reg32(p, 0x301100);
1635 return sprintf(buf, "0x%08x\n", reg); 1636 return sprintf(buf, "0x%08x\n", reg);
@@ -1639,7 +1640,7 @@ static ssize_t store_mem_gpio_reg(struct device *d,
1639 const char *buf, size_t count) 1640 const char *buf, size_t count)
1640{ 1641{
1641 u32 reg; 1642 u32 reg;
1642 struct ipw_priv *p = d->driver_data; 1643 struct ipw_priv *p = dev_get_drvdata(d);
1643 1644
1644 sscanf(buf, "%x", &reg); 1645 sscanf(buf, "%x", &reg);
1645 ipw_write_reg32(p, 0x301100, reg); 1646 ipw_write_reg32(p, 0x301100, reg);
@@ -1653,7 +1654,7 @@ static ssize_t show_indirect_dword(struct device *d,
1653 struct device_attribute *attr, char *buf) 1654 struct device_attribute *attr, char *buf)
1654{ 1655{
1655 u32 reg = 0; 1656 u32 reg = 0;
1656 struct ipw_priv *priv = d->driver_data; 1657 struct ipw_priv *priv = dev_get_drvdata(d);
1657 1658
1658 if (priv->status & STATUS_INDIRECT_DWORD) 1659 if (priv->status & STATUS_INDIRECT_DWORD)
1659 reg = ipw_read_reg32(priv, priv->indirect_dword); 1660 reg = ipw_read_reg32(priv, priv->indirect_dword);
@@ -1666,7 +1667,7 @@ static ssize_t store_indirect_dword(struct device *d,
1666 struct device_attribute *attr, 1667 struct device_attribute *attr,
1667 const char *buf, size_t count) 1668 const char *buf, size_t count)
1668{ 1669{
1669 struct ipw_priv *priv = d->driver_data; 1670 struct ipw_priv *priv = dev_get_drvdata(d);
1670 1671
1671 sscanf(buf, "%x", &priv->indirect_dword); 1672 sscanf(buf, "%x", &priv->indirect_dword);
1672 priv->status |= STATUS_INDIRECT_DWORD; 1673 priv->status |= STATUS_INDIRECT_DWORD;
@@ -1680,7 +1681,7 @@ static ssize_t show_indirect_byte(struct device *d,
1680 struct device_attribute *attr, char *buf) 1681 struct device_attribute *attr, char *buf)
1681{ 1682{
1682 u8 reg = 0; 1683 u8 reg = 0;
1683 struct ipw_priv *priv = d->driver_data; 1684 struct ipw_priv *priv = dev_get_drvdata(d);
1684 1685
1685 if (priv->status & STATUS_INDIRECT_BYTE) 1686 if (priv->status & STATUS_INDIRECT_BYTE)
1686 reg = ipw_read_reg8(priv, priv->indirect_byte); 1687 reg = ipw_read_reg8(priv, priv->indirect_byte);
@@ -1693,7 +1694,7 @@ static ssize_t store_indirect_byte(struct device *d,
1693 struct device_attribute *attr, 1694 struct device_attribute *attr,
1694 const char *buf, size_t count) 1695 const char *buf, size_t count)
1695{ 1696{
1696 struct ipw_priv *priv = d->driver_data; 1697 struct ipw_priv *priv = dev_get_drvdata(d);
1697 1698
1698 sscanf(buf, "%x", &priv->indirect_byte); 1699 sscanf(buf, "%x", &priv->indirect_byte);
1699 priv->status |= STATUS_INDIRECT_BYTE; 1700 priv->status |= STATUS_INDIRECT_BYTE;
@@ -1707,7 +1708,7 @@ static ssize_t show_direct_dword(struct device *d,
1707 struct device_attribute *attr, char *buf) 1708 struct device_attribute *attr, char *buf)
1708{ 1709{
1709 u32 reg = 0; 1710 u32 reg = 0;
1710 struct ipw_priv *priv = d->driver_data; 1711 struct ipw_priv *priv = dev_get_drvdata(d);
1711 1712
1712 if (priv->status & STATUS_DIRECT_DWORD) 1713 if (priv->status & STATUS_DIRECT_DWORD)
1713 reg = ipw_read32(priv, priv->direct_dword); 1714 reg = ipw_read32(priv, priv->direct_dword);
@@ -1720,7 +1721,7 @@ static ssize_t store_direct_dword(struct device *d,
1720 struct device_attribute *attr, 1721 struct device_attribute *attr,
1721 const char *buf, size_t count) 1722 const char *buf, size_t count)
1722{ 1723{
1723 struct ipw_priv *priv = d->driver_data; 1724 struct ipw_priv *priv = dev_get_drvdata(d);
1724 1725
1725 sscanf(buf, "%x", &priv->direct_dword); 1726 sscanf(buf, "%x", &priv->direct_dword);
1726 priv->status |= STATUS_DIRECT_DWORD; 1727 priv->status |= STATUS_DIRECT_DWORD;
@@ -1747,7 +1748,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr,
1747 1 - SW based RF kill active (sysfs) 1748 1 - SW based RF kill active (sysfs)
1748 2 - HW based RF kill active 1749 2 - HW based RF kill active
1749 3 - Both HW and SW baed RF kill active */ 1750 3 - Both HW and SW baed RF kill active */
1750 struct ipw_priv *priv = d->driver_data; 1751 struct ipw_priv *priv = dev_get_drvdata(d);
1751 int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | 1752 int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) |
1752 (rf_kill_active(priv) ? 0x2 : 0x0); 1753 (rf_kill_active(priv) ? 0x2 : 0x0);
1753 return sprintf(buf, "%i\n", val); 1754 return sprintf(buf, "%i\n", val);
@@ -1791,7 +1792,7 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
1791static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, 1792static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr,
1792 const char *buf, size_t count) 1793 const char *buf, size_t count)
1793{ 1794{
1794 struct ipw_priv *priv = d->driver_data; 1795 struct ipw_priv *priv = dev_get_drvdata(d);
1795 1796
1796 ipw_radio_kill_sw(priv, buf[0] == '1'); 1797 ipw_radio_kill_sw(priv, buf[0] == '1');
1797 1798
@@ -1803,7 +1804,7 @@ static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill);
1803static ssize_t show_speed_scan(struct device *d, struct device_attribute *attr, 1804static ssize_t show_speed_scan(struct device *d, struct device_attribute *attr,
1804 char *buf) 1805 char *buf)
1805{ 1806{
1806 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 1807 struct ipw_priv *priv = dev_get_drvdata(d);
1807 int pos = 0, len = 0; 1808 int pos = 0, len = 0;
1808 if (priv->config & CFG_SPEED_SCAN) { 1809 if (priv->config & CFG_SPEED_SCAN) {
1809 while (priv->speed_scan[pos] != 0) 1810 while (priv->speed_scan[pos] != 0)
@@ -1818,7 +1819,7 @@ static ssize_t show_speed_scan(struct device *d, struct device_attribute *attr,
1818static ssize_t store_speed_scan(struct device *d, struct device_attribute *attr, 1819static ssize_t store_speed_scan(struct device *d, struct device_attribute *attr,
1819 const char *buf, size_t count) 1820 const char *buf, size_t count)
1820{ 1821{
1821 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 1822 struct ipw_priv *priv = dev_get_drvdata(d);
1822 int channel, pos = 0; 1823 int channel, pos = 0;
1823 const char *p = buf; 1824 const char *p = buf;
1824 1825
@@ -1857,14 +1858,14 @@ static DEVICE_ATTR(speed_scan, S_IWUSR | S_IRUGO, show_speed_scan,
1857static ssize_t show_net_stats(struct device *d, struct device_attribute *attr, 1858static ssize_t show_net_stats(struct device *d, struct device_attribute *attr,
1858 char *buf) 1859 char *buf)
1859{ 1860{
1860 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 1861 struct ipw_priv *priv = dev_get_drvdata(d);
1861 return sprintf(buf, "%c\n", (priv->config & CFG_NET_STATS) ? '1' : '0'); 1862 return sprintf(buf, "%c\n", (priv->config & CFG_NET_STATS) ? '1' : '0');
1862} 1863}
1863 1864
1864static ssize_t store_net_stats(struct device *d, struct device_attribute *attr, 1865static ssize_t store_net_stats(struct device *d, struct device_attribute *attr,
1865 const char *buf, size_t count) 1866 const char *buf, size_t count)
1866{ 1867{
1867 struct ipw_priv *priv = (struct ipw_priv *)d->driver_data; 1868 struct ipw_priv *priv = dev_get_drvdata(d);
1868 if (buf[0] == '1') 1869 if (buf[0] == '1')
1869 priv->config |= CFG_NET_STATS; 1870 priv->config |= CFG_NET_STATS;
1870 else 1871 else