From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] platforms/83xx: Use of_device_get_match_data()
Date: Mon, 21 Feb 2022 06:35:13 +0000 [thread overview]
Message-ID: <1acf7ba2-6ad4-e460-3642-89cc8a07ac56@csgroup.eu> (raw)
In-Reply-To: <20220221020323.1925215-1-chi.minghao@zte.com.cn>
Le 21/02/2022 à 03:03, cgel.zte@gmail.com a écrit :
> From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
>
> Use of_device_get_match_data() to simplify the code.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> ---
> arch/powerpc/platforms/83xx/suspend.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
> index bb147d34d4a6..9ae9268b683c 100644
> --- a/arch/powerpc/platforms/83xx/suspend.c
> +++ b/arch/powerpc/platforms/83xx/suspend.c
> @@ -322,17 +322,12 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
> static const struct of_device_id pmc_match[];
> 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)
> - return -EINVAL;
> -
> - type = match->data;
> + type = of_device_get_match_data(&ofdev->dev);
What happens when of_device_get_match_data() returns NULL ?
>
> if (!of_device_is_available(np))
> return -ENODEV;
next prev parent reply other threads:[~2022-02-21 6:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 2:03 [PATCH] platforms/83xx: Use of_device_get_match_data() cgel.zte
2022-02-21 6:35 ` Christophe Leroy [this message]
2022-02-22 15:28 ` Christophe Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1acf7ba2-6ad4-e460-3642-89cc8a07ac56@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox