提交 d30506e0 编写于 作者: J John W. Linville

rtl8187: remove priv->mode

It is checked in add_interface, but there it is easily replaced with
a check of priv->vif.  If that information should become necessary,
it is available in vif->type anyway.

It is also checked in led_turn_on and led_turn_off, where I made the
substitutions as described above.  Of course, these checks seem to
have been incorrect since the driver was using NL80211_IFTYPE_MONITOR
to indicate no interface rather than NL80211_IFTYPE_UNSPECIFIED.
Anyway, I think these checks may be extraneous...?
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 643aab67
......@@ -92,7 +92,7 @@ struct rtl8187_priv {
struct rtl818x_csr *map;
const struct rtl818x_rf_ops *rf;
struct ieee80211_vif *vif;
int mode;
/* The mutex protects the TX loopback state.
* Any attempt to set channels concurrently locks the device.
*/
......
......@@ -1025,12 +1025,11 @@ static int rtl8187_add_interface(struct ieee80211_hw *dev,
int ret = -EOPNOTSUPP;
mutex_lock(&priv->conf_mutex);
if (priv->mode != NL80211_IFTYPE_MONITOR)
if (priv->vif)
goto exit;
switch (conf->type) {
case NL80211_IFTYPE_STATION:
priv->mode = conf->type;
break;
default:
goto exit;
......@@ -1055,7 +1054,6 @@ static void rtl8187_remove_interface(struct ieee80211_hw *dev,
{
struct rtl8187_priv *priv = dev->priv;
mutex_lock(&priv->conf_mutex);
priv->mode = NL80211_IFTYPE_MONITOR;
priv->vif = NULL;
mutex_unlock(&priv->conf_mutex);
}
......@@ -1365,7 +1363,6 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
priv->mode = NL80211_IFTYPE_MONITOR;
dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_RX_INCLUDES_FCS;
......
......@@ -33,7 +33,7 @@ static void led_turn_on(struct work_struct *work)
struct rtl8187_led *led = &priv->led_tx;
/* Don't change the LED, when the device is down. */
if (priv->mode == NL80211_IFTYPE_UNSPECIFIED)
if (!priv->vif || priv->vif->type == NL80211_IFTYPE_UNSPECIFIED)
return ;
/* Skip if the LED is not registered. */
......@@ -71,7 +71,7 @@ static void led_turn_off(struct work_struct *work)
struct rtl8187_led *led = &priv->led_tx;
/* Don't change the LED, when the device is down. */
if (priv->mode == NL80211_IFTYPE_UNSPECIFIED)
if (!priv->vif || priv->vif->type == NL80211_IFTYPE_UNSPECIFIED)
return ;
/* Skip if the LED is not registered. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册