OSDN Git Service

staging: wfx: use sleeping gpio accessors
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Tue, 11 Feb 2020 10:35:03 +0000 (11:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Feb 2020 19:15:29 +0000 (11:15 -0800)
Driver calls GPIO get/set only from non-atomic context and so can use any
GPIOs.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/cb19e7c521712d5a166e0b7e9cac4450798fdce0.1581416843.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/bh.c
drivers/staging/wfx/bus_spi.c
drivers/staging/wfx/main.c

index 983c41d..c6319ab 100644 (file)
@@ -20,10 +20,10 @@ static void device_wakeup(struct wfx_dev *wdev)
 {
        if (!wdev->pdata.gpio_wakeup)
                return;
-       if (gpiod_get_value(wdev->pdata.gpio_wakeup))
+       if (gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup))
                return;
 
-       gpiod_set_value(wdev->pdata.gpio_wakeup, 1);
+       gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1);
        if (wfx_api_older_than(wdev, 1, 4)) {
                if (!completion_done(&wdev->hif.ctrl_ready))
                        udelay(2000);
@@ -45,7 +45,7 @@ static void device_release(struct wfx_dev *wdev)
        if (!wdev->pdata.gpio_wakeup)
                return;
 
-       gpiod_set_value(wdev->pdata.gpio_wakeup, 0);
+       gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 0);
 }
 
 static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf)
index d6a75bd..e3cd125 100644 (file)
@@ -210,9 +210,9 @@ static int wfx_spi_probe(struct spi_device *func)
        } else {
                if (spi_get_device_id(func)->driver_data & WFX_RESET_INVERTED)
                        gpiod_toggle_active_low(bus->gpio_reset);
-               gpiod_set_value(bus->gpio_reset, 1);
+               gpiod_set_value_cansleep(bus->gpio_reset, 1);
                udelay(100);
-               gpiod_set_value(bus->gpio_reset, 0);
+               gpiod_set_value_cansleep(bus->gpio_reset, 0);
                udelay(2000);
        }
 
index 76b2ff7..3c4c240 100644 (file)
@@ -425,7 +425,7 @@ int wfx_probe(struct wfx_dev *wdev)
                        "enable 'quiescent' power mode with gpio %d and PDS file %s\n",
                        desc_to_gpio(wdev->pdata.gpio_wakeup),
                        wdev->pdata.file_pds);
-               gpiod_set_value(wdev->pdata.gpio_wakeup, 1);
+               gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1);
                control_reg_write(wdev, 0);
                hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_QUIESCENT);
        } else {