Staging: bcm: led_control.{c,h}: Fixed macro
authorMatthias Beyer <mail@beyermatthias.de>
Mon, 23 Jun 2014 19:18:19 +0000 (21:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2014 01:02:13 +0000 (21:02 -0400)
This patch fixes the TURN_{ON,OFF}_LED() macros by adding the adapter as
parameter.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/bcm/led_control.c
drivers/staging/bcm/led_control.h

index 3b3775b26b477b64f00a34431ef4219023f25367..612e61e46752916b62c7ff69f4067f7936ebffce 100644 (file)
@@ -40,7 +40,7 @@ static INT LED_Blink(struct bcm_mini_adapter *Adapter,
        }
        while (num_of_time) {
                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 */
                Status = wait_event_interruptible_timeout(
@@ -55,17 +55,17 @@ static INT LED_Blink(struct bcm_mini_adapter *Adapter,
                                "Led thread got signal to exit..hence exiting");
                        Adapter->LEDInfo.led_thread_running =
                                        BCM_LED_THREAD_DISABLED;
-                       TURN_OFF_LED(GPIO_Num, uiLedIndex);
+                       TURN_OFF_LED(Adapter, GPIO_Num, uiLedIndex);
                        Status = EVENT_SIGNALED;
                        break;
                }
                if (Status) {
-                       TURN_OFF_LED(GPIO_Num, uiLedIndex);
+                       TURN_OFF_LED(Adapter, GPIO_Num, uiLedIndex);
                        Status = EVENT_SIGNALED;
                        break;
                }
 
-               TURN_OFF_LED(GPIO_Num, uiLedIndex);
+               TURN_OFF_LED(Adapter, GPIO_Num, uiLedIndex);
                Status = wait_event_interruptible_timeout(
                                Adapter->LEDInfo.notify_led_event,
                                currdriverstate != Adapter->DriverState ||
@@ -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_LED(1 << GPIO_Num_tx, uiTxLedIndex);
-               TURN_OFF_LED(1 << GPIO_Num_rx, uiTxLedIndex);
+               TURN_OFF_LED(Adapter, 1 << GPIO_Num_tx, uiTxLedIndex);
+               TURN_OFF_LED(Adapter, 1 << GPIO_Num_rx, uiTxLedIndex);
 
                /*
                 * Read the Tx & Rx packets transmission after 1 second and
@@ -606,8 +606,9 @@ static VOID LedGpioInit(struct bcm_mini_adapter *Adapter)
                if (Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num !=
                                DISABLE_GPIO_NUM)
                        uiResetValue |= (1 << Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num);
-               TURN_OFF_LED(1 << Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num,
-                               uiIndex);
+               TURN_OFF_LED(Adapter,
+                            1 << Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num,
+                            uiIndex);
        }
        if (wrmalt(Adapter, GPIO_MODE_REGISTER, &uiResetValue,
                   sizeof(uiResetValue)) < 0)
@@ -680,7 +681,7 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
                                  currdriverstate);
 
                if (GPIO_num != DISABLE_GPIO_NUM)
-                       TURN_ON_LED(1 << GPIO_num, uiLedIndex);
+                       TURN_ON_LED(ad, 1 << GPIO_num, uiLedIndex);
 
                break;
        case FW_DOWNLOAD:
@@ -705,7 +706,7 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
                BcmGetGPIOPinInfo(ad, &GPIO_num, &dummyGPIONum,
                                  &uiLedIndex, &dummyIndex, currdriverstate);
                if (GPIO_num != DISABLE_GPIO_NUM)
-                       TURN_ON_LED(1 << GPIO_num, uiLedIndex);
+                       TURN_ON_LED(ad, 1 << GPIO_num, uiLedIndex);
                break;
 
        case SHUTDOWN_EXIT:
@@ -718,7 +719,7 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
                BcmGetGPIOPinInfo(ad, &GPIO_num, &dummyGPIONum,
                                  &uiLedIndex, &dummyGPIONum, currdriverstate);
                if (GPIO_num != DISABLE_GPIO_NUM)
-                       TURN_ON_LED(1 << GPIO_num, uiLedIndex);
+                       TURN_ON_LED(ad, 1 << GPIO_num, uiLedIndex);
                break;
        case NORMAL_OPERATION:
                {
@@ -765,7 +766,9 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
                        uiResetValue = 0;
                        for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
                                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,
                for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
                        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);
                }
                /* ad->DriverState = DRIVER_INIT; */
                break;
@@ -802,7 +807,9 @@ static void handle_adapter_driver_state(struct bcm_mini_adapter *ad,
                for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
                        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);
                }
                break;
        case LED_THREAD_ACTIVE:
@@ -868,12 +875,12 @@ static VOID LEDControlThread(struct bcm_mini_adapter *Adapter)
                                "Led thread got signal to exit..hence exiting");
                        Adapter->LEDInfo.led_thread_running =
                                                BCM_LED_THREAD_DISABLED;
-                       TURN_OFF_LED(1 << GPIO_num, uiLedIndex);
+                       TURN_OFF_LED(Adapter, 1 << GPIO_num, uiLedIndex);
                        return; /* STATUS_FAILURE; */
                }
 
                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) {
                        LedGpioInit(Adapter);
index bae40e22e11bf30951d245fc5e5159f1da567fc8..1b24bf4658afb27c968b922e18b47dcba80cfe5f 100644 (file)
 #define EVENT_SIGNALED                         1
 #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;                                   \
-               (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ?   \
-                       wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)) : \
-                       wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)); \
+               (ad->LEDInfo.LEDState[index].BitPolarity == 1) ?        \
+                       wrmaltWithLock(ad, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)) : \
+                       wrmaltWithLock(ad, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)); \
        } while (0)
 
-#define TURN_OFF_LED(GPIO, index)  do {                                        \
+#define TURN_OFF_LED(ad, GPIO, index)  do {                                    \
                unsigned int gpio_val = GPIO;                                   \
-               (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ?   \
-                       wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)) : \
-                       wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)); \
+               (ad->LEDInfo.LEDState[index].BitPolarity == 1) ?        \
+                       wrmaltWithLock(ad, BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)) : \
+                       wrmaltWithLock(ad, BCM_GPIO_OUTPUT_SET_REG, &gpio_val, sizeof(gpio_val)); \
        } while (0)
 
 enum bcm_led_colors {