diff options
author | Pavel Roskin <proski@gnu.org> | 2011-07-14 20:21:55 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-07-20 15:04:33 -0400 |
commit | e0d687bd9df218ba3d97aac15919d30816d72dcb (patch) | |
tree | 8a1a93dc7f940b4a0900aaa149725b535df17e25 /drivers/net/wireless/ath/ath5k/led.c | |
parent | 491735929b63cb665b2215e3183b960e66f221f3 (diff) |
ath5k: merge ath5k_hw and ath5k_softc
Both ath5k_hw and ath5k_softc represent one instance of the hardware.
This duplication is historical and is not needed anymore.
Keep the name "ath5k_hw" for the merged structure and "ah" for the
variable pointing to it. "ath5k_hw" is shorter than "ath5k_softc", more
descriptive and more widely used.
Put the combined structure to ath5k.h where the old ath5k_softc used to
be. Move some code from base.h to ath5k.h as needed.
Remove memory allocation for struct ath5k_hw and the corresponding error
handling. Merge iobase and ah_iobase fields.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/led.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/led.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c index 127bfbd35172..8c17a00f7dad 100644 --- a/drivers/net/wireless/ath/ath5k/led.c +++ b/drivers/net/wireless/ath/ath5k/led.c | |||
@@ -86,26 +86,26 @@ static DEFINE_PCI_DEVICE_TABLE(ath5k_led_devices) = { | |||
86 | { } | 86 | { } |
87 | }; | 87 | }; |
88 | 88 | ||
89 | void ath5k_led_enable(struct ath5k_softc *sc) | 89 | void ath5k_led_enable(struct ath5k_hw *ah) |
90 | { | 90 | { |
91 | if (test_bit(ATH_STAT_LEDSOFT, sc->status)) { | 91 | if (test_bit(ATH_STAT_LEDSOFT, ah->status)) { |
92 | ath5k_hw_set_gpio_output(sc->ah, sc->led_pin); | 92 | ath5k_hw_set_gpio_output(ah, ah->led_pin); |
93 | ath5k_led_off(sc); | 93 | ath5k_led_off(ah); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | static void ath5k_led_on(struct ath5k_softc *sc) | 97 | static void ath5k_led_on(struct ath5k_hw *ah) |
98 | { | 98 | { |
99 | if (!test_bit(ATH_STAT_LEDSOFT, sc->status)) | 99 | if (!test_bit(ATH_STAT_LEDSOFT, ah->status)) |
100 | return; | 100 | return; |
101 | ath5k_hw_set_gpio(sc->ah, sc->led_pin, sc->led_on); | 101 | ath5k_hw_set_gpio(ah, ah->led_pin, ah->led_on); |
102 | } | 102 | } |
103 | 103 | ||
104 | void ath5k_led_off(struct ath5k_softc *sc) | 104 | void ath5k_led_off(struct ath5k_hw *ah) |
105 | { | 105 | { |
106 | if (!test_bit(ATH_STAT_LEDSOFT, sc->status)) | 106 | if (!test_bit(ATH_STAT_LEDSOFT, ah->status)) |
107 | return; | 107 | return; |
108 | ath5k_hw_set_gpio(sc->ah, sc->led_pin, !sc->led_on); | 108 | ath5k_hw_set_gpio(ah, ah->led_pin, !ah->led_on); |
109 | } | 109 | } |
110 | 110 | ||
111 | static void | 111 | static void |
@@ -116,27 +116,27 @@ ath5k_led_brightness_set(struct led_classdev *led_dev, | |||
116 | led_dev); | 116 | led_dev); |
117 | 117 | ||
118 | if (brightness == LED_OFF) | 118 | if (brightness == LED_OFF) |
119 | ath5k_led_off(led->sc); | 119 | ath5k_led_off(led->ah); |
120 | else | 120 | else |
121 | ath5k_led_on(led->sc); | 121 | ath5k_led_on(led->ah); |
122 | } | 122 | } |
123 | 123 | ||
124 | static int | 124 | static int |
125 | ath5k_register_led(struct ath5k_softc *sc, struct ath5k_led *led, | 125 | ath5k_register_led(struct ath5k_hw *ah, struct ath5k_led *led, |
126 | const char *name, char *trigger) | 126 | const char *name, char *trigger) |
127 | { | 127 | { |
128 | int err; | 128 | int err; |
129 | 129 | ||
130 | led->sc = sc; | 130 | led->ah = ah; |
131 | strncpy(led->name, name, sizeof(led->name)); | 131 | strncpy(led->name, name, sizeof(led->name)); |
132 | led->led_dev.name = led->name; | 132 | led->led_dev.name = led->name; |
133 | led->led_dev.default_trigger = trigger; | 133 | led->led_dev.default_trigger = trigger; |
134 | led->led_dev.brightness_set = ath5k_led_brightness_set; | 134 | led->led_dev.brightness_set = ath5k_led_brightness_set; |
135 | 135 | ||
136 | err = led_classdev_register(sc->dev, &led->led_dev); | 136 | err = led_classdev_register(ah->dev, &led->led_dev); |
137 | if (err) { | 137 | if (err) { |
138 | ATH5K_WARN(sc, "could not register LED %s\n", name); | 138 | ATH5K_WARN(ah, "could not register LED %s\n", name); |
139 | led->sc = NULL; | 139 | led->ah = NULL; |
140 | } | 140 | } |
141 | return err; | 141 | return err; |
142 | } | 142 | } |
@@ -144,30 +144,30 @@ ath5k_register_led(struct ath5k_softc *sc, struct ath5k_led *led, | |||
144 | static void | 144 | static void |
145 | ath5k_unregister_led(struct ath5k_led *led) | 145 | ath5k_unregister_led(struct ath5k_led *led) |
146 | { | 146 | { |
147 | if (!led->sc) | 147 | if (!led->ah) |
148 | return; | 148 | return; |
149 | led_classdev_unregister(&led->led_dev); | 149 | led_classdev_unregister(&led->led_dev); |
150 | ath5k_led_off(led->sc); | 150 | ath5k_led_off(led->ah); |
151 | led->sc = NULL; | 151 | led->ah = NULL; |
152 | } | 152 | } |
153 | 153 | ||
154 | void ath5k_unregister_leds(struct ath5k_softc *sc) | 154 | void ath5k_unregister_leds(struct ath5k_hw *ah) |
155 | { | 155 | { |
156 | ath5k_unregister_led(&sc->rx_led); | 156 | ath5k_unregister_led(&ah->rx_led); |
157 | ath5k_unregister_led(&sc->tx_led); | 157 | ath5k_unregister_led(&ah->tx_led); |
158 | } | 158 | } |
159 | 159 | ||
160 | int __devinit ath5k_init_leds(struct ath5k_softc *sc) | 160 | int __devinit ath5k_init_leds(struct ath5k_hw *ah) |
161 | { | 161 | { |
162 | int ret = 0; | 162 | int ret = 0; |
163 | struct ieee80211_hw *hw = sc->hw; | 163 | struct ieee80211_hw *hw = ah->hw; |
164 | #ifndef CONFIG_ATHEROS_AR231X | 164 | #ifndef CONFIG_ATHEROS_AR231X |
165 | struct pci_dev *pdev = sc->pdev; | 165 | struct pci_dev *pdev = ah->pdev; |
166 | #endif | 166 | #endif |
167 | char name[ATH5K_LED_MAX_NAME_LEN + 1]; | 167 | char name[ATH5K_LED_MAX_NAME_LEN + 1]; |
168 | const struct pci_device_id *match; | 168 | const struct pci_device_id *match; |
169 | 169 | ||
170 | if (!sc->pdev) | 170 | if (!ah->pdev) |
171 | return 0; | 171 | return 0; |
172 | 172 | ||
173 | #ifdef CONFIG_ATHEROS_AR231X | 173 | #ifdef CONFIG_ATHEROS_AR231X |
@@ -176,24 +176,24 @@ int __devinit ath5k_init_leds(struct ath5k_softc *sc) | |||
176 | match = pci_match_id(&ath5k_led_devices[0], pdev); | 176 | match = pci_match_id(&ath5k_led_devices[0], pdev); |
177 | #endif | 177 | #endif |
178 | if (match) { | 178 | if (match) { |
179 | __set_bit(ATH_STAT_LEDSOFT, sc->status); | 179 | __set_bit(ATH_STAT_LEDSOFT, ah->status); |
180 | sc->led_pin = ATH_PIN(match->driver_data); | 180 | ah->led_pin = ATH_PIN(match->driver_data); |
181 | sc->led_on = ATH_POLARITY(match->driver_data); | 181 | ah->led_on = ATH_POLARITY(match->driver_data); |
182 | } | 182 | } |
183 | 183 | ||
184 | if (!test_bit(ATH_STAT_LEDSOFT, sc->status)) | 184 | if (!test_bit(ATH_STAT_LEDSOFT, ah->status)) |
185 | goto out; | 185 | goto out; |
186 | 186 | ||
187 | ath5k_led_enable(sc); | 187 | ath5k_led_enable(ah); |
188 | 188 | ||
189 | snprintf(name, sizeof(name), "ath5k-%s::rx", wiphy_name(hw->wiphy)); | 189 | snprintf(name, sizeof(name), "ath5k-%s::rx", wiphy_name(hw->wiphy)); |
190 | ret = ath5k_register_led(sc, &sc->rx_led, name, | 190 | ret = ath5k_register_led(ah, &ah->rx_led, name, |
191 | ieee80211_get_rx_led_name(hw)); | 191 | ieee80211_get_rx_led_name(hw)); |
192 | if (ret) | 192 | if (ret) |
193 | goto out; | 193 | goto out; |
194 | 194 | ||
195 | snprintf(name, sizeof(name), "ath5k-%s::tx", wiphy_name(hw->wiphy)); | 195 | snprintf(name, sizeof(name), "ath5k-%s::tx", wiphy_name(hw->wiphy)); |
196 | ret = ath5k_register_led(sc, &sc->tx_led, name, | 196 | ret = ath5k_register_led(ah, &ah->tx_led, name, |
197 | ieee80211_get_tx_led_name(hw)); | 197 | ieee80211_get_tx_led_name(hw)); |
198 | out: | 198 | out: |
199 | return ret; | 199 | return ret; |