Date: Thu, 16 Jan 2020 03:14:01 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r356772 - stable/12/sys/dev/extres/regulator Message-ID: <202001160314.00G3E1LF080504@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001160314.00G3E1LF080504>