]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Wireless: remove driver_data direct access of struct device
authorGreg Kroah-Hartman <gregkh@suse.de>
Fri, 1 May 2009 06:02:47 +0000 (23:02 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 6 May 2009 19:15:01 +0000 (15:15 -0400)
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>
drivers/net/wireless/atmel_cs.c
drivers/net/wireless/ipw2x00/ipw2100.c
drivers/net/wireless/ipw2x00/ipw2200.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl3945-base.c

index 77406245dc7b8fb171f82802bd8d4e494747f20e..ddaa859c3491d8209a5e834a1a4d1ec0c59ad05f 100644 (file)
@@ -279,7 +279,7 @@ static int atmel_config(struct pcmcia_device *link)
        struct pcmcia_device_id *did;
 
        dev = link->priv;
-       did = handle_to_dev(link).driver_data;
+       did = dev_get_drvdata(&handle_to_dev(link));
 
        DEBUG(0, "atmel_config(0x%p)\n", link);
 
index 97e5647ff050d665fb7bd5c9f587d1b64f5be046..742432388ca30a11f528aa3cf761d1760c8f6139 100644 (file)
@@ -3488,7 +3488,7 @@ static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL);
 static ssize_t show_cfg(struct device *d, struct device_attribute *attr,
                        char *buf)
 {
-       struct ipw2100_priv *p = d->driver_data;
+       struct ipw2100_priv *p = dev_get_drvdata(d);
        return sprintf(buf, "0x%08x\n", (int)p->config);
 }
 
@@ -3497,7 +3497,7 @@ static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL);
 static ssize_t show_status(struct device *d, struct device_attribute *attr,
                           char *buf)
 {
-       struct ipw2100_priv *p = d->driver_data;
+       struct ipw2100_priv *p = dev_get_drvdata(d);
        return sprintf(buf, "0x%08x\n", (int)p->status);
 }
 
@@ -3506,7 +3506,7 @@ static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
 static ssize_t show_capability(struct device *d, struct device_attribute *attr,
                               char *buf)
 {
-       struct ipw2100_priv *p = d->driver_data;
+       struct ipw2100_priv *p = dev_get_drvdata(d);
        return sprintf(buf, "0x%08x\n", (int)p->capability);
 }
 
@@ -4224,7 +4224,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr,
           1 - SW based RF kill active (sysfs)
           2 - HW based RF kill active
           3 - Both HW and SW baed RF kill active */
-       struct ipw2100_priv *priv = (struct ipw2100_priv *)d->driver_data;
+       struct ipw2100_priv *priv = dev_get_drvdata(d);
        int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) |
            (rf_kill_active(priv) ? 0x2 : 0x0);
        return sprintf(buf, "%i\n", val);
index 9a123fbcc35997408127b9d4bad6aabae2630b26..c3b3dfe43d1afe3a9c3e5398eb619bf0ea2cb277 100644 (file)
@@ -1527,7 +1527,7 @@ static DEVICE_ATTR(led, S_IWUSR | S_IRUGO, show_led, store_led);
 static ssize_t show_status(struct device *d,
                           struct device_attribute *attr, char *buf)
 {
-       struct ipw_priv *p = d->driver_data;
+       struct ipw_priv *p = dev_get_drvdata(d);
        return sprintf(buf, "0x%08x\n", (int)p->status);
 }
 
@@ -1536,7 +1536,7 @@ static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
 static ssize_t show_cfg(struct device *d, struct device_attribute *attr,
                        char *buf)
 {
-       struct ipw_priv *p = d->driver_data;
+       struct ipw_priv *p = dev_get_drvdata(d);
        return sprintf(buf, "0x%08x\n", (int)p->config);
 }
 
@@ -1545,7 +1545,7 @@ static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL);
 static ssize_t show_nic_type(struct device *d,
                             struct device_attribute *attr, char *buf)
 {
-       struct ipw_priv *priv = d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
        return sprintf(buf, "TYPE: %d\n", priv->nic_type);
 }
 
