aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>2009-03-11 14:17:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-03-16 18:09:46 -0400
commit5c8df2d56a160a31386ee7807adfc1c74e826535 (patch)
tree5d5cec6711dedb8890d46a817c8fdedf68229222 /drivers/net
parentfa11d525ef9e4870a080868a7588d27ca8e87c5e (diff)
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: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig10
-rw-r--r--drivers/net/wireless/iwlwifi/Makefile3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-led.c66
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-led.h18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-led.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c2
8 files changed, 43 insertions, 71 deletions
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index a894deb065d7..8304f6406a17 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -6,11 +6,9 @@ config IWLWIFI
6 select MAC80211_LEDS if IWLWIFI_LEDS 6 select MAC80211_LEDS if IWLWIFI_LEDS
7 select LEDS_CLASS if IWLWIFI_LEDS 7 select LEDS_CLASS if IWLWIFI_LEDS
8 select RFKILL if IWLWIFI_RFKILL 8 select RFKILL if IWLWIFI_RFKILL
9 select MAC80211_LEDS if IWL3945_LEDS
10 select LEDS_CLASS if IWL3945_LEDS
11 9
12config IWLWIFI_LEDS 10config IWLWIFI_LEDS
13 bool "Enable LED support in iwlagn driver" 11 bool "Enable LED support in iwlagn and iwl3945 drivers"
14 depends on IWLWIFI 12 depends on IWLWIFI
15 13
16config IWLWIFI_RFKILL 14config IWLWIFI_RFKILL
@@ -122,9 +120,3 @@ config IWL3945_SPECTRUM_MEASUREMENT
122 depends on IWL3945 120 depends on IWL3945
123 ---help--- 121 ---help---
124 This option will enable spectrum measurement for the iwl3945 driver. 122 This option will enable spectrum measurement for the iwl3945 driver.
125
126config IWL3945_LEDS
127 bool "Enable LEDS features in iwl3945 driver"
128 depends on IWL3945
129 ---help---
130 This option enables LEDS for the iwl3945 driver.
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index d5f8009c5ab7..d79d97ad61a5 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -16,7 +16,6 @@ iwlagn-$(CONFIG_IWL5000) += iwl-6000.o
16iwlagn-$(CONFIG_IWL5000) += iwl-1000.o 16iwlagn-$(CONFIG_IWL5000) += iwl-1000.o
17 17
18obj-$(CONFIG_IWL3945) += iwl3945.o 18obj-$(CONFIG_IWL3945) += iwl3945.o
19iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o 19iwl3945-objs := iwl3945-base.o iwl-3945.o iwl-3945-rs.o iwl-3945-led.o
20iwl3945-$(CONFIG_IWL3945_LEDS) += iwl-3945-led.o
21 20
22 21
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.c b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
index a973ac13a1d5..ac22f59be9ef 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
@@ -24,6 +24,7 @@
24 * 24 *
25 *****************************************************************************/ 25 *****************************************************************************/
26 26
27#ifdef CONFIG_IWLWIFI_LEDS
27 28
28#include <linux/kernel.h> 29#include <linux/kernel.h>
29#include <linux/module.h> 30#include <linux/module.h>
@@ -163,8 +164,8 @@ static int iwl3945_led_associated(struct iwl_priv *priv, int led_id)
163static void iwl3945_led_brightness_set(struct led_classdev *led_cdev, 164static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
164 enum led_brightness brightness) 165 enum led_brightness brightness)
165{ 166{
166 struct iwl3945_led *led = container_of(led_cdev, 167 struct iwl_led *led = container_of(led_cdev,
167 struct iwl3945_led, led_dev); 168 struct iwl_led, led_dev);
168 struct iwl_priv *priv = led->priv; 169 struct iwl_priv *priv = led->priv;
169 170
170 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 171 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
@@ -202,7 +203,7 @@ static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
202 * Register led class with the system 203 * Register led class with the system
203 */ 204 */
204static int iwl3945_led_register_led(struct iwl_priv *priv, 205static int iwl3945_led_register_led(struct iwl_priv *priv,
205 struct iwl3945_led *led, 206 struct iwl_led *led,
206 enum led_type type, u8 set_led, 207 enum led_type type, u8 set_led,
207 char *trigger) 208 char *trigger)
208{ 209{
@@ -315,66 +316,66 @@ int iwl3945_led_register(struct iwl_priv *priv)
315 priv->allow_blinking = 0; 316 priv->allow_blinking = 0;
316 317
317 trigger = ieee80211_get_radio_led_name(priv->hw); 318 trigger = ieee80211_get_radio_led_name(priv->hw);
318 snprintf(priv->led39[IWL_LED_TRG_RADIO].name, 319 snprintf(priv->led[IWL_LED_TRG_RADIO].name,
319 sizeof(priv->led39[IWL_LED_TRG_RADIO].name), "iwl-%s::radio", 320 sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s::radio",
320 wiphy_name(priv->hw->wiphy)); 321 wiphy_name(priv->hw->wiphy));
321 322
322 priv->led39[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on; 323 priv->led[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on;
323 priv->led39[IWL_LED_TRG_RADIO].led_off = iwl3945_led_off; 324 priv->led[IWL_LED_TRG_RADIO].led_off = iwl3945_led_off;
324 priv->led39[IWL_LED_TRG_RADIO].led_pattern = NULL; 325 priv->led[IWL_LED_TRG_RADIO].led_pattern = NULL;
325 326
326 ret = iwl3945_led_register_led(priv, 327 ret = iwl3945_led_register_led(priv,
327 &priv->led39[IWL_LED_TRG_RADIO], 328 &priv->led[IWL_LED_TRG_RADIO],
328 IWL_LED_TRG_RADIO, 1, trigger); 329 IWL_LED_TRG_RADIO, 1, trigger);
329 330
330 if (ret) 331 if (ret)
331 goto exit_fail; 332 goto exit_fail;
332 333
333 trigger = ieee80211_get_assoc_led_name(priv->hw); 334 trigger = ieee80211_get_assoc_led_name(priv->hw);
334 snprintf(priv->led39[IWL_LED_TRG_ASSOC].name, 335 snprintf(priv->led[IWL_LED_TRG_ASSOC].name,
335 sizeof(priv->led39[IWL_LED_TRG_ASSOC].name), "iwl-%s::assoc", 336 sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s::assoc",
336 wiphy_name(priv->hw->wiphy)); 337 wiphy_name(priv->hw->wiphy));
337 338
338 ret = iwl3945_led_register_led(priv, 339 ret = iwl3945_led_register_led(priv,
339 &priv->led39[IWL_LED_TRG_ASSOC], 340 &priv->led[IWL_LED_TRG_ASSOC],
340 IWL_LED_TRG_ASSOC, 0, trigger); 341 IWL_LED_TRG_ASSOC, 0, trigger);
341 342
342 /* for assoc always turn led on */ 343 /* for assoc always turn led on */
343 priv->led39[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on; 344 priv->led[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on;
344 priv->led39[IWL_LED_TRG_ASSOC].led_off = iwl3945_led_on; 345 priv->led[IWL_LED_TRG_ASSOC].led_off = iwl3945_led_on;
345 priv->led39[IWL_LED_TRG_ASSOC].led_pattern = NULL; 346 priv->led[IWL_LED_TRG_ASSOC].led_pattern = NULL;
346 347
347 if (ret) 348 if (ret)
348 goto exit_fail; 349 goto exit_fail;
349 350
350 trigger = ieee80211_get_rx_led_name(priv->hw); 351 trigger = ieee80211_get_rx_led_name(priv->hw);
351 snprintf(priv->led39[IWL_LED_TRG_RX].name, 352 snprintf(priv->led[IWL_LED_TRG_RX].name,
352 sizeof(priv->led39[IWL_LED_TRG_RX].name), "iwl-%s::RX", 353 sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s::RX",
353 wiphy_name(priv->hw->wiphy)); 354 wiphy_name(priv->hw->wiphy));
354 355
355 ret = iwl3945_led_register_led(priv, 356 ret = iwl3945_led_register_led(priv,
356 &priv->led39[IWL_LED_TRG_RX], 357 &priv->led[IWL_LED_TRG_RX],
357 IWL_LED_TRG_RX, 0, trigger); 358 IWL_LED_TRG_RX, 0, trigger);
358 359
359 priv->led39[IWL_LED_TRG_RX].led_on = iwl3945_led_associated; 360 priv->led[IWL_LED_TRG_RX].led_on = iwl3945_led_associated;
360 priv->led39[IWL_LED_TRG_RX].led_off = iwl3945_led_associated; 361 priv->led[IWL_LED_TRG_RX].led_off = iwl3945_led_associated;
361 priv->led39[IWL_LED_TRG_RX].led_pattern = iwl3945_led_pattern; 362 priv->led[IWL_LED_TRG_RX].led_pattern = iwl3945_led_pattern;
362 363
363 if (ret) 364 if (ret)
364 goto exit_fail; 365 goto exit_fail;
365 366
366 trigger = ieee80211_get_tx_led_name(priv->hw); 367 trigger = ieee80211_get_tx_led_name(priv->hw);
367 snprintf(priv->led39[IWL_LED_TRG_TX].name, 368 snprintf(priv->led[IWL_LED_TRG_TX].name,
368 sizeof(priv->led39[IWL_LED_TRG_TX].name), "iwl-%s::TX", 369 sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s::TX",
369 wiphy_name(priv->hw->wiphy)); 370 wiphy_name(priv->hw->wiphy));
370 371
371 ret = iwl3945_led_register_led(priv, 372 ret = iwl3945_led_register_led(priv,
372 &priv->led39[IWL_LED_TRG_TX], 373 &priv->led[IWL_LED_TRG_TX],
373 IWL_LED_TRG_TX, 0, trigger); 374 IWL_LED_TRG_TX, 0, trigger);
374 375
375 priv->led39[IWL_LED_TRG_TX].led_on = iwl3945_led_associated; 376 priv->led[IWL_LED_TRG_TX].led_on = iwl3945_led_associated;
376 priv->led39[IWL_LED_TRG_TX].led_off = iwl3945_led_associated; 377 priv->led[IWL_LED_TRG_TX].led_off = iwl3945_led_associated;
377 priv->led39[IWL_LED_TRG_TX].led_pattern = iwl3945_led_pattern; 378 priv->led[IWL_LED_TRG_TX].led_pattern = iwl3945_led_pattern;
378 379
379 if (ret) 380 if (ret)
380 goto exit_fail; 381 goto exit_fail;
@@ -388,7 +389,7 @@ exit_fail:
388 389
389 390
390/* unregister led class */ 391/* unregister led class */
391static void iwl3945_led_unregister_led(struct iwl3945_led *led, u8 set_led) 392static void iwl3945_led_unregister_led(struct iwl_led *led, u8 set_led)
392{ 393{
393 if (!led->registered) 394 if (!led->registered)
394 return; 395 return;
@@ -403,9 +404,10 @@ static void iwl3945_led_unregister_led(struct iwl3945_led *led, u8 set_led)
403/* Unregister all led handlers */ 404/* Unregister all led handlers */
404void iwl3945_led_unregister(struct iwl_priv *priv) 405void iwl3945_led_unregister(struct iwl_priv *priv)
405{ 406{
406 iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_ASSOC], 0); 407 iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_ASSOC], 0);
407 iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_RX], 0); 408 iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_RX], 0);
408 iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_TX], 0); 409 iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_TX], 0);
409 iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_RADIO], 1); 410 iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_RADIO], 1);
410} 411}
411 412
413#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.h b/drivers/net/wireless/iwlwifi/iwl-3945-led.h
index 88185a6ccd6a..3b65642258ca 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-led.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.h
@@ -29,24 +29,10 @@
29 29
30struct iwl_priv; 30struct iwl_priv;
31 31
32#ifdef CONFIG_IWL3945_LEDS 32#ifdef CONFIG_IWLWIFI_LEDS
33 33
34#include "iwl-led.h" 34#include "iwl-led.h"
35 35
36struct iwl3945_led {
37 struct iwl_priv *priv;
38 struct led_classdev led_dev;
39 char name[32];
40
41 int (*led_on) (struct iwl_priv *priv, int led_id);
42 int (*led_off) (struct iwl_priv *priv, int led_id);
43 int (*led_pattern) (struct iwl_priv *priv, int led_id,
44 unsigned int idx);
45
46 enum led_type type;
47 unsigned int registered;
48};
49
50extern int iwl3945_led_register(struct iwl_priv *priv); 36extern int iwl3945_led_register(struct iwl_priv *priv);
51extern void iwl3945_led_unregister(struct iwl_priv *priv); 37extern void iwl3945_led_unregister(struct iwl_priv *priv);
52extern void iwl3945_led_background(struct iwl_priv *priv); 38extern void iwl3945_led_background(struct iwl_priv *priv);
@@ -55,6 +41,6 @@ extern void iwl3945_led_background(struct iwl_priv *priv);
55static inline int iwl3945_led_register(struct iwl_priv *priv) { return 0; } 41static inline int iwl3945_led_register(struct iwl_priv *priv) { return 0; }
56static inline void iwl3945_led_unregister(struct iwl_priv *priv) {} 42static inline void iwl3945_led_unregister(struct iwl_priv *priv) {}
57static inline void iwl3945_led_background(struct iwl_priv *priv) {} 43static inline void iwl3945_led_background(struct iwl_priv *priv) {}
58#endif /* CONFIG_IWL3945_LEDS */
59 44
45#endif /* IWLWIFI_LEDS*/
60#endif /* IWL3945_LEDS_H */ 46#endif /* IWL3945_LEDS_H */
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 0a750534ddf2..9e6f9ec1a2b8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -554,7 +554,7 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv,
554 struct ieee80211_rx_status *stats) 554 struct ieee80211_rx_status *stats)
555{ 555{
556 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 556 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
557#ifdef CONFIG_IWL3945_LEDS 557#ifdef CONFIG_IWLWIFI_LEDS
558 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); 558 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
559#endif 559#endif
560 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); 560 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 (struct ieee80211_hdr *)rxb->skb->data, 583 (struct ieee80211_hdr *)rxb->skb->data,
584 le32_to_cpu(rx_end->status), stats); 584 le32_to_cpu(rx_end->status), stats);
585 585
586#ifdef CONFIG_IWL3945_LEDS 586#ifdef CONFIG_IWLWIFI_LEDS
587 if (ieee80211_is_data(hdr->frame_control)) 587 if (ieee80211_is_data(hdr->frame_control))
588 priv->rxtxpackets += len; 588 priv->rxtxpackets += len;
589#endif 589#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 21764948833f..0baae8022824 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -926,19 +926,12 @@ struct iwl_priv {
926 struct rfkill *rfkill; 926 struct rfkill *rfkill;
927#endif 927#endif
928 928
929#if defined(CONFIG_IWLWIFI_LEDS) || defined(CONFIG_IWL3945_LEDS) 929#ifdef CONFIG_IWLWIFI_LEDS
930 unsigned long last_blink_time; 930 unsigned long last_blink_time;
931 u8 last_blink_rate; 931 u8 last_blink_rate;
932 u8 allow_blinking; 932 u8 allow_blinking;
933 u64 led_tpt; 933 u64 led_tpt;
934#endif
935
936#ifdef CONFIG_IWLWIFI_LEDS
937 struct iwl_led led[IWL_LED_TRG_MAX]; 934 struct iwl_led led[IWL_LED_TRG_MAX];
938#endif
939
940#ifdef CONFIG_IWL3945_LEDS
941 struct iwl3945_led led39[IWL_LED_TRG_MAX];
942 unsigned int rxtxpackets; 935 unsigned int rxtxpackets;
943#endif 936#endif
944 u16 active_rate; 937 u16 active_rate;
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.h b/drivers/net/wireless/iwlwifi/iwl-led.h
index 140fd8fa4855..ef9b174c37ff 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.h
+++ b/drivers/net/wireless/iwlwifi/iwl-led.h
@@ -30,7 +30,7 @@
30 30
31struct iwl_priv; 31struct iwl_priv;
32 32
33#if defined(CONFIG_IWLWIFI_LEDS) || defined(CONFIG_IWL3945_LEDS) 33#ifdef CONFIG_IWLWIFI_LEDS
34#include <linux/leds.h> 34#include <linux/leds.h>
35 35
36#define IWL_LED_SOLID 11 36#define IWL_LED_SOLID 11
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 6b44c1f13c58..ae4c89625e5a 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -890,7 +890,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
890 tx->timeout.pm_frame_timeout = cpu_to_le16(2); 890 tx->timeout.pm_frame_timeout = cpu_to_le16(2);
891 } else { 891 } else {
892 tx->timeout.pm_frame_timeout = 0; 892 tx->timeout.pm_frame_timeout = 0;
893#ifdef CONFIG_IWL3945_LEDS 893#ifdef CONFIG_IWLWIFI_LEDS
894 priv->rxtxpackets += le16_to_cpu(cmd->cmd.tx.len); 894 priv->rxtxpackets += le16_to_cpu(cmd->cmd.tx.len);
895#endif 895#endif
896 } 896 }