iwl3945: use iwl_led structure
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>
Wed, 11 Mar 2009 18:17:55 +0000 (11:17 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 16 Mar 2009 22:09:46 +0000 (18:09 -0400)
3945 can now use iwl_led's structure from iwlwifi.
Patch also removes CONFIG_IWL3945_LEDS flag from Kconfig as 3945's led
support will now be enabled if user selects CONFIG_IWLWIFI_LEDS.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/Kconfig
drivers/net/wireless/iwlwifi/Makefile
drivers/net/wireless/iwlwifi/iwl-3945-led.c
drivers/net/wireless/iwlwifi/iwl-3945-led.h
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-led.h
drivers/net/wireless/iwlwifi/iwl3945-base.c

index a894deb065d7b20ea913e4fdad773415da64d442..8304f6406a175230173b73c577523b286797c5f0 100644 (file)
@@ -6,11 +6,9 @@ config IWLWIFI
        select MAC80211_LEDS if IWLWIFI_LEDS
        select LEDS_CLASS if IWLWIFI_LEDS
        select RFKILL if IWLWIFI_RFKILL
-       select MAC80211_LEDS if IWL3945_LEDS
-       select LEDS_CLASS if IWL3945_LEDS
 
 config IWLWIFI_LEDS
-       bool "Enable LED support in iwlagn driver"
+       bool "Enable LED support in iwlagn and iwl3945 drivers"
        depends on IWLWIFI
 
 config IWLWIFI_RFKILL
@@ -122,9 +120,3 @@ config IWL3945_SPECTRUM_MEASUREMENT
        depends on IWL3945
        ---help---
          This option will enable spectrum measurement for the iwl3945 driver.
-
-config IWL3945_LEDS
-       bool "Enable LEDS features in iwl3945 driver"
-       depends on IWL3945
-       ---help---
-         This option enables LEDS for the iwl3945 driver.
index d5f8009c5ab775f0bd19dfc77beefa53b740bcd8..d79d97ad61a56d490811231215ffe8f0144184d6 100644 (file)
@@ -16,7 +16,6 @@ iwlagn-$(CONFIG_IWL5000) += iwl-6000.o
 iwlagn-$(CONFIG_IWL5000) += iwl-1000.o
 
 obj-$(CONFIG_IWL3945)  += iwl3945.o
-iwl3945-objs           := iwl3945-base.o iwl-3945.o iwl-3945-rs.o
-iwl3945-$(CONFIG_IWL3945_LEDS) += iwl-3945-led.o
+iwl3945-objs           := iwl3945-base.o iwl-3945.o iwl-3945-rs.o iwl-3945-led.o
 
 
index a973ac13a1d547113b3cb2b4910c08ac518d7b4a..ac22f59be9efdbd3400f87c845c67175141d0391 100644 (file)
@@ -24,6 +24,7 @@
  *
  *****************************************************************************/
 
+#ifdef CONFIG_IWLWIFI_LEDS
 
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -163,8 +164,8 @@ static int iwl3945_led_associated(struct iwl_priv *priv, int led_id)
 static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
                                enum led_brightness brightness)
 {
-       struct iwl3945_led *led = container_of(led_cdev,
-                                              struct iwl3945_led, led_dev);
+       struct iwl_led *led = container_of(led_cdev,
+                                              struct iwl_led, led_dev);
        struct iwl_priv *priv = led->priv;
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
@@ -202,7 +203,7 @@ static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
  * Register led class with the system
  */
 static int iwl3945_led_register_led(struct iwl_priv *priv,
-                                  struct iwl3945_led *led,
+                                  struct iwl_led *led,
                                   enum led_type type, u8 set_led,
                                   char *trigger)
 {
@@ -315,66 +316,66 @@ int iwl3945_led_register(struct iwl_priv *priv)
        priv->allow_blinking = 0;
 
        trigger = ieee80211_get_radio_led_name(priv->hw);
-       snprintf(priv->led39[IWL_LED_TRG_RADIO].name,
-                sizeof(priv->led39[IWL_LED_TRG_RADIO].name), "iwl-%s::radio",
+       snprintf(priv->led[IWL_LED_TRG_RADIO].name,
+                sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s::radio",
                 wiphy_name(priv->hw->wiphy));
 
-       priv->led39[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on;
-       priv->led39[IWL_LED_TRG_RADIO].led_off = iwl3945_led_off;
-       priv->led39[IWL_LED_TRG_RADIO].led_pattern = NULL;
+       priv->led[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on;
+       priv->led[IWL_LED_TRG_RADIO].led_off = iwl3945_led_off;
+       priv->led[IWL_LED_TRG_RADIO].led_pattern = NULL;
 
        ret = iwl3945_led_register_led(priv,
-                                  &priv->led39[IWL_LED_TRG_RADIO],
+                                  &priv->led[IWL_LED_TRG_RADIO],
                                   IWL_LED_TRG_RADIO, 1, trigger);
 
        if (ret)
                goto exit_fail;
 
        trigger = ieee80211_get_assoc_led_name(priv->hw);
-       snprintf(priv->led39[IWL_LED_TRG_ASSOC].name,
-                sizeof(priv->led39[IWL_LED_TRG_ASSOC].name), "iwl-%s::assoc",
+       snprintf(priv->led[IWL_LED_TRG_ASSOC].name,
+                sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s::assoc",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl3945_led_register_led(priv,
-                                  &priv->led39[IWL_LED_TRG_ASSOC],
+                                  &priv->led[IWL_LED_TRG_ASSOC],
                                   IWL_LED_TRG_ASSOC, 0, trigger);
 
        /* for assoc always turn led on */
-       priv->led39[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on;
-       priv->led39[IWL_LED_TRG_ASSOC].led_off = iwl3945_led_on;
-       priv->led39[IWL_LED_TRG_ASSOC].led_pattern = NULL;
+       priv->led[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on;
+       priv->led[IWL_LED_TRG_ASSOC].led_off = iwl3945_led_on;
+       priv->led[IWL_LED_TRG_ASSOC].led_pattern = NULL;
 
        if (ret)
                goto exit_fail;
 
        trigger = ieee80211_get_rx_led_name(priv->hw);
-       snprintf(priv->led39[IWL_LED_TRG_RX].name,
-                sizeof(priv->led39[IWL_LED_TRG_RX].name), "iwl-%s::RX",
+       snprintf(priv->led[IWL_LED_TRG_RX].name,
+                sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s::RX",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl3945_led_register_led(priv,
-                                  &priv->led39[IWL_LED_TRG_RX],
+                                  &priv->led[IWL_LED_TRG_RX],
                                   IWL_LED_TRG_RX, 0, trigger);
 
-       priv->led39[IWL_LED_TRG_RX].led_on = iwl3945_led_associated;
-       priv->led39[IWL_LED_TRG_RX].led_off = iwl3945_led_associated;
-       priv->led39[IWL_LED_TRG_RX].led_pattern = iwl3945_led_pattern;
+       priv->led[IWL_LED_TRG_RX].led_on = iwl3945_led_associated;
+       priv->led[IWL_LED_TRG_RX].led_off = iwl3945_led_associated;
+       priv->led[IWL_LED_TRG_RX].led_pattern = iwl3945_led_pattern;
 
        if (ret)
                goto exit_fail;
 
        trigger = ieee80211_get_tx_led_name(priv->hw);
-       snprintf(priv->led39[IWL_LED_TRG_TX].name,
-                sizeof(priv->led39[IWL_LED_TRG_TX].name), "iwl-%s::TX",
+       snprintf(priv->led[IWL_LED_TRG_TX].name,
+                sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s::TX",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl3945_led_register_led(priv,
-                                  &priv->led39[IWL_LED_TRG_TX],
+                                  &priv->led[IWL_LED_TRG_TX],
                                   IWL_LED_TRG_TX, 0, trigger);
 
-       priv->led39[IWL_LED_TRG_TX].led_on = iwl3945_led_associated;
-       priv->led39[IWL_LED_TRG_TX].led_off = iwl3945_led_associated;
-       priv->led39[IWL_LED_TRG_TX].led_pattern = iwl3945_led_pattern;
+       priv->led[IWL_LED_TRG_TX].led_on = iwl3945_led_associated;
+       priv->led[IWL_LED_TRG_TX].led_off = iwl3945_led_associated;
+       priv->led[IWL_LED_TRG_TX].led_pattern = iwl3945_led_pattern;
 
        if (ret)
                goto exit_fail;
@@ -388,7 +389,7 @@ exit_fail:
 
 
 /* unregister led class */
-static void iwl3945_led_unregister_led(struct iwl3945_led *led, u8 set_led)
+static void iwl3945_led_unregister_led(struct iwl_led *led, u8 set_led)
 {
        if (!led->registered)
                return;
@@ -403,9 +404,10 @@ static void iwl3945_led_unregister_led(struct iwl3945_led *led, u8 set_led)
 /* Unregister all led handlers */
 void iwl3945_led_unregister(struct iwl_priv *priv)
 {
-       iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_ASSOC], 0);
-       iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_RX], 0);
-       iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_TX], 0);
-       iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_RADIO], 1);
+       iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_ASSOC], 0);
+       iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_RX], 0);
+       iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_TX], 0);
+       iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_RADIO], 1);
 }
 
