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: <20240904050649.GD1532424@black.fi.intel.com>
Date: Wed, 4 Sep 2024 08:06:49 +0300
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
	Andy Shevchenko <andy@...nel.org>,
	Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH v1 3/3] pinctrl: cherryview: Replace ifdeffery by
 pm_sleep_ptr() macro

On Tue, Sep 03, 2024 at 08:04:51PM +0300, Andy Shevchenko wrote:
> Explicit ifdeffery is ugly and theoretically might be not synchronised
> with the rest of functions that are assigned via pm_sleep_ptr() macro.
> Replace ifdeffery by pm_sleep_ptr() macro to improve this.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/pinctrl/intel/pinctrl-cherryview.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
> index 2f0e29c78dfb..9cdffd73e345 100644
> --- a/drivers/pinctrl/intel/pinctrl-cherryview.c
> +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
> @@ -1608,6 +1608,16 @@ static acpi_status chv_pinctrl_mmio_access_handler(u32 function,
>  	return AE_OK;
>  }
>  
> +static int chv_pinctrl_pm_init(struct intel_pinctrl *pctrl)
> +{
> +	pctrl->context.pads = devm_kcalloc(pctrl->dev, pctrl->soc->npins,
> +					   sizeof(*pctrl->context.pads), GFP_KERNEL);
> +	if (!pctrl->context.pads)
> +		return -ENOMEM;
> +
> +	return 0;
> +}
> +
>  static int chv_pinctrl_probe(struct platform_device *pdev)
>  {
>  	const struct intel_pinctrl_soc_data *soc_data;
> @@ -1648,13 +1658,9 @@ static int chv_pinctrl_probe(struct platform_device *pdev)
>  
>  	community->pad_regs = community->regs + FAMILY_PAD_REGS_OFF;
>  
> -#ifdef CONFIG_PM_SLEEP
> -	pctrl->context.pads = devm_kcalloc(dev, pctrl->soc->npins,
> -					   sizeof(*pctrl->context.pads),
> -					   GFP_KERNEL);
> -	if (!pctrl->context.pads)
> -		return -ENOMEM;
> -#endif
> +	ret = pm_sleep_ptr(chv_pinctrl_pm_init) ? chv_pinctrl_pm_init(pctrl) : 0;

and here

> +	if (ret)
> +		return ret;
>  
>  	pctrl->context.communities = devm_kcalloc(dev, pctrl->soc->ncommunities,
>  						  sizeof(*pctrl->context.communities),
> -- 
> 2.43.0.rc1.1336.g36b5255a03ac

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