[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <27777e38-5967-6c87-210a-626461ec125c@wanadoo.fr>
Date: Tue, 24 May 2022 22:24:31 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: cgel.zte@...il.com, oss@...error.net
Cc: mpe@...erman.id.au, benh@...nel.crashing.org,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
Minghao Chi <chi.minghao@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH V2] platforms/83xx: Use of_device_get_match_data()
Le 25/02/2022 à 02:07, cgel.zte@...il.com a écrit :
> From: Minghao Chi (CGEL ZTE) <chi.minghao@....com.cn>
>
> Use of_device_get_match_data() to simplify the code.
> v1->v2:
> Add a judgment on the return value of the A function as NULL
>
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@....com.cn>
> ---
> arch/powerpc/platforms/83xx/suspend.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
> index bb147d34d4a6..6d47a5b81485 100644
> --- a/arch/powerpc/platforms/83xx/suspend.c
> +++ b/arch/powerpc/platforms/83xx/suspend.c
> @@ -322,18 +322,15 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
> static const struct of_device_id pmc_match[];
Hi,
I think that the line above can now be removed as well.
just my 2c.
CJ
> static int pmc_probe(struct platform_device *ofdev)
> {
> - const struct of_device_id *match;
> struct device_node *np = ofdev->dev.of_node;
> struct resource res;
> const struct pmc_type *type;
> int ret = 0;
>
> - match = of_match_device(pmc_match, &ofdev->dev);
> - if (!match)
> + type = of_device_get_match_data(&ofdev->dev);
> + if (!type)
> return -EINVAL;
>
> - type = match->data;
> -
> if (!of_device_is_available(np))
> return -ENODEV;
>
Powered by blists - more mailing lists