linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: sti/c8sectpfe: Make use of the helper function devm_platform_ioremap_resource_byname()
@ 2021-09-01  5:56 Cai Huoqing
  2021-09-01  7:53 ` Patrice CHOTARD
  2021-09-01  8:20 ` Hans Verkuil
  0 siblings, 2 replies; 4+ messages in thread
From: Cai Huoqing @ 2021-09-01  5:56 UTC (permalink / raw)
  To: caihuoqing
  Cc: Patrice Chotard, Mauro Carvalho Chehab, linux-arm-kernel,
	linux-media, linux-kernel

Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap_resource()
separately

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
index 02dc78bd7fab..9f05984f711a 100644
--- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
+++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
@@ -665,7 +665,6 @@ static int c8sectpfe_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *child, *np = dev->of_node;
 	struct c8sectpfei *fei;
-	struct resource *res;
 	int ret, index = 0;
 	struct channel_info *tsin;
 
@@ -676,14 +675,11 @@ static int c8sectpfe_probe(struct platform_device *pdev)
 
 	fei->dev = dev;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "c8sectpfe");
-	fei->io = devm_ioremap_resource(dev, res);
+	fei->io = devm_platform_ioremap_resource_byname(pdev, "c8sectpfe");
 	if (IS_ERR(fei->io))
 		return PTR_ERR(fei->io);
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-					"c8sectpfe-ram");
-	fei->sram = devm_ioremap_resource(dev, res);
+	fei->sram = devm_platform_ioremap_resource_byname(pdev, "c8sectpfe-ram");
 	if (IS_ERR(fei->sram))
 		return PTR_ERR(fei->sram);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] media: sti/c8sectpfe: Make use of the helper function devm_platform_ioremap_resource_byname()
  2021-09-01  5:56 [PATCH] media: sti/c8sectpfe: Make use of the helper function devm_platform_ioremap_resource_byname() Cai Huoqing
@ 2021-09-01  7:53 ` Patrice CHOTARD
  2021-09-01  8:20 ` Hans Verkuil
  1 sibling, 0 replies; 4+ messages in thread
From: Patrice CHOTARD @ 2021-09-01  7:53 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Mauro Carvalho Chehab, linux-arm-kernel, linux-media, linux-kernel

Hi Cai

On 9/1/21 7:56 AM, Cai Huoqing wrote:
> Use the devm_platform_ioremap_resource_byname() helper instead of
> calling platform_get_resource_byname() and devm_ioremap_resource()
> separately
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>  drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> index 02dc78bd7fab..9f05984f711a 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> @@ -665,7 +665,6 @@ static int c8sectpfe_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct device_node *child, *np = dev->of_node;
>  	struct c8sectpfei *fei;
> -	struct resource *res;
>  	int ret, index = 0;
>  	struct channel_info *tsin;
>  
> @@ -676,14 +675,11 @@ static int c8sectpfe_probe(struct platform_device *pdev)
>  
>  	fei->dev = dev;
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "c8sectpfe");
> -	fei->io = devm_ioremap_resource(dev, res);
> +	fei->io = devm_platform_ioremap_resource_byname(pdev, "c8sectpfe");
>  	if (IS_ERR(fei->io))
>  		return PTR_ERR(fei->io);
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> -					"c8sectpfe-ram");
> -	fei->sram = devm_ioremap_resource(dev, res);
> +	fei->sram = devm_platform_ioremap_resource_byname(pdev, "c8sectpfe-ram");
>  	if (IS_ERR(fei->sram))
>  		return PTR_ERR(fei->sram);
>  
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] media: sti/c8sectpfe: Make use of the helper function devm_platform_ioremap_resource_byname()
  2021-09-01  5:56 [PATCH] media: sti/c8sectpfe: Make use of the helper function devm_platform_ioremap_resource_byname() Cai Huoqing
  2021-09-01  7:53 ` Patrice CHOTARD
@ 2021-09-01  8:20 ` Hans Verkuil
  2021-09-01  8:41   ` Cai Huoqing
  1 sibling, 1 reply; 4+ messages in thread
From: Hans Verkuil @ 2021-09-01  8:20 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Patrice Chotard, Mauro Carvalho Chehab, linux-arm-kernel,
	linux-media, linux-kernel

On 01/09/2021 07:56, Cai Huoqing wrote:
> Use the devm_platform_ioremap_resource_byname() helper instead of
> calling platform_get_resource_byname() and devm_ioremap_resource()
> separately
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>  drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> index 02dc78bd7fab..9f05984f711a 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> @@ -665,7 +665,6 @@ static int c8sectpfe_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct device_node *child, *np = dev->of_node;
>  	struct c8sectpfei *fei;
> -	struct resource *res;
>  	int ret, index = 0;
>  	struct channel_info *tsin;
>  
> @@ -676,14 +675,11 @@ static int c8sectpfe_probe(struct platform_device *pdev)
>  
>  	fei->dev = dev;
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "c8sectpfe");
> -	fei->io = devm_ioremap_resource(dev, res);
> +	fei->io = devm_platform_ioremap_resource_byname(pdev, "c8sectpfe");
>  	if (IS_ERR(fei->io))
>  		return PTR_ERR(fei->io);
>  
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> -					"c8sectpfe-ram");
> -	fei->sram = devm_ioremap_resource(dev, res);
> +	fei->sram = devm_platform_ioremap_resource_byname(pdev, "c8sectpfe-ram");
>  	if (IS_ERR(fei->sram))
>  		return PTR_ERR(fei->sram);
>  
> 

Compile error:

drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c: In function ‘c8sectpfe_probe’:
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:686:33: error: ‘res’ undeclared (first use in this function); did you mean ‘ret’?
  686 |  fei->sram_size = resource_size(res);
      |                                 ^~~
      |                                 ret
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:686:33: note: each undeclared identifier is reported only once for each function it appears in

Regards,

	Hans

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] media: sti/c8sectpfe: Make use of the helper function devm_platform_ioremap_resource_byname()
  2021-09-01  8:20 ` Hans Verkuil
