Commit a1082a4d authored by Matthias Beyer's avatar Matthias Beyer Committed by Greg Kroah-Hartman

Staging: bcm: led_control.{c,h}: Fixed macro

This patch fixes the TURN_{ON,OFF}_LED() macros by adding the adapter as
parameter.
Signed-off-by: default avatarMatthias Beyer <mail@beyermatthias.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ce2705c3
...@@ -40,7 +40,7 @@ static INT LED_Blink(struct bcm_mini_adapter *Adapter, ...@@ -40,7 +40,7 @@ static INT LED_Blink(struct bcm_mini_adapter *Adapter,
} }
while (num_of_time) { while (num_of_time) {
if (currdriverstate == Adapter->DriverState) if (currdriverstate == Adapter->DriverState)
TURN_ON_LED(GPIO_Num, uiLedIndex); TURN_ON_LED(Adapter, GPIO_Num, uiLedIndex);
/* Wait for timeout after setting on the LED */ /* Wait for timeout after setting on the LED */
Status = wait_event_interruptible_timeout( Status = wait_event_interruptible_timeout(
...@@ -55,17 +55,17 @@ static INT LED_Blink(struct bcm_mini_adapter *Adapter, ...@@ -55,17 +55,17 @@ static INT LED_Blink(struct bcm_mini_adapter *Adapter,
"Led thread got signal to exit..hence exiting"); "Led thread got signal to exit..hence exiting");
Adapter->LEDInfo.led_thread_running = Adapter->LEDInfo.led_thread_running =
BCM_LED_THREAD_DISABLED; BCM_LED_THREAD_DISABLED;
TURN_OFF_LED(GPIO_Num, uiLedIndex); TURN_OFF_LED(Adapter, GPIO_Num, uiLedIndex);
Status = EVENT_SIGNALED; Status = EVENT_SIGNALED;
break; break;
} }
if (Status) { if (Status) {
TURN_OFF_LED(GPIO_Num, uiLedIndex); TURN_OFF_LED(Adapter, GPIO_Num, uiLedIndex);
Status = EVENT_SIGNALED; Status = EVENT_SIGNALED;
break; break;
} }
TURN_OFF_LED(GPIO_Num, uiLedIndex); TURN_OFF_LED(Adapter, GPIO_Num, uiLedIndex);
Status = wait_event_interruptible_timeout( Status = wait_event_interruptible_timeout(
Adapter->LEDInfo.notify_led_event, Adapter->LEDInfo.notify_led_event,
currdriverstate != Adapter->DriverState || currdriverstate != Adapter->DriverState ||
...@@ -223,8 +223,8 @@ static INT LED_Proportional_Blink(struct bcm_mini_adapter *Adapter, ...@@ -223,8 +223,8 @@ static INT LED_Proportional_Blink(struct bcm_mini_adapter *Adapter,
} }
/* Turn off both Tx and Rx LEDs before next second */ /* Turn off both Tx and Rx LEDs before next second */
TURN_OFF_LED(1 << GPIO_Num_tx, uiTxLedIndex); TURN_OFF_LED(Adapter, 1 << GPIO_Num_tx, uiTxLedIndex);
TURN_OFF_LED(1 << GPIO_Num_rx, uiTxLedIndex); TURN_OFF_LED(Adapter, 1 << GPIO_Num_rx, uiTxLedIndex);
/* /*
* Read the Tx & Rx packets transmission after 1 second and * Read the Tx & Rx packets transmission after 1 second and
...@@ -606,7 +606,8 @@ static VOID LedGpioInit(struct bcm_mini_adapter *Adapter) ...@@ -606,7 +606,8 @@ static VOID LedGpioInit(struct bcm_mini_adapter *Adapter)
if (Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num != if (Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num !=
DISABLE_GPIO_NUM) DISABLE_GPIO_NUM)
uiResetValue |= (1 << Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num); uiResetValue |= (1 << Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num);
TURN_OFF_LED(1 << Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num, TURN_OFF_LED(Adapter,
1 << Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num,
uiIndex); uiIndex);
} }
if (wrmalt(Adapter, GPIO_MODE_REGISTER, &uiResetValue, if (wrmalt(Adapter, GPIO_MODE_REGISTER, &uiResetValue,
...@@ -680,7 +681,7 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad, ...@@ -680,7 +681,7 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
currdriverstate); currdriverstate);
if (GPIO_num != DISABLE_GPIO_NUM) if (GPIO_num != DISABLE_GPIO_NUM)
TURN_ON_LED(1 << GPIO_num, uiLedIndex); TURN_ON_LED(ad, 1 << GPIO_num, uiLedIndex);
break; break;
case FW_DOWNLOAD: case FW_DOWNLOAD:
...@@ -705,7 +706,7 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad, ...@@ -705,7 +706,7 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
BcmGetGPIOPinInfo(ad, &GPIO_num, &dummyGPIONum, BcmGetGPIOPinInfo(ad, &GPIO_num, &dummyGPIONum,
&uiLedIndex, &dummyIndex, currdriverstate); &uiLedIndex, &dummyIndex, currdriverstate);
if (GPIO_num != DISABLE_GPIO_NUM) if (GPIO_num != DISABLE_GPIO_NUM)
TURN_ON_LED(1 << GPIO_num, uiLedIndex); TURN_ON_LED(ad, 1 << GPIO_num, uiLedIndex);
break; break;
case SHUTDOWN_EXIT: case SHUTDOWN_EXIT:
...@@ -718,7 +719,7 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad, ...@@ -718,7 +719,7 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
BcmGetGPIOPinInfo(ad, &GPIO_num, &dummyGPIONum, BcmGetGPIOPinInfo(ad, &GPIO_num, &dummyGPIONum,
&uiLedIndex, &dummyGPIONum, currdriverstate); &uiLedIndex, &dummyGPIONum, currdriverstate);
if (GPIO_num != DISABLE_GPIO_NUM) if (GPIO_num != DISABLE_GPIO_NUM)
TURN_ON_LED(1 << GPIO_num, uiLedIndex); TURN_ON_LED(ad, 1 << GPIO_num, uiLedIndex);
break; break;
case NORMAL_OPERATION: case NORMAL_OPERATION:
{ {
...@@ -765,7 +766,9 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad, ...@@ -765,7 +766,9 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
uiResetValue = 0; uiResetValue = 0;
for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) { for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
if (ad->LEDInfo.LEDState[uiIndex].GPIO_Num != DISABLE_GPIO_NUM) if (ad->LEDInfo.LEDState[uiIndex].GPIO_Num != DISABLE_GPIO_NUM)
TURN_OFF_LED((1 << ad->LEDInfo.LEDState[uiIndex].GPIO_Num), uiIndex); TURN_OFF_LED(ad,
(1 << ad->LEDInfo.LEDState[uiIndex].GPIO_Num),
uiIndex);
} }
} }
...@@ -787,7 +790,9 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad, ...@@ -787,7 +790,9 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) { for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
if (ad->LEDInfo.LEDState[uiIndex].GPIO_Num != if (ad->LEDInfo.LEDState[uiIndex].GPIO_Num !=
DISABLE_GPIO_NUM) DISABLE_GPIO_NUM)
TURN_OFF_LED((1 << ad->LEDInfo.LEDState[uiIndex].GPIO_Num), uiIndex); TURN_OFF_LED(ad,
(1 << ad->LEDInfo.LEDState[uiIndex].GPIO_Num),
uiIndex);
} }
/* ad->DriverState = DRIVER_INIT; */ /* ad->DriverState = DRIVER_INIT; */
break; break;
...@@ -802,7 +807,9 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad, ...@@ -802,7 +807,9 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) { for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
if (ad->LEDInfo.LEDState[uiIndex].GPIO_Num != if (ad->LEDInfo.LEDState[uiIndex].GPIO_Num !=
DISABLE_GPIO_NUM) DISABLE_GPIO_NUM)
TURN_OFF_LED((1 << ad->LEDInfo.LEDState[uiIndex].GPIO_Num), uiIndex); TURN_OFF_LED(ad,
(1 << ad->LEDInfo.LEDState[uiIndex].GPIO_Num),
uiIndex);
} }
break; break;
case LED_THREAD_ACTIVE: case LED_THREAD_ACTIVE:
...@@ -868,12 +875,12 @@ static VOID LEDControlThread(struct bcm_mini_adapter *Adapter) ...@@ -868,12 +875,12 @@ static VOID LEDControlThread(struct bcm_mini_adapter *Adapter)
"Led thread got signal to exit..hence exiting"); "Led thread got signal to exit..hence exiting");
Adapter->LEDInfo.led_thread_running = Adapter->LEDInfo.led_thread_running =
BCM_LED_THREAD_DISABLED; BCM_LED_THREAD_DISABLED;
TURN_OFF_LED(1 << GPIO_num, uiLedIndex); TURN_OFF_LED(Adapter, 1 << GPIO_num, uiLedIndex);
return; /* STATUS_FAILURE; */ return; /* STATUS_FAILURE; */
} }
if (GPIO_num != DISABLE_GPIO_NUM) if (GPIO_num != DISABLE_GPIO_NUM)
TURN_OFF_LED(1 << GPIO_num, uiLedIndex); TURN_OFF_LED(Adapter, 1 << GPIO_num, uiLedIndex);
if (Adapter->LEDInfo.bLedInitDone == false) { if (Adapter->LEDInfo.bLedInitDone == false) {
LedGpioInit(Adapter); LedGpioInit(Adapter);
......
...@@ -17,18 +17,18 @@ ...@@ -17,18 +17,18 @@
#define EVENT_SIGNALED 1 #define EVENT_SIGNALED 1
#define MAX_FILE_NAME_BUFFER_SIZE 100 #define MAX_FILE_NAME_BUFFER_SIZE 100
#define TURN_ON_LED(GPIO, index) do { \ #define TURN_ON_LED(ad, GPIO, index) do { \
unsigned int gpio_val = GPIO; \ unsigned int gpio_val = GPIO; \
(Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \ (ad->LEDInfo.LEDState[index].BitPolarity == 1) ? \
wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)) : \ wrmaltWithLock(ad, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)) : \
wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)); \ wrmaltWithLock(ad, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)); \
} while (0) } while (0)
#define TURN_OFF_LED(GPIO, index) do { \ #define TURN_OFF_LED(ad, GPIO, index) do { \
unsigned int gpio_val = GPIO; \ unsigned int gpio_val = GPIO; \
(Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \ (ad->LEDInfo.LEDState[index].BitPolarity == 1) ? \
wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)) : \ wrmaltWithLock(ad, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)) : \
wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)); \ wrmaltWithLock(ad, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)); \
} while (0) } while (0)
enum bcm_led_colors { enum bcm_led_colors {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment