diff mbox series

[4/6] can: sja1000: Use of_device_get_match_data to get device data

Message ID 20220702140130.218409-5-biju.das.jz@bp.renesas.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Add support for RZ/N1 SJA1000 CAN controller | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: prabhakar.mahadev-lad.rj@bp.renesas.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Biju Das July 2, 2022, 2:01 p.m. UTC
This patch replaces of_match_device->of_device_get_match_data
to get pointer to device data.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/can/sja1000/sja1000_platform.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Marc Kleine-Budde July 2, 2022, 4:18 p.m. UTC | #1
On 02.07.2022 15:01:28, Biju Das wrote:
> This patch replaces of_match_device->of_device_get_match_data
> to get pointer to device data.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  drivers/net/can/sja1000/sja1000_platform.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c
> index f9ec7bd8dfac..24ea0f76e130 100644
> --- a/drivers/net/can/sja1000/sja1000_platform.c
> +++ b/drivers/net/can/sja1000/sja1000_platform.c
> @@ -210,7 +210,6 @@ static int sp_probe(struct platform_device *pdev)
>  	struct resource *res_mem, *res_irq = NULL;
>  	struct sja1000_platform_data *pdata;
>  	struct device_node *of = pdev->dev.of_node;
> -	const struct of_device_id *of_id;
>  	const struct sja1000_of_data *of_data = NULL;
>  	size_t priv_sz = 0;
>  
> @@ -243,11 +242,9 @@ static int sp_probe(struct platform_device *pdev)
>  			return -ENODEV;
>  	}
>  
> -	of_id = of_match_device(sp_of_table, &pdev->dev);
> -	if (of_id && of_id->data) {
> -		of_data = of_id->data;
> +	of_data = of_device_get_match_data(&pdev->dev);

Can you use device_get_match_data() instead?

Marc
Biju Das July 2, 2022, 6:35 p.m. UTC | #2
Hi Marc,

Thanks for the feedback.


> Subject: Re: [PATCH 4/6] can: sja1000: Use of_device_get_match_data to
> get device data
> 
> On 02.07.2022 15:01:28, Biju Das wrote:
> > This patch replaces of_match_device->of_device_get_match_data
> > to get pointer to device data.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> >  drivers/net/can/sja1000/sja1000_platform.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/can/sja1000/sja1000_platform.c
> b/drivers/net/can/sja1000/sja1000_platform.c
> > index f9ec7bd8dfac..24ea0f76e130 100644
> > --- a/drivers/net/can/sja1000/sja1000_platform.c
> > +++ b/drivers/net/can/sja1000/sja1000_platform.c
> > @@ -210,7 +210,6 @@ static int sp_probe(struct platform_device *pdev)
> >  	struct resource *res_mem, *res_irq = NULL;
> >  	struct sja1000_platform_data *pdata;
> >  	struct device_node *of = pdev->dev.of_node;
> > -	const struct of_device_id *of_id;
> >  	const struct sja1000_of_data *of_data = NULL;
> >  	size_t priv_sz = 0;
> >
> > @@ -243,11 +242,9 @@ static int sp_probe(struct platform_device *pdev)
> >  			return -ENODEV;
> >  	}
> >
> > -	of_id = of_match_device(sp_of_table, &pdev->dev);
> > -	if (of_id && of_id->data) {
> > -		of_data = of_id->data;
> > +	of_data = of_device_get_match_data(&pdev->dev);
> 
> Can you use device_get_match_data() instead?

Agreed, Will use device_get_match_data()

Cheers,
Biju
diff mbox series

Patch

diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c
index f9ec7bd8dfac..24ea0f76e130 100644
--- a/drivers/net/can/sja1000/sja1000_platform.c
+++ b/drivers/net/can/sja1000/sja1000_platform.c
@@ -210,7 +210,6 @@  static int sp_probe(struct platform_device *pdev)
 	struct resource *res_mem, *res_irq = NULL;
 	struct sja1000_platform_data *pdata;
 	struct device_node *of = pdev->dev.of_node;
-	const struct of_device_id *of_id;
 	const struct sja1000_of_data *of_data = NULL;
 	size_t priv_sz = 0;
 
@@ -243,11 +242,9 @@  static int sp_probe(struct platform_device *pdev)
 			return -ENODEV;
 	}
 
-	of_id = of_match_device(sp_of_table, &pdev->dev);
-	if (of_id && of_id->data) {
-		of_data = of_id->data;
+	of_data = of_device_get_match_data(&pdev->dev);
+	if (of_data)
 		priv_sz = of_data->priv_sz;
-	}
 
 	dev = alloc_sja1000dev(priv_sz);
 	if (!dev)