Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge remote-tracking branches 'regulator/fix/gpio-enable' and 'regulator/fix/tps65910' into regulator-linus

+18 -17
+17 -17
drivers/regulator/core.c
··· 1839 1839 } 1840 1840 1841 1841 if (rdev->ena_pin) { 1842 - ret = regulator_ena_gpio_ctrl(rdev, true); 1843 - if (ret < 0) 1844 - return ret; 1845 - rdev->ena_gpio_state = 1; 1842 + if (!rdev->ena_gpio_state) { 1843 + ret = regulator_ena_gpio_ctrl(rdev, true); 1844 + if (ret < 0) 1845 + return ret; 1846 + rdev->ena_gpio_state = 1; 1847 + } 1846 1848 } else if (rdev->desc->ops->enable) { 1847 1849 ret = rdev->desc->ops->enable(rdev); 1848 1850 if (ret < 0) ··· 1941 1939 trace_regulator_disable(rdev_get_name(rdev)); 1942 1940 1943 1941 if (rdev->ena_pin) { 1944 - ret = regulator_ena_gpio_ctrl(rdev, false); 1945 - if (ret < 0) 1946 - return ret; 1947 - rdev->ena_gpio_state = 0; 1942 + if (rdev->ena_gpio_state) { 1943 + ret = regulator_ena_gpio_ctrl(rdev, false); 1944 + if (ret < 0) 1945 + return ret; 1946 + rdev->ena_gpio_state = 0; 1947 + } 1948 1948 1949 1949 } else if (rdev->desc->ops->disable) { 1950 1950 ret = rdev->desc->ops->disable(rdev); ··· 3630 3626 config->ena_gpio, ret); 3631 3627 goto wash; 3632 3628 } 3633 - 3634 - if (config->ena_gpio_flags & GPIOF_OUT_INIT_HIGH) 3635 - rdev->ena_gpio_state = 1; 3636 - 3637 - if (config->ena_gpio_invert) 3638 - rdev->ena_gpio_state = !rdev->ena_gpio_state; 3639 3629 } 3640 3630 3641 3631 /* set regulator constraints */ ··· 3798 3800 list_for_each_entry(rdev, &regulator_list, list) { 3799 3801 mutex_lock(&rdev->mutex); 3800 3802 if (rdev->use_count > 0 || rdev->constraints->always_on) { 3801 - error = _regulator_do_enable(rdev); 3802 - if (error) 3803 - ret = error; 3803 + if (!_regulator_is_enabled(rdev)) { 3804 + error = _regulator_do_enable(rdev); 3805 + if (error) 3806 + ret = error; 3807 + } 3804 3808 } else { 3805 3809 if (!have_full_constraints()) 3806 3810 goto unlock;
+1
drivers/regulator/tps65910-regulator.c
··· 17 17 #include <linux/module.h> 18 18 #include <linux/init.h> 19 19 #include <linux/err.h> 20 + #include <linux/of.h> 20 21 #include <linux/platform_device.h> 21 22 #include <linux/regulator/driver.h> 22 23 #include <linux/regulator/machine.h>