+#endif
index 88185a6ccd6aca02677b468ba42e3c1834ed2e8b..3b65642258cabbb2f7b99b2a0802b2aa1c822f93 100644 (file)
 
 struct iwl_priv;
 
-#ifdef CONFIG_IWL3945_LEDS
+#ifdef CONFIG_IWLWIFI_LEDS
 
 #include "iwl-led.h"
 
-struct iwl3945_led {
-       struct iwl_priv *priv;
-       struct led_classdev led_dev;
-       char name[32];
-
-       int (*led_on) (struct iwl_priv *priv, int led_id);
-       int (*led_off) (struct iwl_priv *priv, int led_id);
-       int (*led_pattern) (struct iwl_priv *priv, int led_id,
-                           unsigned int idx);
-
-       enum led_type type;
-       unsigned int registered;
-};
-
 extern int iwl3945_led_register(struct iwl_priv *priv);
 extern void iwl3945_led_unregister(struct iwl_priv *priv);
 extern void iwl3945_led_background(struct iwl_priv *priv);
@@ -55,6 +41,6 @@ extern void iwl3945_led_background(struct iwl_priv *priv);
 static inline int iwl3945_led_register(struct iwl_priv *priv) { return 0; }
 static inline void iwl3945_led_unregister(struct iwl_priv *priv) {}
 static inline void iwl3945_led_background(struct iwl_priv *priv) {}
