Merge tag 'staging-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[firefly-linux-kernel-4.4.55.git] / drivers / regulator / gpio-regulator.c
index 3ee79c83ae57e9395dd4d21c91e6b1d12312db82..bae681ccd3ea73a24c0c0d3f98a948d9a7fd06f1 100644 (file)
@@ -82,7 +82,7 @@ static int gpio_regulator_set_voltage(struct regulator_dev *dev,
 
        for (ptr = 0; ptr < data->nr_gpios; ptr++) {
                state = (target & (1 << ptr)) >> ptr;
-               gpio_set_value(data->gpios[ptr].gpio, state);
+               gpio_set_value_cansleep(data->gpios[ptr].gpio, state);
        }
        data->state = target;
 
@@ -119,7 +119,7 @@ static int gpio_regulator_set_current_limit(struct regulator_dev *dev,
 
        for (ptr = 0; ptr < data->nr_gpios; ptr++) {
                state = (target & (1 << ptr)) >> ptr;
-               gpio_set_value(data->gpios[ptr].gpio, state);
+               gpio_set_value_cansleep(data->gpios[ptr].gpio, state);
        }
        data->state = target;
 
@@ -174,7 +174,7 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
        if (!config->gpios)
                return ERR_PTR(-ENOMEM);
 
-       for (i = 0; config->nr_gpios; i++) {
+       for (i = 0; i < config->nr_gpios; i++) {
                gpio = of_get_named_gpio(np, "gpios", i);
                if (gpio < 0)
                        break;
@@ -364,10 +364,12 @@ static int gpio_regulator_remove(struct platform_device *pdev)
        return 0;
 }
 
-static const struct of_device_id regulator_gpio_of_match[] __devinitconst = {
+#if defined(CONFIG_OF)
+static const struct of_device_id regulator_gpio_of_match[] = {
        { .compatible = "regulator-gpio", },
        {},
 };
+#endif
 
 static struct platform_driver gpio_regulator_driver = {
        .probe          = gpio_regulator_probe,
@@ -375,7 +377,7 @@ static struct platform_driver gpio_regulator_driver = {
        .driver         = {
                .name           = "gpio-regulator",
                .owner          = THIS_MODULE,
-               .of_match_table = regulator_gpio_of_match,
+               .of_match_table = of_match_ptr(regulator_gpio_of_match),
        },
 };