[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <654792e7-f0ca-73b4-2a68-721bcffc8ff0@arm.com>
Date: Tue, 9 Mar 2021 15:17:37 +0000
From: Lukasz Luba <lukasz.luba@....com>
To: Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: rafael@...nel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH 4/5] powercap/drivers/dtpm: Use container_of instead of a
private data field
On 3/1/21 9:21 PM, Daniel Lezcano wrote:
> The dtpm framework provides an API to allocate a dtpm node. However
> when a backend dtpm driver needs to allocate a dtpm node it must
> define its own structure and store the pointer of this structure in
> the private field of the dtpm structure.
>
> It is more elegant to use the container_of macro and add the dtpm
> structure inside the dtpm backend specific structure. The code will be
> able to deal properly with the dtpm structure as a generic entity,
> making all this even more self-encapsulated.
>
> The dtpm_alloc() function does no longer make sense as the dtpm
> structure will be allocated when allocating the device specific dtpm
> structure. The dtpm_init() is provided instead.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
> ---
> drivers/powercap/dtpm.c | 27 ++++++++++------------
> drivers/powercap/dtpm_cpu.c | 46 ++++++++++++++++++-------------------
> include/linux/dtpm.h | 3 +--
> 3 files changed, 35 insertions(+), 41 deletions(-)
>
Reviewed-by: Lukasz Luba <lukasz.luba@....com>
Powered by blists - more mailing lists