@@ -1555,7 +1555,7 @@ static ssize_t show_ucode_version(struct device *d,
                                  struct device_attribute *attr, char *buf)
 {
        u32 len = sizeof(u32), tmp = 0;
-       struct ipw_priv *p = d->driver_data;
+       struct ipw_priv *p = dev_get_drvdata(d);
 
        if (ipw_get_ordinal(p, IPW_ORD_STAT_UCODE_VERSION, &tmp, &len))
                return 0;
@@ -1569,7 +1569,7 @@ static ssize_t show_rtc(struct device *d, struct device_attribute *attr,
                        char *buf)
 {
        u32 len = sizeof(u32), tmp = 0;
-       struct ipw_priv *p = d->driver_data;
+       struct ipw_priv *p = dev_get_drvdata(d);
 
        if (ipw_get_ordinal(p, IPW_ORD_STAT_RTC, &tmp, &len))
                return 0;
@@ -1586,14 +1586,15 @@ static DEVICE_ATTR(rtc, S_IWUSR | S_IRUGO, show_rtc, NULL);
 static ssize_t show_eeprom_delay(struct device *d,
                                 struct device_attribute *attr, char *buf)
 {
-       int n = ((struct ipw_priv *)d->driver_data)->eeprom_delay;
+       struct ipw_priv *p = dev_get_drvdata(d);
+       int n = p->eeprom_delay;
        return sprintf(buf, "%i\n", n);
 }
 static ssize_t store_eeprom_delay(struct device *d,
                                  struct device_attribute *attr,
                                  const char *buf, size_t count)
 {
-       struct ipw_priv *p = d->driver_data;
+       struct ipw_priv *p = dev_get_drvdata(d);
        sscanf(buf, "%i", &p->eeprom_delay);
        return strnlen(buf, count);
 }
@@ -1605,7 +1606,7 @@ static ssize_t show_command_event_reg(struct device *d,
                                      struct device_attribute *attr, char *buf)
 {
        u32 reg = 0;
-       struct ipw_priv *p = d->driver_data;
+       struct ipw_priv *p = dev_get_drvdata(d);
 
        reg = ipw_read_reg32(p, IPW_INTERNAL_CMD_EVENT);
        return sprintf(buf, "0x%08x\n", reg);
@@ -1615,7 +1616,7 @@ static ssize_t store_command_event_reg(struct device *d,
                                       const char *buf, size_t count)
 {
        u32 reg;
-       struct ipw_priv *p = d->driver_data;
+       struct ipw_priv *p = dev_get_drvdata(d);
 
        sscanf(buf, "%x", &reg);
        ipw_write_reg32(p, IPW_INTERNAL_CMD_EVENT, reg);
@@ -1629,7 +1630,7 @@ static ssize_t show_mem_gpio_reg(struct device *d,
                                 struct device_attribute *attr, char *buf)
 {
        u32 reg = 0;
-       struct ipw_priv *p = d->driver_data;
+       struct ipw_priv *p = dev_get_drvdata(d);
 
        reg = ipw_read_reg32(p, 0x301100);
        return sprintf(buf, "0x%08x\n", reg);
@@ -1639,7 +1640,7 @@ static ssize_t store_mem_gpio_reg(struct device *d,
                                  const char *buf, size_t count)
 {
        u32 reg;
-       struct ipw_priv *p = d->driver_data;
+       struct ipw_priv *p = dev_get_drvdata(d);
 
        sscanf(buf, "%x", &reg);
        ipw_write_reg32(p, 0x301100, reg);
@@ -1653,7 +1654,7 @@ static ssize_t show_indirect_dword(struct device *d,
                                   struct device_attribute *attr, char *buf)
 {
        u32 reg = 0;
-       struct ipw_priv *priv = d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
 
        if (priv->status & STATUS_INDIRECT_DWORD)
                reg = ipw_read_reg32(priv, priv->indirect_dword);
@@ -1666,7 +1667,7 @@ static ssize_t store_indirect_dword(struct device *d,
                                    struct device_attribute *attr,
                                    const char *buf, size_t count)
 {
-       struct ipw_priv *priv = d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
 
        sscanf(buf, "%x", &priv->indirect_dword);
        priv->status |= STATUS_INDIRECT_DWORD;
@@ -1680,7 +1681,7 @@ static ssize_t show_indirect_byte(struct device *d,
                                  struct device_attribute *attr, char *buf)
 {
        u8 reg = 0;
-       struct ipw_priv *priv = d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
 
        if (priv->status & STATUS_INDIRECT_BYTE)
                reg = ipw_read_reg8(priv, priv->indirect_byte);
@@ -1693,7 +1694,7 @@ static ssize_t store_indirect_byte(struct device *d,
                                   struct device_attribute *attr,
                                   const char *buf, size_t count)
 {
-       struct ipw_priv *priv = d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
 
        sscanf(buf, "%x", &priv->indirect_byte);
        priv->status |= STATUS_INDIRECT_BYTE;
@@ -1707,7 +1708,7 @@ static ssize_t show_direct_dword(struct device *d,
                                 struct device_attribute *attr, char *buf)
 {
        u32 reg = 0;
-       struct ipw_priv *priv = d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
 
        if (priv->status & STATUS_DIRECT_DWORD)
                reg = ipw_read32(priv, priv->direct_dword);
@@ -1720,7 +1721,7 @@ static ssize_t store_direct_dword(struct device *d,
                                  struct device_attribute *attr,
                                  const char *buf, size_t count)
 {
-       struct ipw_priv *priv = d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
 
        sscanf(buf, "%x", &priv->direct_dword);
        priv->status |= STATUS_DIRECT_DWORD;
@@ -1747,7 +1748,7 @@ static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr,
           1 - SW based RF kill active (sysfs)
           2 - HW based RF kill active
           3 - Both HW and SW baed RF kill active */
-       struct ipw_priv *priv = d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
        int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) |
            (rf_kill_active(priv) ? 0x2 : 0x0);
        return sprintf(buf, "%i\n", val);
@@ -1791,7 +1792,7 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
 static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr,
                             const char *buf, size_t count)
 {
-       struct ipw_priv *priv = d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
 
        ipw_radio_kill_sw(priv, buf[0] == '1');
 
@@ -1803,7 +1804,7 @@ static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill);
 static ssize_t show_speed_scan(struct device *d, struct device_attribute *attr,
                               char *buf)
 {
-       struct ipw_priv *priv = (struct ipw_priv *)d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
        int pos = 0, len = 0;
        if (priv->config & CFG_SPEED_SCAN) {
                while (priv->speed_scan[pos] != 0)
@@ -1818,7 +1819,7 @@ static ssize_t show_speed_scan(struct device *d, struct device_attribute *attr,
 static ssize_t store_speed_scan(struct device *d, struct device_attribute *attr,
                                const char *buf, size_t count)
 {
-       struct ipw_priv *priv = (struct ipw_priv *)d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
        int channel, pos = 0;
        const char *p = buf;
 
@@ -1857,14 +1858,14 @@ static DEVICE_ATTR(speed_scan, S_IWUSR | S_IRUGO, show_speed_scan,
 static ssize_t show_net_stats(struct device *d, struct device_attribute *attr,
                              char *buf)
 {
-       struct ipw_priv *priv = (struct ipw_priv *)d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
        return sprintf(buf, "%c\n", (priv->config & CFG_NET_STATS) ? '1' : '0');
 }
 
 static ssize_t store_net_stats(struct device *d, struct device_attribute *attr,
                               const char *buf, size_t count)
 {
-       struct ipw_priv *priv = (struct ipw_priv *)d->driver_data;
+       struct ipw_priv *priv = dev_get_drvdata(d);
        if (buf[0] == '1')
                priv->config |= CFG_NET_STATS;
        else
index dd8b15ed8296c731ae9890d9dd81fb9ca55441f4..6cdee0b4b486acecba1b2113aa73e858146f32c2 100644 (file)
@@ -2268,7 +2268,7 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw,
 static ssize_t show_debug_level(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
 
        return sprintf(buf, "0x%08X\n", priv->debug_level);
 }
@@ -2276,7 +2276,7 @@ static ssize_t store_debug_level(struct device *d,
                                struct device_attribute *attr,
                                 const char *buf, size_t count)
 {
-       struct iwl_priv *priv = d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
        unsigned long val;
        int ret;
 
@@ -2299,7 +2299,7 @@ static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
 static ssize_t show_version(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
        struct iwl_alive_resp *palive = &priv->card_alive;
        ssize_t pos = 0;
        u16 eeprom_ver;
@@ -2330,7 +2330,7 @@ static DEVICE_ATTR(version, S_IWUSR | S_IRUGO, show_version, NULL);
 static ssize_t show_temperature(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
 
        if (!iwl_is_alive(priv))
                return -EAGAIN;
@@ -2343,7 +2343,7 @@ static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);
 static ssize_t show_tx_power(struct device *d,
                             struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
 
        if (!iwl_is_ready_rf(priv))
                return sprintf(buf, "off\n");
@@ -2355,7 +2355,7 @@ static ssize_t store_tx_power(struct device *d,
                              struct device_attribute *attr,
                              const char *buf, size_t count)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
        unsigned long val;
        int ret;
 
@@ -2373,7 +2373,7 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);
 static ssize_t show_flags(struct device *d,
                          struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
 
        return sprintf(buf, "0x%04X\n", priv->active_rxon.flags);
 }
@@ -2382,7 +2382,7 @@ static ssize_t store_flags(struct device *d,
                           struct device_attribute *attr,
                           const char *buf, size_t count)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
        unsigned long val;
        u32 flags;
        int ret = strict_strtoul(buf, 0, &val);
@@ -2411,7 +2411,7 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, show_flags, store_flags);
 static ssize_t show_filter_flags(struct device *d,
                                 struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
 
        return sprintf(buf, "0x%04X\n",
                le32_to_cpu(priv->active_rxon.filter_flags));
@@ -2421,7 +2421,7 @@ static ssize_t store_filter_flags(struct device *d,
                                  struct device_attribute *attr,
                                  const char *buf, size_t count)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
        unsigned long val;
        u32 filter_flags;
        int ret = strict_strtoul(buf, 0, &val);
index dc0359ce1ec0ae9afbd66d259969177b8ee49256..9f5191a84a1372c77c801b7a289d4a4e153e7190 100644 (file)
@@ -3595,7 +3595,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 static ssize_t show_debug_level(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
 
        return sprintf(buf, "0x%08X\n", priv->debug_level);
 }
@@ -3603,7 +3603,7 @@ static ssize_t store_debug_level(struct device *d,
                                struct device_attribute *attr,
                                 const char *buf, size_t count)
 {
-       struct iwl_priv *priv = d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
        unsigned long val;
        int ret;
 
@@ -3624,7 +3624,7 @@ static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
 static ssize_t show_temperature(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
 
        if (!iwl_is_alive(priv))
                return -EAGAIN;
@@ -3637,7 +3637,7 @@ static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);
 static ssize_t show_tx_power(struct device *d,
                             struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
        return sprintf(buf, "%d\n", priv->tx_power_user_lmt);
 }
 
@@ -3645,7 +3645,7 @@ static ssize_t store_tx_power(struct device *d,
                              struct device_attribute *attr,
                              const char *buf, size_t count)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
        char *p = (char *)buf;
        u32 val;
 
@@ -3663,7 +3663,7 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);
 static ssize_t show_flags(struct device *d,
                          struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
 
        return sprintf(buf, "0x%04X\n", priv->active_rxon.flags);
 }
@@ -3672,7 +3672,7 @@ static ssize_t store_flags(struct device *d,
                           struct device_attribute *attr,
                           const char *buf, size_t count)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
        u32 flags = simple_strtoul(buf, NULL, 0);
 
        mutex_lock(&priv->mutex);
@@ -3697,7 +3697,7 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, show_flags, store_flags);
 static ssize_t show_filter_flags(struct device *d,
                                 struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
 
        return sprintf(buf, "0x%04X\n",
                le32_to_cpu(priv->active_rxon.filter_flags));
@@ -3707,7 +3707,7 @@ static ssize_t store_filter_flags(struct device *d,
                                  struct device_attribute *attr,
                                  const char *buf, size_t count)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
        u32 filter_flags = simple_strtoul(buf, NULL, 0);
 
        mutex_lock(&priv->mutex);
@@ -3992,7 +3992,7 @@ static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, show_antenna, store_antenna);
 static ssize_t show_status(struct device *d,
                           struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       struct iwl_priv *priv = dev_get_drvdata(d);
        if (!iwl_is_alive(priv))
                return -EAGAIN;
        return sprintf(buf, "0x%08x\n", (int)priv->status);
@@ -4004,10 +4004,11 @@ static ssize_t dump_error_log(struct device *d,
                              struct device_attribute *attr,
                              const char *buf, size_t count)
 {
+       struct iwl_priv *priv = dev_get_drvdata(d);
        char *p = (char *)buf;
 
        if (p[0] == '1')
-               iwl3945_dump_nic_error_log((struct iwl_priv *)d->driver_data);
+               iwl3945_dump_nic_error_log(priv);
 
        return strnlen(buf, count);
 }
@@ -4018,10 +4019,11 @@ static ssize_t dump_event_log(struct device *d,
                              struct device_attribute *attr,
                              const char *buf, size_t count)
 {
+       struct iwl_priv *priv = dev_get_drvdata(d);
        char *p = (char *)buf;
 
        if (p[0] == '1')
-               iwl3945_dump_nic_event_log((struct iwl_priv *)d->driver_data);
+               iwl3945_dump_nic_event_log(priv);
 
        return strnlen(buf, count);
 }