-#endif /* CONFIG_IWL3945_LEDS */
 
+#endif /* IWLWIFI_LEDS*/
 #endif /* IWL3945_LEDS_H */
index 0a750534ddf2c3843f7bf9ef3e78d336a66bc5da..9e6f9ec1a2b8f1d6bdf0410063c2c7fb6b4c0dfc 100644 (file)
@@ -554,7 +554,7 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv,
                                   struct ieee80211_rx_status *stats)
 {
        struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
-#ifdef CONFIG_IWL3945_LEDS
+#ifdef CONFIG_IWLWIFI_LEDS
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
 #endif
        struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
@@ -583,7 +583,7 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv,
                                       (struct ieee80211_hdr *)rxb->skb->data,
                                       le32_to_cpu(rx_end->status), stats);
 
-#ifdef CONFIG_IWL3945_LEDS
+#ifdef CONFIG_IWLWIFI_LEDS
        if (ieee80211_is_data(hdr->frame_control))
                priv->rxtxpackets += len;
 #endif
index 21764948833fc84b4418d6a4b0d37207fdb59fc7..0baae80228246f9d72c6705c0e1d02339dae8a01 100644 (file)
@@ -926,19 +926,12 @@ struct iwl_priv {
        struct rfkill *rfkill;
 #endif
 
-#if defined(CONFIG_IWLWIFI_LEDS) || defined(CONFIG_IWL3945_LEDS)
+#ifdef CONFIG_IWLWIFI_LEDS
        unsigned long last_blink_time;
        u8 last_blink_rate;
        u8 allow_blinking;
        u64 led_tpt;
-#endif
-
-#ifdef CONFIG_IWLWIFI_LEDS
        struct iwl_led led[IWL_LED_TRG_MAX];
-#endif
-
-#ifdef CONFIG_IWL3945_LEDS
-       struct iwl3945_led led39[IWL_LED_TRG_MAX];
        unsigned int rxtxpackets;
 #endif
        u16 active_rate;
index 140fd8fa4855713bed968b01d5162565d632d471..ef9b174c37ff7c0ddd28014eb283a4f2ef53914e 100644 (file)
@@ -30,7 +30,7 @@
 
 struct iwl_priv;
 
-#if defined(CONFIG_IWLWIFI_LEDS) || defined(CONFIG_IWL3945_LEDS)
+#ifdef CONFIG_IWLWIFI_LEDS
 #include <linux/leds.h>
 
 #define IWL_LED_SOLID 11
index 6b44c1f13c58a78d32e753e98f0edf42d0a500e5..ae4c89625e5a8bb4c14eeeb39699994db16aa14b 100644 (file)
@@ -890,7 +890,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
                        tx->timeout.pm_frame_timeout = cpu_to_le16(2);
        } else {
                tx->timeout.pm_frame_timeout = 0;
-#ifdef CONFIG_IWL3945_LEDS
+#ifdef CONFIG_IWLWIFI_LEDS
                priv->rxtxpackets += le16_to_cpu(cmd->cmd.tx.len);
 #endif
        }