* [PATCH] platforms/83xx: Use of_device_get_match_data()
@ 2022-02-21 2:03 cgel.zte
2022-02-21 6:35 ` Christophe Leroy
2022-02-22 15:28 ` Christophe Leroy
0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2022-02-21 2:03 UTC (permalink / raw)
To: oss; +Cc: Zeal Robot, linux-kernel, Minghao Chi, linuxppc-dev
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);
if (!of_device_is_available(np))
return -ENODEV;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] platforms/83xx: Use of_device_get_match_data()
2022-02-21 2:03 [PATCH] platforms/83xx: Use of_device_get_match_data() cgel.zte
@ 2022-02-21 6:35 ` Christophe Leroy
2022-02-22 15:28 ` Christophe Leroy
1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2022-02-21 6:35 UTC (permalink / raw)
To: linuxppc-dev@lists.ozlabs.org
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;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] platforms/83xx: Use of_device_get_match_data()
2022-02-21 2:03 [PATCH] platforms/83xx: Use of_device_get_match_data() cgel.zte
2022-02-21 6:35 ` Christophe Leroy
@ 2022-02-22 15:28 ` Christophe Leroy
1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2022-02-22 15:28 UTC (permalink / raw)
To: cgel.zte@gmail.com, oss@buserror.net
Cc: Zeal Robot, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, Minghao Chi
Resending as I accidentaly sent my response to the list only.
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;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-22 15:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-21 2:03 [PATCH] platforms/83xx: Use of_device_get_match_data() cgel.zte
2022-02-21 6:35 ` Christophe Leroy
2022-02-22 15:28 ` Christophe Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox