From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC33C13D531; Mon, 20 Jan 2025 07:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737357035; cv=none; b=TNms7Bu5Rj9ODrEBKHGKwpQV+kfEBHoOfK/sI3pln/TnyyKbX6hjjms2OD2qvJgZ7Wu61xalyKEzFla3qSBabrqDiHTVORaOjDlspl8xqrdNutUFyJIZJFNQoczBRWF4UGMiTKy7Gvidzg2shlEHFAigXaZEnp0aQiHmzywpKm0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737357035; c=relaxed/simple; bh=hhiIowDDPlKiniZiubya6fCr04S5es+7qxmNrFX3e3s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rTBA7QsG5Z3BM8BwPzT75ekqRIFClKIhfQdwr3tLRDAEaM/F/iiU6wNjru8EochlMp0WDeTxw7KnrCpsqEQaQSb6rUvRWSGHybiaKIWwUQ6lExpFA04IKwYQkEmX1D15UKJW+2c7aRarf0JOyxeBi7qcI1G/gtOtAXSHgdX++tw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gn+lGuxF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gn+lGuxF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D25A1C4CEDD; Mon, 20 Jan 2025 07:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737357035; bh=hhiIowDDPlKiniZiubya6fCr04S5es+7qxmNrFX3e3s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gn+lGuxFY2FGoDwKruU5Ne3KVPiRvv5hBu5t1P/hqGYkJwBwjBYY21D1eeaiGNveA sEd+0LX2e5z9YmJhr+NZeRdI16bCcPVhJsngLJJOKjGX7wAWrHWzkGWL5qreaEOWfg atMrpDwLBBXsw07FSOjqxOwxK3IOSs8ESvgRj4f1cBhPUoLrrK0YgN9FP8cYxI1CqI XC8q1iNsDLpOgfvtyGrwvd5zDAXV79MOWjdM1TTndT5SrTS6oALQXrk3dDKu2+Qj3N bn+QwUrDJfbuXOEILXLcVbw4b+h7+/WUoBIRXaERch22SrpVp3Css63cc3wERxjxKc xDzkdM8lI5sbg== Date: Mon, 20 Jan 2025 07:10:28 +0000 From: Tzung-Bi Shih To: Ahmad Fatoum Cc: Andrew Morton , Daniel Lezcano , Fabio Estevam , "Rafael J. Wysocki" , Zhang Rui , Lukasz Luba , Jonathan Corbet , Serge Hallyn , Liam Girdwood , Mark Brown , Matti Vaittinen , Benson Leung , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-doc@vger.kernel.org, linux-security-module@vger.kernel.org, chrome-platform@lists.linux.dev, devicetree@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH v2 01/12] reboot: replace __hw_protection_shutdown bool action parameter with an enum Message-ID: References: <20250113-hw_protection-reboot-v2-0-161d3fc734f0@pengutronix.de> <20250113-hw_protection-reboot-v2-1-161d3fc734f0@pengutronix.de> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250113-hw_protection-reboot-v2-1-161d3fc734f0@pengutronix.de> On Mon, Jan 13, 2025 at 05:25:26PM +0100, Ahmad Fatoum wrote: > Currently __hw_protection_shutdown() either reboots or shuts down the > system according to its shutdown argument. > > To make the logic easier to follow, both inside __hw_protection_shutdown > and at caller sites, lets replace the bool parameter with an enum. > > This will be extra useful, when in a later commit, a third action is > added to the enumeration. > > No functional change. > > Signed-off-by: Ahmad Fatoum With a minor question, Reviewed-by: Tzung-Bi Shih > @@ -1009,10 +1007,10 @@ void __hw_protection_shutdown(const char *reason, int ms_until_forced, bool shut > * orderly_poweroff failure > */ > hw_failure_emergency_poweroff(ms_until_forced); > - if (shutdown) > - orderly_poweroff(true); > - else > + if (action == HWPROT_ACT_REBOOT) > orderly_reboot(); > + else > + orderly_poweroff(true); It probably doesn't really matter. Does it intend to change the branch order? As s/shutdown/action == HWPROT_ACT_SHUTDOWN/ should be more intuitive for the hunk to me.