diff options
author | Ivo van Doorn <IvDoorn@gmail.com> | 2008-06-03 14:30:01 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-14 12:17:55 -0400 |
commit | 475433be3d8f4d840e2930eef96671b7f8d11053 (patch) | |
tree | 0eab68260c952e08ef5767cadafaba4c1189efff /drivers/net/wireless/rt2x00/rt73usb.c | |
parent | 2b08da3fb595432f87b5206c1c77dcb72300cacf (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/rt73usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index aabdc67c8555..db1fc136cda4 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -335,6 +335,17 @@ static int rt73usb_blink_set(struct led_classdev *led_cdev, | |||
335 | 335 | ||
336 | return 0; | 336 | return 0; |
337 | } | 337 | } |
338 | |||
339 | static void rt73usb_init_led(struct rt2x00_dev *rt2x00dev, | ||
340 | struct rt2x00_led *led, | ||
341 | enum led_type type) | ||
342 | { | ||
343 | led->rt2x00dev = rt2x00dev; | ||
344 | led->type = type; | ||
345 | led->led_dev.brightness_set = rt73usb_brightness_set; | ||
346 | led->led_dev.blink_set = rt73usb_blink_set; | ||
347 | led->flags = LED_INITIALIZED; | ||
348 | } | ||
338 | #endif /* CONFIG_RT73USB_LEDS */ | 349 | #endif /* CONFIG_RT73USB_LEDS */ |
339 | 350 | ||
340 | /* | 351 | /* |
@@ -1627,31 +1638,11 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1627 | #ifdef CONFIG_RT73USB_LEDS | 1638 | #ifdef CONFIG_RT73USB_LEDS |
1628 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &eeprom); | 1639 | rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &eeprom); |
1629 | 1640 | ||
1630 | rt2x00dev->led_radio.rt2x00dev = rt2x00dev; | 1641 | rt73usb_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO); |
1631 | rt2x00dev->led_radio.type = LED_TYPE_RADIO; | 1642 | rt73usb_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); |
1632 | rt2x00dev->led_radio.led_dev.brightness_set = | 1643 | if (value == LED_MODE_SIGNAL_STRENGTH) |
1633 | rt73usb_brightness_set; | 1644 | rt73usb_init_led(rt2x00dev, &rt2x00dev->led_qual, |
1634 | rt2x00dev->led_radio.led_dev.blink_set = | 1645 | LED_TYPE_QUALITY); |
1635 | rt73usb_blink_set; | ||
1636 | rt2x00dev->led_radio.flags = LED_INITIALIZED; | ||
1637 | |||
1638 | rt2x00dev->led_assoc.rt2x00dev = rt2x00dev; | ||
1639 | rt2x00dev->led_assoc.type = LED_TYPE_ASSOC; | ||
1640 | rt2x00dev->led_assoc.led_dev.brightness_set = | ||
1641 | rt73usb_brightness_set; | ||
1642 | rt2x00dev->led_assoc.led_dev.blink_set = | ||
1643 | rt73usb_blink_set; | ||
1644 | rt2x00dev->led_assoc.flags = LED_INITIALIZED; | ||
1645 | |||
1646 | if (value == LED_MODE_SIGNAL_STRENGTH) { | ||
1647 | rt2x00dev->led_qual.rt2x00dev = rt2x00dev; | ||
1648 | rt2x00dev->led_qual.type = LED_TYPE_QUALITY; | ||
1649 | rt2x00dev->led_qual.led_dev.brightness_set = | ||
1650 | rt73usb_brightness_set; | ||
1651 | rt2x00dev->led_qual.led_dev.blink_set = | ||
1652 | rt73usb_blink_set; | ||
1653 | rt2x00dev->led_qual.flags = LED_INITIALIZED; | ||
1654 | } | ||
1655 | 1646 | ||
1656 | rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_LED_MODE, value); | 1647 | rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_LED_MODE, value); |
1657 | rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_0, | 1648 | rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_0, |