svn commit: r356772 - stable/12/sys/dev/extres/regulator
Kyle Evans
kevans at FreeBSD.org
Thu Jan 16 03:14:02 UTC 2020
Author: kevans
Date: Thu Jan 16 03:14:01 2020
New Revision: 356772
URL: https://svnweb.freebsd.org/changeset/base/356772
Log:
MFC r356649: regulator: small enhancements to regulator_shutdown
Highlights:
- Exit early if we're not disabling unused regulators; there's no need to
take the regulator topology lock and re-evaluate this every iteration, as
it's not going to change.
- Don't emit a notice that we're shutting down a regulator if it's not
enabled, to reduce noise.
- Mention the outcome of the shutdown, to aide debugging and easily let
developer/user collect list of regulators we actually shutdown to
determine problematic one.
Modified:
stable/12/sys/dev/extres/regulator/regulator.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/dev/extres/regulator/regulator.c
==============================================================================
--- stable/12/sys/dev/extres/regulator/regulator.c Thu Jan 16 03:11:25 2020 (r356771)
+++ stable/12/sys/dev/extres/regulator/regulator.c Thu Jan 16 03:14:01 2020 (r356772)
@@ -191,16 +191,36 @@ regulator_shutdown(void *dummy)
int status, ret;
int disable = 1;
- REG_TOPO_SLOCK();
TUNABLE_INT_FETCH("hw.regulator.disable_unused", &disable);
+ if (!disable)
+ return;
+ REG_TOPO_SLOCK();
+
+ if (bootverbose)
+ printf("regulator: shutting down unused regulators\n");
TAILQ_FOREACH(entry, ®node_list, reglist_link) {
- if (!entry->std_param.always_on && disable) {
- if (bootverbose)
- printf("regulator: shutting down %s\n",
- entry->name);
+ if (!entry->std_param.always_on) {
ret = regnode_status(entry, &status);
- if (ret == 0 && status == REGULATOR_STATUS_ENABLED)
- regnode_stop(entry, 0);
+ if (ret == 0 && status == REGULATOR_STATUS_ENABLED) {
+ if (bootverbose)
+ printf("regulator: shutting down %s... ",
+ entry->name);
+ ret = regnode_stop(entry, 0);
+ if (bootverbose) {
+ /*
+ * Call out busy in particular, here,
+ * because it's not unexpected to fail
+ * shutdown if the regulator is simply
+ * in-use.
+ */
+ if (ret == EBUSY)
+ printf("busy\n");
+ else if (ret != 0)
+ printf("error (%d)\n", ret);
+ else
+ printf("ok\n");
+ }
+ }
}
}
REG_TOPO_UNLOCK();
More information about the svn-src-stable
mailing list