]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] rt2x00: Pass dev_state to rt2x00lib_toggle_rx
authorIvo van Doorn <ivdoorn@gmail.com>
Sat, 6 Oct 2007 12:16:09 +0000 (14:16 +0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:55:14 +0000 (16:55 -0700)
Directly pass a value from the enum dev_state with rt2x00lib_toggle_rx,
this will save us a ? : statement, and it is clearer then passing a 1 0
argument.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00lib.h
drivers/net/wireless/rt2x00/rt2x00mac.c

index 6dc4f63aef0a19403af4e0b9d9391676de9d24c1..e1410486917240cc59c40173d14cfda22638b9c6 100644 (file)
@@ -120,7 +120,7 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev)
        /*
         * Enable RX.
         */
-       rt2x00lib_toggle_rx(rt2x00dev, 1);
+       rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
 
        /*
         * Start the TX queues.
@@ -151,7 +151,7 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
        /*
         * Disable RX.
         */
-       rt2x00lib_toggle_rx(rt2x00dev, 0);
+       rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
 
        /*
         * Disable radio.
@@ -159,14 +159,12 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
        rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_OFF);
 }
 
-void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, int enable)
+void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, enum dev_state state)
 {
-       enum dev_state state = enable ? STATE_RADIO_RX_ON : STATE_RADIO_RX_OFF;
-
        /*
         * When we are disabling the RX, we should also stop the link tuner.
         */
-       if (!enable)
+       if (state == STATE_RADIO_RX_OFF)
                rt2x00lib_stop_link_tuner(rt2x00dev);
 
        rt2x00dev->ops->lib->set_device_state(rt2x00dev, state);
@@ -174,7 +172,8 @@ void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, int enable)
        /*
         * When we are enabling the RX, we should also start the link tuner.
         */
-       if (enable && is_interface_present(&rt2x00dev->interface))
+       if (state == STATE_RADIO_RX_ON &&
+           is_interface_present(&rt2x00dev->interface))
                rt2x00lib_start_link_tuner(rt2x00dev);
 }
 
index 29ca932d77aba5ef9362ac1d224b7bab12d782ff..298faa9d3f61520a79565eff5194c744b835d4a9 100644 (file)
@@ -38,7 +38,7 @@
  */
 int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev);
 void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev);
-void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, int enable);
+void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, enum dev_state state);
 void rt2x00lib_reset_link_tuner(struct rt2x00_dev *rt2x00dev);
 
 /*
index e98d013a189f30e4785b05922c752a6382931d19..f519d73968480fc5fb1686178215fac367ac20b1 100644 (file)
@@ -272,7 +272,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
                if (!conf->radio_enabled)
                        rt2x00lib_disable_radio(rt2x00dev);
                else
-                       rt2x00lib_toggle_rx(rt2x00dev, 0);
+                       rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
        }
 
        rt2x00lib_config(rt2x00dev, conf, 0);
@@ -281,7 +281,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
         * Reenable RX only if the radio should be on.
         */
        if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
-               rt2x00lib_toggle_rx(rt2x00dev, 1);
+               rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
        else if (conf->radio_enabled)
                return rt2x00lib_enable_radio(rt2x00dev);