@ 2021-09-01  8:41   ` Cai Huoqing
  0 siblings, 0 replies; 4+ messages in thread
From: Cai Huoqing @ 2021-09-01  8:41 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Patrice Chotard, Mauro Carvalho Chehab, linux-arm-kernel,
	linux-media, linux-kernel

On 01 Sep 21 10:20:26, Hans Verkuil wrote:
> On 01/09/2021 07:56, Cai Huoqing wrote:
> > Use the devm_platform_ioremap_resource_byname() helper instead of
> > calling platform_get_resource_byname() and devm_ioremap_resource()
> > separately
> > 
> > Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> > ---
> >  drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 8 ++------
> >  1 file changed, 2 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> > index 02dc78bd7fab..9f05984f711a 100644
> > --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> > +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
> > @@ -665,7 +665,6 @@ static int c8sectpfe_probe(struct platform_device *pdev)
> >  	struct device *dev = &pdev->dev;
> >  	struct device_node *child, *np = dev->of_node;
> >  	struct c8sectpfei *fei;
> > -	struct resource *res;
> >  	int ret, index = 0;
> >  	struct channel_info *tsin;
> >  
> > @@ -676,14 +675,11 @@ static int c8sectpfe_probe(struct platform_device *pdev)
> >  
> >  	fei->dev = dev;
> >  
> > -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "c8sectpfe");
> > -	fei->io = devm_ioremap_resource(dev, res);
> > +	fei->io = devm_platform_ioremap_resource_byname(pdev, "c8sectpfe");
> >  	if (IS_ERR(fei->io))
> >  		return PTR_ERR(fei->io);
> >  
> > -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> > -					"c8sectpfe-ram");
> > -	fei->sram = devm_ioremap_resource(dev, res);
> > +	fei->sram = devm_platform_ioremap_resource_byname(pdev, "c8sectpfe-ram");
> >  	if (IS_ERR(fei->sram))
> >  		return PTR_ERR(fei->sram);
> >  
> > 
> 
> Compile error:
> 
> drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c: In function ‘c8sectpfe_probe’:
> drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:686:33: error: ‘res’ undeclared (first use in this function); did you mean ‘ret’?
>   686 |  fei->sram_size = resource_size(res);
>       |                                 ^~~
>       |                                 ret
> drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:686:33: note: each undeclared identifier is reported only once for each function it appears in
> 
> Regards,
> 
> 	Hans
I'm very sorry for it, please forget this patch-sti/c8sectpfe.

I have deleted the "struct resource *res;", if 'res' is used
anywhere, compiler will complain,then I should fix it.
But, in this case, I miss sti/c8sectpfe

Cai

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-01  8:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01  5:56 [PATCH] media: sti/c8sectpfe: Make use of the helper function devm_platform_ioremap_resource_byname() Cai Huoqing
2021-09-01  7:53 ` Patrice CHOTARD
2021-09-01  8:20 ` Hans Verkuil
2021-09-01  8:41   ` Cai Huoqing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).