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: <1988db9d-6340-1e36-d567-21b2164fbeb2@arm.com>
Date:   Thu, 28 May 2020 14:22:57 +0100
From:   Steven Price <steven.price@....com>
To:     Clément Péron <peron.clem@...il.com>,
        Rob Herring <robh@...nel.org>,
        Tomeu Vizoso <tomeu.vizoso@...labora.com>,
        Alyssa Rosenzweig <alyssa.rosenzweig@...labora.com>,
        Viresh Kumar <vireshk@...nel.org>, Nishanth Menon <nm@...com>,
        Stephen Boyd <sboyd@...nel.org>,
        Maxime Ripard <mripard@...nel.org>,
        Chen-Yu Tsai <wens@...e.org>
Cc:     dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 09/15] drm/panfrost: dynamically alloc regulators

On 10/05/2020 17:55, Clément Péron wrote:
> We will later introduce regulators managed by OPP.
> 
> Only alloc regulators when it's needed. This also help use
> to release the regulators only when they are allocated.
> 
> Signed-off-by: Clément Péron <peron.clem@...il.com>

LGTM:

Reviewed-by: Steven Price <steven.price@....com>

> ---
>   drivers/gpu/drm/panfrost/panfrost_device.c | 14 +++++++++-----
>   drivers/gpu/drm/panfrost/panfrost_device.h |  3 +--
>   2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c
> index f480127205d6..67eedf64e82d 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_device.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.c
> @@ -90,9 +90,11 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev)
>   {
>   	int ret, i;
>   
> -	if (WARN(pfdev->comp->num_supplies > ARRAY_SIZE(pfdev->regulators),
> -			"Too many supplies in compatible structure.\n"))
> -		return -EINVAL;
> +	pfdev->regulators = devm_kcalloc(pfdev->dev, pfdev->comp->num_supplies,
> +					 sizeof(*pfdev->regulators),
> +					 GFP_KERNEL);
> +	if (!pfdev->regulators)
> +		return -ENOMEM;
>   
>   	for (i = 0; i < pfdev->comp->num_supplies; i++)
>   		pfdev->regulators[i].supply = pfdev->comp->supply_names[i];
> @@ -117,8 +119,10 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev)
>   
>   static void panfrost_regulator_fini(struct panfrost_device *pfdev)
>   {
> -	regulator_bulk_disable(pfdev->comp->num_supplies,
> -			pfdev->regulators);
> +	if (!pfdev->regulators)
> +		return;
> +
> +	regulator_bulk_disable(pfdev->comp->num_supplies, pfdev->regulators);
>   }
>   
>   static void panfrost_pm_domain_fini(struct panfrost_device *pfdev)
> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h
> index 2efa59c9d1c5..953f7536a773 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_device.h
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.h
> @@ -22,7 +22,6 @@ struct panfrost_job;
>   struct panfrost_perfcnt;
>   
>   #define NUM_JOB_SLOTS 3
> -#define MAX_REGULATORS 2
>   #define MAX_PM_DOMAINS 3
>   
>   struct panfrost_features {
> @@ -81,7 +80,7 @@ struct panfrost_device {
>   	void __iomem *iomem;
>   	struct clk *clock;
>   	struct clk *bus_clock;
> -	struct regulator_bulk_data regulators[MAX_REGULATORS];
> +	struct regulator_bulk_data *regulators;
>   	struct reset_control *rstc;
>   	/* pm_domains for devices with more than one. */
>   	struct device *pm_domain_devs[MAX_PM_DOMAINS];
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