svn commit: r338457 - head/sys/dev/extres/regulator

Emmanuel Vadot manu at FreeBSD.org
Tue Sep 4 19:18:56 UTC 2018


Author: manu
Date: Tue Sep  4 19:18:55 2018
New Revision: 338457
URL: https://svnweb.freebsd.org/changeset/base/338457

Log:
  regulator: Use bool values instead of 0/1
  
  While here do not attempt to disable regulators if they are meant
  to be always on.
  
  Reviewed by:    mmel
  Approved by:    re (kib)

Modified:
  head/sys/dev/extres/regulator/regulator.c

Modified: head/sys/dev/extres/regulator/regulator.c
==============================================================================
--- head/sys/dev/extres/regulator/regulator.c	Tue Sep  4 16:47:08 2018	(r338456)
+++ head/sys/dev/extres/regulator/regulator.c	Tue Sep  4 19:18:55 2018	(r338457)
@@ -172,7 +172,7 @@ regulator_shutdown(void *dummy)
 	REG_TOPO_SLOCK();
 	TUNABLE_INT_FETCH("hw.regulator.disable_unused", &disable);
 	TAILQ_FOREACH(entry, &regnode_list, reglist_link) {
-		if (entry->std_param.always_on == 0 && disable) {
+		if (!entry->std_param.always_on && disable) {
 			if (bootverbose)
 				printf("regulator: shutting down %s\n",
 				    entry->name);
@@ -595,8 +595,9 @@ regnode_disable(struct regnode *regnode)
 
 	REGNODE_XLOCK(regnode);
 	/* Disable regulator for each node in chain, starting from consumer. */
-	if ((regnode->enable_cnt == 1) &&
-	    ((regnode->flags & REGULATOR_FLAGS_NOT_DISABLE) == 0)) {
+	if (regnode->enable_cnt == 1 &&
+	    (regnode->flags & REGULATOR_FLAGS_NOT_DISABLE) == 0 &&
+	    !regnode->std_param.always_on) {
 		rv = REGNODE_ENABLE(regnode, false, &udelay);
 		if (rv != 0) {
 			REGNODE_UNLOCK(regnode);
@@ -1048,10 +1049,10 @@ regulator_parse_ofw_stdparam(device_t pdev, phandle_t 
 		par->enable_delay = 0;
 
 	if (OF_hasprop(node, "regulator-boot-on"))
-		par->boot_on = 1;
+		par->boot_on = true;
 
 	if (OF_hasprop(node, "regulator-always-on"))
-		par->always_on = 1;
+		par->always_on = true;
 
 	if (OF_hasprop(node, "enable-active-high"))
 		par->enable_active_high = 1;


More information about the svn-src-all mailing list