Commit 5c8df2d5 authored by Abhijeet Kolekar's avatar Abhijeet Kolekar Committed by John W. Linville

iwl3945: use iwl_led structure

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: default avatarAbhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent fa11d525
...@@ -6,11 +6,9 @@ config IWLWIFI ...@@ -6,11 +6,9 @@ config IWLWIFI
select MAC80211_LEDS if IWLWIFI_LEDS select MAC80211_LEDS if IWLWIFI_LEDS
select LEDS_CLASS if IWLWIFI_LEDS select LEDS_CLASS if IWLWIFI_LEDS
select RFKILL if IWLWIFI_RFKILL select RFKILL if IWLWIFI_RFKILL
select MAC80211_LEDS if IWL3945_LEDS
select LEDS_CLASS if IWL3945_LEDS
config IWLWIFI_LEDS config IWLWIFI_LEDS
bool "Enable LED support in iwlagn driver" bool "Enable LED support in iwlagn and iwl3945 drivers"
depends on IWLWIFI depends on IWLWIFI
config IWLWIFI_RFKILL config IWLWIFI_RFKILL
...@@ -122,9 +120,3 @@ config IWL3945_SPECTRUM_MEASUREMENT ...@@ -122,9 +120,3 @@ config IWL3945_SPECTRUM_MEASUREMENT
depends on IWL3945 depends on IWL3945
---help--- ---help---
This option will enable spectrum measurement for the iwl3945 driver. 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.
...@@ -16,7 +16,6 @@ iwlagn-$(CONFIG_IWL5000) += iwl-6000.o ...@@ -16,7 +16,6 @@ iwlagn-$(CONFIG_IWL5000) += iwl-6000.o
iwlagn-$(CONFIG_IWL5000) += iwl-1000.o iwlagn-$(CONFIG_IWL5000) += iwl-1000.o
obj-$(CONFIG_IWL3945) += iwl3945.o obj-$(CONFIG_IWL3945) += iwl3945.o
iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o iwl-3945-led.o
iwl3945-$(CONFIG_IWL3945_LEDS) += iwl-3945-led.o
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* *
*****************************************************************************/ *****************************************************************************/
#ifdef CONFIG_IWLWIFI_LEDS
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -163,8 +164,8 @@ static int iwl3945_led_associated(struct iwl_priv *priv, int led_id) ...@@ -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, static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
enum led_brightness brightness) enum led_brightness brightness)
{ {
struct iwl3945_led *led = container_of(led_cdev, struct iwl_led *led = container_of(led_cdev,
struct iwl3945_led, led_dev); struct iwl_led, led_dev);
struct iwl_priv *priv = led->priv; struct iwl_priv *priv = led->priv;
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->status))
...@@ -202,7 +203,7 @@ static void iwl3945_led_brightness_set(struct led_classdev *led_cdev, ...@@ -202,7 +203,7 @@ static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
* Register led class with the system * Register led class with the system
*/ */
static int iwl3945_led_register_led(struct iwl_priv *priv, 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, enum led_type type, u8 set_led,
char *trigger) char *trigger)
{ {
...@@ -315,66 +316,66 @@ int iwl3945_led_register(struct iwl_priv *priv) ...@@ -315,66 +316,66 @@ int iwl3945_led_register(struct iwl_priv *priv)
priv->allow_blinking = 0; priv->allow_blinking = 0;
trigger = ieee80211_get_radio_led_name(priv->hw); trigger = ieee80211_get_radio_led_name(priv->hw);
snprintf(priv->led39[IWL_LED_TRG_RADIO].name, snprintf(priv->led[IWL_LED_TRG_RADIO].name,
sizeof(priv->led39[IWL_LED_TRG_RADIO].name), "iwl-%s::radio", sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s::radio",
wiphy_name(priv->hw->wiphy)); wiphy_name(priv->hw->wiphy));
priv->led39[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on; priv->led[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on;
priv->led39[IWL_LED_TRG_RADIO].led_off = iwl3945_led_off; priv->led[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_pattern = NULL;
ret = iwl3945_led_register_led(priv, ret = iwl3945_led_register_led(priv,
&priv->led39[IWL_LED_TRG_RADIO], &priv->led[IWL_LED_TRG_RADIO],
IWL_LED_TRG_RADIO, 1, trigger); IWL_LED_TRG_RADIO, 1, trigger);
if (ret) if (ret)
goto exit_fail; goto exit_fail;
trigger = ieee80211_get_assoc_led_name(priv->hw); trigger = ieee80211_get_assoc_led_name(priv->hw);
snprintf(priv->led39[IWL_LED_TRG_ASSOC].name, snprintf(priv->led[IWL_LED_TRG_ASSOC].name,
sizeof(priv->led39[IWL_LED_TRG_ASSOC].name), "iwl-%s::assoc", sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s::assoc",
wiphy_name(priv->hw->wiphy)); wiphy_name(priv->hw->wiphy));
ret = iwl3945_led_register_led(priv, ret = iwl3945_led_register_led(priv,
&priv->led39[IWL_LED_TRG_ASSOC], &priv->led[IWL_LED_TRG_ASSOC],
IWL_LED_TRG_ASSOC, 0, trigger); IWL_LED_TRG_ASSOC, 0, trigger);
/* for assoc always turn led on */ /* for assoc always turn led on */
priv->led39[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on; priv->led[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on;
priv->led39[IWL_LED_TRG_ASSOC].led_off = iwl3945_led_on; priv->led[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_pattern = NULL;
if (ret) if (ret)
goto exit_fail; goto exit_fail;
trigger = ieee80211_get_rx_led_name(priv->hw); trigger = ieee80211_get_rx_led_name(priv->hw);
snprintf(priv->led39[IWL_LED_TRG_RX].name, snprintf(priv->led[IWL_LED_TRG_RX].name,
sizeof(priv->led39[IWL_LED_TRG_RX].name), "iwl-%s::RX", sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s::RX",
wiphy_name(priv->hw->wiphy)); wiphy_name(priv->hw->wiphy));
ret = iwl3945_led_register_led(priv, ret = iwl3945_led_register_led(priv,
&priv->led39[IWL_LED_TRG_RX], &priv->led[IWL_LED_TRG_RX],
IWL_LED_TRG_RX, 0, trigger); IWL_LED_TRG_RX, 0, trigger);
priv->led39[IWL_LED_TRG_RX].led_on = iwl3945_led_associated; priv->led[IWL_LED_TRG_RX].led_on = iwl3945_led_associated;
priv->led39[IWL_LED_TRG_RX].led_off = iwl3945_led_associated; priv->led[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_pattern = iwl3945_led_pattern;
if (ret) if (ret)
goto exit_fail; goto exit_fail;
trigger = ieee80211_get_tx_led_name(priv->hw); trigger = ieee80211_get_tx_led_name(priv->hw);
snprintf(priv->led39[IWL_LED_TRG_TX].name, snprintf(priv->led[IWL_LED_TRG_TX].name,
sizeof(priv->led39[IWL_LED_TRG_TX].name), "iwl-%s::TX", sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s::TX",
wiphy_name(priv->hw->wiphy)); wiphy_name(priv->hw->wiphy));
ret = iwl3945_led_register_led(priv, ret = iwl3945_led_register_led(priv,
&priv->led39[IWL_LED_TRG_TX], &priv->led[IWL_LED_TRG_TX],
IWL_LED_TRG_TX, 0, trigger); IWL_LED_TRG_TX, 0, trigger);
priv->led39[IWL_LED_TRG_TX].led_on = iwl3945_led_associated; priv->led[IWL_LED_TRG_TX].led_on = iwl3945_led_associated;
priv->led39[IWL_LED_TRG_TX].led_off = iwl3945_led_associated; priv->led[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_pattern = iwl3945_led_pattern;
if (ret) if (ret)
goto exit_fail; goto exit_fail;
...@@ -388,7 +389,7 @@ exit_fail: ...@@ -388,7 +389,7 @@ exit_fail:
/* unregister led class */ /* 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) if (!led->registered)
return; return;
...@@ -403,9 +404,10 @@ static void iwl3945_led_unregister_led(struct iwl3945_led *led, u8 set_led) ...@@ -403,9 +404,10 @@ static void iwl3945_led_unregister_led(struct iwl3945_led *led, u8 set_led)
/* Unregister all led handlers */ /* Unregister all led handlers */
void iwl3945_led_unregister(struct iwl_priv *priv) void iwl3945_led_unregister(struct iwl_priv *priv)
{ {
iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_ASSOC], 0); iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_ASSOC], 0);
iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_RX], 0); iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_RX], 0);
iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_TX], 0); iwl3945_led_unregister_led(&priv->led[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_RADIO], 1);
} }
#endif
...@@ -29,24 +29,10 @@ ...@@ -29,24 +29,10 @@
struct iwl_priv; struct iwl_priv;
#ifdef CONFIG_IWL3945_LEDS #ifdef CONFIG_IWLWIFI_LEDS
#include "iwl-led.h" #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 int iwl3945_led_register(struct iwl_priv *priv);
extern void iwl3945_led_unregister(struct iwl_priv *priv); extern void iwl3945_led_unregister(struct iwl_priv *priv);
extern void iwl3945_led_background(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); ...@@ -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 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_unregister(struct iwl_priv *priv) {}
static inline void iwl3945_led_background(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 */ #endif /* IWL3945_LEDS_H */
...@@ -554,7 +554,7 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv, ...@@ -554,7 +554,7 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv,
struct ieee80211_rx_status *stats) struct ieee80211_rx_status *stats)
{ {
struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 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); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
#endif #endif
struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); 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, ...@@ -583,7 +583,7 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv,
(struct ieee80211_hdr *)rxb->skb->data, (struct ieee80211_hdr *)rxb->skb->data,
le32_to_cpu(rx_end->status), stats); le32_to_cpu(rx_end->status), stats);
#ifdef CONFIG_IWL3945_LEDS #ifdef CONFIG_IWLWIFI_LEDS
if (ieee80211_is_data(hdr->frame_control)) if (ieee80211_is_data(hdr->frame_control))
priv->rxtxpackets += len; priv->rxtxpackets += len;
#endif #endif
......
...@@ -926,19 +926,12 @@ struct iwl_priv { ...@@ -926,19 +926,12 @@ struct iwl_priv {
struct rfkill *rfkill; struct rfkill *rfkill;
#endif #endif
#if defined(CONFIG_IWLWIFI_LEDS) || defined(CONFIG_IWL3945_LEDS) #ifdef CONFIG_IWLWIFI_LEDS
unsigned long last_blink_time; unsigned long last_blink_time;
u8 last_blink_rate; u8 last_blink_rate;
u8 allow_blinking; u8 allow_blinking;
u64 led_tpt; u64 led_tpt;
#endif
#ifdef CONFIG_IWLWIFI_LEDS
struct iwl_led led[IWL_LED_TRG_MAX]; struct iwl_led led[IWL_LED_TRG_MAX];
#endif
#ifdef CONFIG_IWL3945_LEDS
struct iwl3945_led led39[IWL_LED_TRG_MAX];
unsigned int rxtxpackets; unsigned int rxtxpackets;
#endif #endif
u16 active_rate; u16 active_rate;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
struct iwl_priv; struct iwl_priv;
#if defined(CONFIG_IWLWIFI_LEDS) || defined(CONFIG_IWL3945_LEDS) #ifdef CONFIG_IWLWIFI_LEDS
#include <linux/leds.h> #include <linux/leds.h>
#define IWL_LED_SOLID 11 #define IWL_LED_SOLID 11
......
...@@ -890,7 +890,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, ...@@ -890,7 +890,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
tx->timeout.pm_frame_timeout = cpu_to_le16(2); tx->timeout.pm_frame_timeout = cpu_to_le16(2);
} else { } else {
tx->timeout.pm_frame_timeout = 0; tx->timeout.pm_frame_timeout = 0;
#ifdef CONFIG_IWL3945_LEDS #ifdef CONFIG_IWLWIFI_LEDS
priv->rxtxpackets += le16_to_cpu(cmd->cmd.tx.len); priv->rxtxpackets += le16_to_cpu(cmd->cmd.tx.len);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment