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>
This commit is contained in:
committed by
John W. Linville
parent
8bce612170
commit
928841b153
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user