[PATCH v3 18/19] power: reset: syscon-poweroff: Move device data into a struct

Sebastian Reichel sebastian.reichel at collabora.com
Sun Feb 11 15:52:10 PST 2024


Hi Andrew,

On Thu, Feb 08, 2024 at 11:04:09AM -0600, Andrew Davis wrote:
> Currently all these device data elements are top level global variables.
> Move these into a struct. This will be used in the next patch when
> the global variable usage is removed. Doing this in two steps makes
> the patches easier to read.
> 
> Signed-off-by: Andrew Davis <afd at ti.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
> ---
>  drivers/power/reset/syscon-poweroff.c | 36 +++++++++++++++------------
>  1 file changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c
> index 1b2ce7734260c..4899a019256e8 100644
> --- a/drivers/power/reset/syscon-poweroff.c
> +++ b/drivers/power/reset/syscon-poweroff.c
> @@ -15,15 +15,19 @@
>  #include <linux/pm.h>
>  #include <linux/regmap.h>
>  
> -static struct regmap *map;
> -static u32 offset;
> -static u32 value;
> -static u32 mask;
> +struct syscon_poweroff_data {
> +	struct regmap *map;
> +	u32 offset;
> +	u32 value;
> +	u32 mask;
> +};
> +
> +static struct syscon_poweroff_data *data;

This patch is broken without the follow-up patch, since data is
never allocated. You need to move the memory allocation from the
next patch to this one.

Greetings,

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20240212/d489a63c/attachment.sig>


More information about the Linux-mediatek mailing list