aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2500usb.c
diff options
context:
space:
mode:
authorIvo van Doorn <IvDoorn@gmail.com>2008-06-03 14:30:01 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-14 12:17:55 -0400
commit475433be3d8f4d840e2930eef96671b7f8d11053 (patch)
tree0eab68260c952e08ef5767cadafaba4c1189efff /drivers/net/wireless/rt2x00/rt2500usb.c
parent2b08da3fb595432f87b5206c1c77dcb72300cacf (diff)
rt2x00: Move led initialization into function
Reduce code duplication by moving led structure initialization into a per-driver function. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index a46e4a6eba96..0d51b748c5b7 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -316,6 +316,17 @@ static int rt2500usb_blink_set(struct led_classdev *led_cdev,
316 316
317 return 0; 317 return 0;
318} 318}
319
320static void rt2500usb_init_led(struct rt2x00_dev *rt2x00dev,
321 struct rt2x00_led *led,
322 enum led_type type)
323{
324 led->rt2x00dev = rt2x00dev;
325 led->type = type;
326 led->led_dev.brightness_set = rt2500usb_brightness_set;
327 led->led_dev.blink_set = rt2500usb_blink_set;
328 led->flags = LED_INITIALIZED;
329}
319#endif /* CONFIG_RT2500USB_LEDS */ 330#endif /* CONFIG_RT2500USB_LEDS */
320 331
321/* 332/*
@@ -1385,23 +1396,10 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
1385#ifdef CONFIG_RT2500USB_LEDS 1396#ifdef CONFIG_RT2500USB_LEDS
1386 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE); 1397 value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE);
1387 1398
1388 rt2x00dev->led_radio.rt2x00dev = rt2x00dev; 1399 rt2500usb_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
1389 rt2x00dev->led_radio.type = LED_TYPE_RADIO; 1400 if (value == LED_MODE_TXRX_ACTIVITY)
1390 rt2x00dev->led_radio.led_dev.brightness_set = 1401 rt2500usb_init_led(rt2x00dev, &rt2x00dev->led_qual,
1391 rt2500usb_brightness_set; 1402 LED_TYPE_ACTIVITY);
1392 rt2x00dev->led_radio.led_dev.blink_set =
1393 rt2500usb_blink_set;
1394 rt2x00dev->led_radio.flags = LED_INITIALIZED;
1395
1396 if (value == LED_MODE_TXRX_ACTIVITY) {
1397 rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
1398 rt2x00dev->led_qual.type = LED_TYPE_ACTIVITY;
1399 rt2x00dev->led_qual.led_dev.brightness_set =
1400 rt2500usb_brightness_set;
1401 rt2x00dev->led_qual.led_dev.blink_set =
1402 rt2500usb_blink_set;
1403 rt2x00dev->led_qual.flags = LED_INITIALIZED;
1404 }
1405#endif /* CONFIG_RT2500USB_LEDS */ 1403#endif /* CONFIG_RT2500USB_LEDS */
1406 1404
1407 /* 1405 /*