From owner-svn-src-all@freebsd.org Tue Sep 4 19:18:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98FC4FF9260; Tue, 4 Sep 2018 19:18:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 475A47D245; Tue, 4 Sep 2018 19:18:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 385E01B36B; Tue, 4 Sep 2018 19:18:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w84JIus9072677; Tue, 4 Sep 2018 19:18:56 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w84JIuYn072676; Tue, 4 Sep 2018 19:18:56 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201809041918.w84JIuYn072676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 4 Sep 2018 19:18:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338457 - head/sys/dev/extres/regulator X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/extres/regulator X-SVN-Commit-Revision: 338457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 19:18:56 -0000 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, ®node_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;