aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt61pci.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/rt61pci.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/rt61pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c41
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 4658dbd7ef63..aa9ef66921b8 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -330,6 +330,17 @@ static int rt61pci_blink_set(struct led_classdev *led_cdev,
330 330
331 return 0; 331 return 0;
332} 332}
333
334static void rt61pci_init_led(struct rt2x00_dev *rt2x00dev,
335 struct rt2x00_led *led,
336 enum led_type type)
337{
338 led->rt2x00dev = rt2x00dev;
339 led->type = type;
340 led->led_dev.brightness_set = rt61pci_brightness_set;
341 led->led_dev.blink_set = rt61pci_blink_set;
342 led->flags = LED_INITIALIZED;
343}
333#endif /* CONFIG_RT61PCI_LEDS */ 344#endif /* CONFIG_RT61PCI_LEDS */
334 345
335/* 346/*
@@ -2064,31 +2075,11 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
2064 rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &eeprom); 2075 rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &eeprom);
2065 value = rt2x00_get_field16(eeprom, EEPROM_LED_LED_MODE); 2076 value = rt2x00_get_field16(eeprom, EEPROM_LED_LED_MODE);
2066 2077
2067 rt2x00dev->led_radio.rt2x00dev = rt2x00dev; 2078 rt61pci_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
2068 rt2x00dev->led_radio.type = LED_TYPE_RADIO; 2079 rt61pci_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
2069 rt2x00dev->led_radio.led_dev.brightness_set = 2080 if (value == LED_MODE_SIGNAL_STRENGTH)
2070 rt61pci_brightness_set; 2081 rt61pci_init_led(rt2x00dev, &rt2x00dev->led_qual,
2071 rt2x00dev->led_radio.led_dev.blink_set = 2082 LED_TYPE_QUALITY);
2072 rt61pci_blink_set;
2073 rt2x00dev->led_radio.flags = LED_INITIALIZED;
2074
2075 rt2x00dev->led_assoc.rt2x00dev = rt2x00dev;
2076 rt2x00dev->led_assoc.type = LED_TYPE_ASSOC;
2077 rt2x00dev->led_assoc.led_dev.brightness_set =
2078 rt61pci_brightness_set;
2079 rt2x00dev->led_assoc.led_dev.blink_set =
2080 rt61pci_blink_set;
2081 rt2x00dev->led_assoc.flags = LED_INITIALIZED;
2082
2083 if (value == LED_MODE_SIGNAL_STRENGTH) {
2084 rt2x00dev->led_qual.rt2x00dev = rt2x00dev;
2085 rt2x00dev->led_qual.type = LED_TYPE_QUALITY;
2086 rt2x00dev->led_qual.led_dev.brightness_set =
2087 rt61pci_brightness_set;
2088 rt2x00dev->led_qual.led_dev.blink_set =
2089 rt61pci_blink_set;
2090 rt2x00dev->led_qual.flags = LED_INITIALIZED;
2091 }
2092 2083
2093 rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_LED_MODE, value); 2084 rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_LED_MODE, value);
2094 rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_0, 2085 rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_0,