- 21 6月, 2021 3 次提交
-
-
由 Matti Vaittinen 提交于
Add DT property parsing code and setting callback for regulator over/under voltage, over-current and temperature error limits. Signed-off-by: NMatti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Link: https://lore.kernel.org/r/e7b8007ba9eae7076178bf3363fb942ccb1cc9a5.1622628334.git.matti.vaittinen@fi.rohmeurope.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Matti Vaittinen 提交于
Provide helper function for IC's implementing regulator notifications when an IRQ fires. The helper also works for IRQs which can not be acked. Helper can be set to disable the IRQ at handler and then re-enabling it on delayed work later. The helper also adds regulator_get_error_flags() errors in cache for the duration of IRQ disabling. Signed-off-by: NMatti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/ebdf86d8c22b924667ec2385330e30fcbfac0119.1622628334.git.matti.vaittinen@fi.rohmeurope.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Matti Vaittinen 提交于
The rdev print helpers are a nice way to print messages related to a specific regulator device. Move them from core.c to internal.h As the rdev print helpers use rdev_get_name() export it from core.c. Also move the declaration from coupler.h to driver.h because the rdev name is not just a coupled regulator property. I guess the main audience for rdev_get_name() will be the regulator core and drivers. Signed-off-by: NMatti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Link: https://lore.kernel.org/r/dc7fd70dc31de4d0e820b7646bb78eeb04f80735.1622628333.git.matti.vaittinen@fi.rohmeurope.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 23 4月, 2021 1 次提交
-
-
由 Vincent Whitchurch 提交于
The jiffies-based off_on_delay implementation has a couple of problems that cause it to sometimes not actually delay for the required time: (1) If, for example, the off_on_delay time is equivalent to one jiffy, and the ->last_off_jiffy is set just before a new jiffy starts, then _regulator_do_enable() does not wait at all since it checks using time_before(). (2) When jiffies overflows, the value of "remaining" becomes higher than "max_delay" and the code simply proceeds without waiting. Fix these problems by changing it to use ktime_t instead. [Note that since jiffies doesn't start at zero but at INITIAL_JIFFIES ("-5 minutes"), (2) above also led to the code not delaying if the first regulator_enable() is called when the ->last_off_jiffy is not initialised, such as for regulators with ->constraints->boot_on set. It's not clear to me if this was intended or not, but I've preserved this behaviour explicitly with the check for a non-zero ->last_off.] Signed-off-by: NVincent Whitchurch <vincent.whitchurch@axis.com> Link: https://lore.kernel.org/r/20210423114524.26414-1-vincent.whitchurch@axis.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 22 4月, 2021 1 次提交
-
-
由 Vincent Whitchurch 提交于
We currently do not respect off_on_delay the first time we turn on a regulator. This is problematic since the regulator could have been turned off by the bootloader, or it could it have been turned off during the probe of the regulator driver (such as when regulator-fixed requests the enable GPIO), either of which could potentially have happened less than off_on_delay microseconds ago before the first time a client requests for the regulator to be turned on. We can't know exactly when the regulator was turned off, but initialise off_on_delay to the current time when registering the regulator, so that we guarantee that we respect the off_on_delay in all cases. Signed-off-by: NVincent Whitchurch <vincent.whitchurch@axis.com> Link: https://lore.kernel.org/r/20210422083044.11479-1-vincent.whitchurch@axis.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 21 4月, 2021 2 次提交
-
-
由 Sebastian Fricke 提交于
s/regulator may on/regulator may already be enabled/ s/or left on/or was left on/ The aim of this patch is to make the comment more readable and to make it clear, that this is about a regulator, that is already enabled instead of a regulator that may be switched on. Signed-off-by: NSebastian Fricke <sebastian.fricke@posteo.net> Link: https://lore.kernel.org/r/20210421055236.13148-1-sebastian.fricke@posteo.netSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Shubhankar Kuranagatti 提交于
Shifted the closing */ of multiline comment to a new line This is done to maintain code uniformity Signed-off-by: NShubhankar Kuranagatti <shubhankarvk@gmail.com> Link: https://lore.kernel.org/r/20210420034718.t7wudu6xcfpahflv@kewl-virtual-machineSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 25 1月, 2021 1 次提交
-
-
由 Hans de Goede 提交于
Sometimes regulator_get() gets called twice for the same supply on the same device. This may happen e.g. when a framework / library is used which uses the regulator; and the driver itself also needs to enable the regulator in some cases where the framework will not enable it. Commit ff268b56 ("regulator: core: Don't spew backtraces on duplicate sysfs") already takes care of the backtrace which would trigger when creating a duplicate consumer symlink under /sys/class/regulator/regulator.%d in this scenario. Commit c33d4423 ("debugfs: make error message a bit more verbose") causes a new error to get logged in this scenario: [ 26.938425] debugfs: Directory 'wm5102-codec-MICVDD' with parent 'spi-WM510204:00-MICVDD' already present! There is no _nowarn variant of debugfs_create_dir(), but we can detect and avoid this problem by checking the return value of the earlier sysfs_create_link_nowarn() call. Add a check for the earlier sysfs_create_link_nowarn() failing with -EEXIST and skip the debugfs_create_dir() call in that case, avoiding this error getting logged. Fixes: c33d4423 ("debugfs: make error message a bit more verbose") Cc: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: NHans de Goede <hdegoede@redhat.com> Reviewed-by: NCharles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210122183250.370571-1-hdegoede@redhat.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 23 1月, 2021 1 次提交
-
-
由 Dmitry Osipenko 提交于
Make regulator_sync_voltage() to re-balance voltage state of a coupled regulators instead of changing the voltage directly. Tested-by: Peter Geis <pgwipeout@gmail.com> # Ouya T30 Tested-by: Dmitry Osipenko <digetx@gmail.com> # A500 T20 and Nexus7 T30 Tested-by: Nicolas Chauvet <kwizart@gmail.com> # PAZ00 T20 Tested-by: Matt Merhar <mattmerhar@protonmail.com> # Ouya T30 Signed-off-by: NDmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20210122174311.28230-1-digetx@gmail.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 22 1月, 2021 1 次提交
-
-
由 Mark Brown 提交于
With commit eaa7995c (regulator: core: avoid regulator_resolve_supply() race condition) we started holding the rdev lock while resolving supplies, an operation that requires holding the regulator_list_mutex. This results in lockdep warnings since in other places we take the list mutex then the mutex on an individual rdev. Since the goal is to make sure that we don't call set_supply() twice rather than a concern about the cost of resolution pull the rdev lock and check for duplicate resolution down to immediately before we do the set_supply() and drop it again once the allocation is done. Fixes: eaa7995c (regulator: core: avoid regulator_resolve_supply() race condition) Reported-by: NMarek Szyprowski <m.szyprowski@samsung.com> Tested-by: NMarek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20210122132042.10306-1-broonie@kernel.orgSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 09 1月, 2021 1 次提交
-
-
由 David Collins 提交于
The final step in regulator_register() is to call regulator_resolve_supply() for each registered regulator (including the one in the process of being registered). The regulator_resolve_supply() function first checks if rdev->supply is NULL, then it performs various steps to try to find the supply. If successful, rdev->supply is set inside of set_supply(). This procedure can encounter a race condition if two concurrent tasks call regulator_register() near to each other on separate CPUs and one of the regulators has rdev->supply_name specified. There is currently nothing guaranteeing atomicity between the rdev->supply check and set steps. Thus, both tasks can observe rdev->supply==NULL in their regulator_resolve_supply() calls. This then results in both creating a struct regulator for the supply. One ends up actually stored in rdev->supply and the other is lost (though still present in the supply's consumer_list). Here is a kernel log snippet showing the issue: [ 12.421768] gpu_cc_gx_gdsc: supplied by pm8350_s5_level [ 12.425854] gpu_cc_gx_gdsc: supplied by pm8350_s5_level [ 12.429064] debugfs: Directory 'regulator.4-SUPPLY' with parent '17a00000.rsc:rpmh-regulator-gfxlvl-pm8350_s5_level' already present! Avoid this race condition by holding the rdev->mutex lock inside of regulator_resolve_supply() while checking and setting rdev->supply. Signed-off-by: NDavid Collins <collinsd@codeaurora.org> Link: https://lore.kernel.org/r/1610068562-4410-1-git-send-email-collinsd@codeaurora.orgSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 04 1月, 2021 1 次提交
-
-
由 Daniel Scally 提交于
The function regulator_set_device_supply() is referenced a few times in comments in regulator/core.c; however this function was removed a long time ago by commit a5766f11 ("regulator: core - Rework machine API to remove string based functions."). Update those references to point to set_consumer_device_supply(), which replaced the old function. Signed-off-by: NDaniel Scally <djrscally@gmail.com> Link: https://lore.kernel.org/r/20210103165541.784360-1-djrscally@gmail.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 26 11月, 2020 1 次提交
-
-
由 Claudiu Beznea 提交于
Selectors lower than linear_min_sel should not be considered invalid. Thus return zero in case _regulator_list_voltage(), regulator_list_hardware_vsel() or regulator_list_voltage_table() receives such selectors as argument. Fixes: bdcd1177 ("regulator: core: validate selector against linear_min_sel") Reported-by: NJon Hunter <jonathanh@nvidia.com> Signed-off-by: NClaudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/1606325147-606-1-git-send-email-claudiu.beznea@microchip.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 14 11月, 2020 3 次提交
-
-
由 Claudiu Beznea 提交于
Do not continue if selector has already been located. Signed-off-by: NClaudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/1605290164-11556-1-git-send-email-claudiu.beznea@microchip.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Claudiu Beznea 提交于
There are regulators who's min selector is not zero. Selectors loops (looping b/w zero and regulator::desc::n_voltages) might throw errors because invalid selectors are used (lower than regulator::desc::linear_min_sel). For this situations validate selectors against regulator::desc::linear_min_sel. Signed-off-by: NClaudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/1605280870-32432-2-git-send-email-claudiu.beznea@microchip.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Michał Mirosław 提交于
Help debugging the case when set_machine_constraints() needs to be repeated. Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> # stpmic1 Link: https://lore.kernel.org/r/f9cba575580369e46661a9278ee6c6a8d8564c2a.1605226675.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 13 11月, 2020 3 次提交
-
-
由 Michał Mirosław 提交于
Workaround regulators whose supply name happens to be the same as its own name. This fixes boards that used to work before the early supply resolving was removed. The error message is left in place so that offending drivers can be detected. Fixes: aea6cb99 ("regulator: resolve supply after creating regulator") Cc: stable@vger.kernel.org Reported-by: NAhmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> # stpmic1 Link: https://lore.kernel.org/r/d703acde2a93100c3c7a81059d716c50ad1b1f52.1605226675.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Michał Mirosław 提交于
When a regulator's name equals its supply's name the regulator_resolve_supply() recurses indefinitely. Add a check so that debugging the problem is easier. The "fixed" commit just exposed the problem. Fixes: aea6cb99 ("regulator: resolve supply after creating regulator") Cc: stable@vger.kernel.org Reported-by: NAhmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> # stpmic1 Link: https://lore.kernel.org/r/c6171057cfc0896f950c4d8cb82df0f9f1b89ad9.1605226675.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Michał Mirosław 提交于
Fixed commit introduced a possible second call to set_machine_constraints() and that allocates memory for rdev->constraints. Move the allocation to the caller so it's easier to manage and done once. Fixes: aea6cb99 ("regulator: resolve supply after creating regulator") Cc: stable@vger.kernel.org Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> # stpmic1 Link: https://lore.kernel.org/r/78c3d4016cebc08d441aad18cb924b4e4d9cf9df.1605226675.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 11 11月, 2020 1 次提交
-
-
由 Pi-Hsun Shih 提交于
In regulator_late_cleanup when is_enabled failed, don't try to disable the regulator since it would likely to fail too and causing confusing error messages. Signed-off-by: NPi-Hsun Shih <pihsun@chromium.org> Link: https://lore.kernel.org/r/20201106064817.3290927-1-pihsun@chromium.orgSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 03 11月, 2020 1 次提交
-
-
由 Michał Mirosław 提交于
regulator_get_voltage_rdev() is called in regulator probe() when applying machine constraints. The "fixed" commit exposed the problem that non-bypassed regulators can forward the request to its parent (like bypassed ones) supply. Return -EPROBE_DEFER when the supply is expected but not resolved yet. Fixes: aea6cb99 ("regulator: resolve supply after creating regulator") Cc: stable@vger.kernel.org Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Reported-by: NOndřej Jirman <megous@megous.com> Reported-by: NCorentin Labbe <clabbe.montjoie@gmail.com> Tested-by: NOndřej Jirman <megous@megous.com> Link: https://lore.kernel.org/r/a9041d68b4d35e4a2dd71629c8a6422662acb5ee.1604351936.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 29 10月, 2020 1 次提交
-
-
由 Mauro Carvalho Chehab 提交于
It seems that the function was renamed. kernel-doc markup should follow it. Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/dffad16d4d6427d7d0fc89797e4126fe7c69d5de.1603469755.git.mchehab+huawei@kernel.orgSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 05 10月, 2020 1 次提交
-
-
由 Geert Uytterhoeven 提交于
If debugging is disabled, print_constraints() does not print the actual constraints, but still performs some processing and string formatting, only to throw away the result later. Fix this by moving all constraint debug processing to a separate function, and replacing it by a dummy when debugging is disabled. This reduces kernel size by almost 800 bytes (on arm/arm64). Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20201005131546.22448-1-geert+renesas@glider.beSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 02 10月, 2020 1 次提交
-
-
Some regulator drivers may be defining very long names: this is the case with the qcom_smd and qcom_spmi regulators, where we need to parse the regulator parents from DT. For clarity, this is an example: { "l13a", QCOM_SMD_RPM_LDOA, 13, &pm660_ht_lvpldo, "vdd_l8_l9_l10_l11_l12_l13_l14" }, pm660-regulators { ... vdd_l8_l9_l10_l11_l12_l13_l14-supply = <&vreg_s4a_2p04> ... }; Now, with a 32 characters limit, the function is trying to parse, exactly, "vdd_l8_l9_l10_l11_l12_l13_l14-s" (32 chars) instead of the right one, which is 37 chars long in this specific case. ... And this is not only the case with PM660/PM660L, but also with PMA8084, PM8916, PM8950 and others that are not implemented yet. The length of 64 chars was chosen based on the longest parsed property name that I could find, which is in PM8916, and would be 53 characters long. At that point, rounding that to 64 looked like being the best idea. Signed-off-by: NAngeloGioacchino Del Regno <kholk11@gmail.com> Link: https://lore.kernel.org/r/20200926125549.13191-2-kholk11@gmail.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 29 9月, 2020 3 次提交
-
-
由 Michał Mirosław 提交于
When creating a new regulator its supply cannot create the sysfs link because the device is not yet published. Remove early supply resolving since it will be done later anyway. This makes the following error disappear and the symlinks get created instead. DCDC_REG1: supplied by VSYS VSYS: could not add device link regulator.3 err -2 Note: It doesn't fix the problem for bypassed regulators, though. Fixes: 45389c47 ("regulator: core: Add early supply resolution for regulators") Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/ba09e0a8617ffeeb25cb4affffe6f3149319cef8.1601155770.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Michał Mirosław 提交于
Change all error-printing messages to include error name via %pe instead of numeric error or nothing. Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/1dcf25f39188882eb56918a9aa281ab17b792aa5.1601155770.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Michał Mirosław 提交于
Make the initial state of the regulator shown when debugging. Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/53c4f3d394d68f0989174f89e3b0882cebbbd787.1601155770.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 22 9月, 2020 2 次提交
-
-
由 Colin Ian King 提交于
There is a return statement that is indented with an extra space, fix this by removing it. Signed-off-by: NColin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20200920142454.33352-1-colin.king@canonical.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Michał Mirosław 提交于
regulator_lock/unlock() was used only to guard regulator_notifier_call_chain(). As no users remain, make the functions internal. Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/d3381aabd2632aff5e7b839d55868bec6e85c811.1600550732.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 08 9月, 2020 1 次提交
-
-
由 Michał Mirosław 提交于
Since 3801b86a ("regulator: Refactor supply implementation to work as regular consumers") we no longer cascade notifications and so notifier head's built-in rwsem is enough to protect the notifier chain. Remove the requirement to fix one case where rdev->mutex might be forced to be taken recursively. Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Reviewed-by: NDmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/5a0da9017c69a4dbc3f9b50f44476fce80a73387.1597032945.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 01 9月, 2020 1 次提交
-
-
由 Dmitry Osipenko 提交于
The recent commit 7d819664 ("regulator: Remove pointer table overallocation") changed the size of coupled_rdevs and now KASAN is able to detect slab-out-of-bounds problem in regulator_unlock_recursive(), which is a legit problem caused by a typo in the code. The recursive unlock function uses n_coupled value of a parent regulator for unlocking supply regulator, while supply's n_coupled should be used. In practice problem may only affect platforms that use coupled regulators. Cc: stable@vger.kernel.org # 5.0+ Fixes: f8702f9e ("regulator: core: Use ww_mutex for regulators locking") Signed-off-by: NDmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200831204335.19489-1-digetx@gmail.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 24 8月, 2020 1 次提交
-
-
由 Gustavo A. R. Silva 提交于
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-throughSigned-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
-
- 19 8月, 2020 2 次提交
-
-
由 Michał Mirosław 提交于
The code allocates sizeof(regulator_dev) for a pointer. Make it less generous. Let kcalloc() calculate the size, while at it. Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Reviewed-by: NDmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/407fbd06a02caf038a9ba3baa51c7d6d47cd6517.1597000795.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Stephen Boyd 提交于
I see it takes about 5us per regulator to grab the lock, check that this regulator isn't going to do anything for suspend, and then release the lock. When that is combined with PMICs that have dozens of regulators we get into a state where we spend a few miliseconds doing a bunch of locking operations synchronously to figure out that there's nothing to do. Let's reorganize the code here a bit so that we don't grab the lock until we're actually going to do something so that suspend is a little faster. Signed-off-by: NStephen Boyd <swboyd@chromium.org> Reviewed-by: NDouglas Anderson <dianders@chromium.org> Cc: Matthias Kaehlcke <mka@chromium.org> Cc: Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20200804070837.1084024-1-swboyd@chromium.orgSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 17 8月, 2020 6 次提交
-
-
由 Michał Mirosław 提交于
The code modifies rdev, but locks c_rdev instead. Remove the lock as this is held together by regulator_list_mutex taken in the caller. Fixes: f9503385 ("regulator: core: Mutually resolve regulators coupling") Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Reviewed-by: NDmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/25eb81cefb37a646f3e44eaaf1d8ae8881cfde52.1597195321.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Michał Mirosław 提交于
Since only regulator_ena_gpio_request() allocates rdev->ena_pin, and it guarantees that same gpiod gets same pin structure, it is enough to compare just the pointers. Also we know there can be only one matching entry on the list. Rework the code take advantage of the facts. Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/3ff002c7aa3bd774491af4291a9df23541fcf892.1597195321.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Michał Mirosław 提交于
By calling device_initialize() earlier and noting that kfree(NULL) is ok, we can save a bit of code in error handling and plug of_node leak. Fixed commit already did part of the work. Fixes: 9177514c ("regulator: fix memory leak on error path of regulator_register()") Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Reviewed-by: NVladimir Zapolskiy <vz@mleia.com> Acked-by: NVladimir Zapolskiy <vz@mleia.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/f5035b1b4d40745e66bacd571bbbb5e4644d21a1.1597195321.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Michał Mirosław 提交于
Pull regulator_list_mutex into set_consumer_device_supply() and keep allocations outside of it. Fourth of the fs_reclaim deadlock case. Fixes: 45389c47 ("regulator: core: Add early supply resolution for regulators") Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/f0380bdb3d60aeefa9693c4e234d2dcda7e56747.1597195321.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Michał Mirosław 提交于
Move all allocations outside of the regulator_lock()ed section. ====================================================== WARNING: possible circular locking dependency detected 5.7.13+ #535 Not tainted ------------------------------------------------------ f2fs_discard-179:7/702 is trying to acquire lock: c0e5d920 (regulator_list_mutex){+.+.}-{3:3}, at: regulator_lock_dependent+0x54/0x2c0 but task is already holding lock: cb95b080 (&dcc->cmd_lock){+.+.}-{3:3}, at: __issue_discard_cmd+0xec/0x5f8 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: [...] -> #3 (fs_reclaim){+.+.}-{0:0}: fs_reclaim_acquire.part.11+0x40/0x50 fs_reclaim_acquire+0x24/0x28 __kmalloc_track_caller+0x54/0x218 kstrdup+0x40/0x5c create_regulator+0xf4/0x368 regulator_resolve_supply+0x1a0/0x200 regulator_register+0x9c8/0x163c [...] other info that might help us debug this: Chain exists of: regulator_list_mutex --> &sit_i->sentry_lock --> &dcc->cmd_lock [...] Fixes: f8702f9e ("regulator: core: Use ww_mutex for regulators locking") Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/6eebc99b2474f4ffaa0405b15178ece0e7e4f608.1597195321.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Michał Mirosław 提交于
Move another allocation out of regulator_list_mutex-protected region, as reclaim might want to take the same lock. WARNING: possible circular locking dependency detected 5.7.13+ #534 Not tainted ------------------------------------------------------ kswapd0/383 is trying to acquire lock: c0e5d920 (regulator_list_mutex){+.+.}-{3:3}, at: regulator_lock_dependent+0x54/0x2c0 but task is already holding lock: c0e38518 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x50 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (fs_reclaim){+.+.}-{0:0}: fs_reclaim_acquire.part.11+0x40/0x50 fs_reclaim_acquire+0x24/0x28 kmem_cache_alloc_trace+0x40/0x1e8 regulator_register+0x384/0x1630 devm_regulator_register+0x50/0x84 reg_fixed_voltage_probe+0x248/0x35c [...] other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(fs_reclaim); lock(regulator_list_mutex); lock(fs_reclaim); lock(regulator_list_mutex); *** DEADLOCK *** [...] 2 locks held by kswapd0/383: #0: c0e38518 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x0/0x50 #1: cb70e5e0 (hctx->srcu){....}-{0:0}, at: hctx_lock+0x60/0xb8 [...] Fixes: 541d052d ("regulator: core: Only support passing enable GPIO descriptors") [this commit only changes context] Fixes: f8702f9e ("regulator: core: Use ww_mutex for regulators locking") [this is when the regulator_list_mutex was introduced in reclaim locking path] Signed-off-by: NMichał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/41fe6a9670335721b48e8f5195038c3d67a3bf92.1597195321.git.mirq-linux@rere.qmqm.plSigned-off-by: NMark Brown <broonie@kernel.org>
-