lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <ZQ0PR01MB1302D40B42B69887842A7377F219A@ZQ0PR01MB1302.CHNPR01.prod.partner.outlook.cn>
Date: Wed, 15 Jan 2025 01:55:56 +0000
From: Changhuang Liang <changhuang.liang@...rfivetech.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>, Geert Uytterhoeven
	<geert+renesas@...der.be>, Magnus Damm <magnus.damm@...il.com>, Ulf Hansson
	<ulf.hansson@...aro.org>, Krzysztof Kozlowski <krzk@...nel.org>, Alim Akhtar
	<alim.akhtar@...sung.com>, Walker Chen <walker.chen@...rfivetech.com>,
	"linux-renesas-soc@...r.kernel.org" <linux-renesas-soc@...r.kernel.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-samsung-soc@...r.kernel.org"
	<linux-samsung-soc@...r.kernel.org>
Subject:
 回复: [PATCH] pmdomain: Use str_enable_disable-like helpers

Hi, Krzysztof

Thanks for your patch.

> Replace ternary (condition ? "enable" : "disable") syntax with helpers from
> string_choices.h because:
> 1. Simple function call with one argument is easier to read.  Ternary
>    operator has three arguments and with wrapping might lead to quite
>    long code.
> 2. Is slightly shorter thus also easier to read.
> 3. It brings uniformity in the text - same string.
> 4. Allows deduping by the linker, which results in a smaller binary
>    file.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
> ---
>  drivers/pmdomain/renesas/rcar-gen4-sysc.c    | 3 ++-
>  drivers/pmdomain/renesas/rcar-sysc.c         | 3 ++-
>  drivers/pmdomain/samsung/exynos-pm-domains.c | 6 +++---
>  drivers/pmdomain/starfive/jh71xx-pmu.c       | 3 ++-
>  4 files changed, 9 insertions(+), 6 deletions(-)

[...]

> diff --git a/drivers/pmdomain/starfive/jh71xx-pmu.c
> b/drivers/pmdomain/starfive/jh71xx-pmu.c
> index 74720c09a6e3..30c29ac9391f 100644
> --- a/drivers/pmdomain/starfive/jh71xx-pmu.c
> +++ b/drivers/pmdomain/starfive/jh71xx-pmu.c
> @@ -12,6 +12,7 @@
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_domain.h>
> +#include <linux/string_choices.h>
>  #include <dt-bindings/power/starfive,jh7110-pmu.h>
> 
>  /* register offset */
> @@ -155,7 +156,7 @@ static int jh7110_pmu_set_state(struct
> jh71xx_pmu_dev *pmd, u32 mask, bool on)
> 
>  	if (ret) {
>  		dev_err(pmu->dev, "%s: failed to power %s\n",
> -			pmd->genpd.name, on ? "on" : "off");
> +			pmd->genpd.name, str_on_off(on));
>  		return -ETIMEDOUT;
>  	}

In jh71xx-pmu.c jh71xx_pmu_set_state(), maybe you can also change this line:

	if (is_on == on) {
		dev_dbg(pmu->dev, "pm domain [%s] is already %sable status.\n",
			pmd->genpd.name, on ? "en" : "dis");
		return 0;
	}
====>
	if (is_on == on) {
		dev_dbg(pmu->dev, "pm domain [%s] is already %s status.\n",
			pmd->genpd.name, str_enable_disable(on));
		return 0;
	}

Best Regards,
Changhuang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