dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] use resource_size
@ 2020-01-01 17:49 Julia Lawall
  2020-01-01 17:49 ` [PATCH 03/10] fbdev: s1d13xxxfb: " Julia Lawall
  2020-01-01 17:49 ` [PATCH 07/10] video: fbdev: " Julia Lawall
  0 siblings, 2 replies; 5+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: linux-fbdev, alsa-devel, netdev, linux-usb, kernel-janitors,
	linux-kernel, dri-devel, linux-mips, NXP Linux Team,
	Pengutronix Kernel Team, linuxppc-dev, linux-arm-kernel

Use resource_size rather than a verbose computation on
the end and start fields.

The semantic patch that makes these changes is as follows:
(http://coccinelle.lip6.fr/)

<smpl>
@@
struct resource ptr;
@@

- ((ptr.end) - (ptr.start) + 1)
+ resource_size(&ptr)

@@
struct resource *ptr;
@@

- ((ptr->end) - (ptr->start) + 1)
+ resource_size(ptr)

@@
struct resource ptr;
@@

- ((ptr.end) + 1 - (ptr.start))
+ resource_size(&ptr)

@@
struct resource *ptr;
@@

- ((ptr->end) + 1 - (ptr->start))
+ resource_size(ptr)
</smpl>

---

 arch/mips/kernel/setup.c                  |    6 ++----
 arch/powerpc/platforms/83xx/km83xx.c      |    2 +-
 arch/powerpc/platforms/powernv/pci-ioda.c |    4 ++--
 arch/x86/kernel/crash.c                   |    2 +-
 drivers/net/ethernet/freescale/fman/mac.c |    4 ++--
 drivers/usb/gadget/udc/omap_udc.c         |    6 +++---
 drivers/video/fbdev/cg14.c                |    3 +--
 drivers/video/fbdev/s1d13xxxfb.c          |   16 ++++++++--------
 sound/drivers/ml403-ac97cr.c              |    4 +---
 sound/soc/sof/imx/imx8.c                  |    3 +--
 10 files changed, 22 insertions(+), 28 deletions(-)
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 03/10] fbdev: s1d13xxxfb: use resource_size
  2020-01-01 17:49 [PATCH 00/10] use resource_size Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-15 16:06   ` Bartlomiej Zolnierkiewicz
  2020-01-01 17:49 ` [PATCH 07/10] video: fbdev: " Julia Lawall
  1 sibling, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Kristoffer Ericson
  Cc: linux-fbdev, kernel-janitors, linux-kernel, dri-devel,
	Bartlomiej Zolnierkiewicz

Use resource_size rather than a verbose computation on
the end and start fields.

The semantic patch that makes these changes is as follows:
(http://coccinelle.lip6.fr/)

<smpl>
@@ struct resource ptr; @@
- (ptr.end - ptr.start + 1)
+ resource_size(&ptr)
</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

---
 drivers/video/fbdev/s1d13xxxfb.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/video/fbdev/s1d13xxxfb.c b/drivers/video/fbdev/s1d13xxxfb.c
index 8048499e398d..eaea8c373753 100644
--- a/drivers/video/fbdev/s1d13xxxfb.c
+++ b/drivers/video/fbdev/s1d13xxxfb.c
@@ -746,9 +746,9 @@ s1d13xxxfb_remove(struct platform_device *pdev)
 	}
 
 	release_mem_region(pdev->resource[0].start,
-			pdev->resource[0].end - pdev->resource[0].start +1);
+			   resource_size(&pdev->resource[0]));
 	release_mem_region(pdev->resource[1].start,
-			pdev->resource[1].end - pdev->resource[1].start +1);
+			   resource_size(&pdev->resource[1]));
 	return 0;
 }
 
@@ -788,14 +788,14 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
 	}
 
 	if (!request_mem_region(pdev->resource[0].start,
-		pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) {
+		resource_size(&pdev->resource[0]), "s1d13xxxfb mem")) {
 		dev_dbg(&pdev->dev, "request_mem_region failed\n");
 		ret = -EBUSY;
 		goto bail;
 	}
 
 	if (!request_mem_region(pdev->resource[1].start,
-		pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) {
+		resource_size(&pdev->resource[1]), "s1d13xxxfb regs")) {
 		dev_dbg(&pdev->dev, "request_mem_region failed\n");
 		ret = -EBUSY;
 		goto bail;
@@ -810,7 +810,7 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, info);
 	default_par = info->par;
 	default_par->regs = ioremap(pdev->resource[1].start,
-			pdev->resource[1].end - pdev->resource[1].start +1);
+				    resource_size(&pdev->resource[1]));
 	if (!default_par->regs) {
 		printk(KERN_ERR PFX "unable to map registers\n");
 		ret = -ENOMEM;
@@ -819,7 +819,7 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
 	info->pseudo_palette = default_par->pseudo_palette;
 
 	info->screen_base = ioremap(pdev->resource[0].start,
-			pdev->resource[0].end - pdev->resource[0].start +1);
+				    resource_size(&pdev->resource[0]));
 
 	if (!info->screen_base) {
 		printk(KERN_ERR PFX "unable to map framebuffer\n");
@@ -857,9 +857,9 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
 
 	info->fix = s1d13xxxfb_fix;
 	info->fix.mmio_start = pdev->resource[1].start;
-	info->fix.mmio_len = pdev->resource[1].end - pdev->resource[1].start + 1;
+	info->fix.mmio_len = resource_size(&pdev->resource[1]);
 	info->fix.smem_start = pdev->resource[0].start;
-	info->fix.smem_len = pdev->resource[0].end - pdev->resource[0].start + 1;
+	info->fix.smem_len = resource_size(&pdev->resource[0]);
 
 	printk(KERN_INFO PFX "regs mapped at 0x%p, fb %d KiB mapped at 0x%p\n",
 	       default_par->regs, info->fix.smem_len / 1024, info->screen_base);

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 07/10] video: fbdev: use resource_size
  2020-01-01 17:49 [PATCH 00/10] use resource_size Julia Lawall
  2020-01-01 17:49 ` [PATCH 03/10] fbdev: s1d13xxxfb: " Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-15 16:10   ` Bartlomiej Zolnierkiewicz
  1 sibling, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: linux-fbdev, kernel-janitors, linux-kernel, dri-devel

Use resource_size rather than a verbose computation on
the end and start fields.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

<smpl>
@@ struct resource ptr; @@
- (ptr.end - ptr.start + 1)
+ resource_size(&ptr)
</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

---
 drivers/video/fbdev/cg14.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/cg14.c b/drivers/video/fbdev/cg14.c
index a620b51cf7d0..6a745eb46ca1 100644
--- a/drivers/video/fbdev/cg14.c
+++ b/drivers/video/fbdev/cg14.c
@@ -509,8 +509,7 @@ static int cg14_probe(struct platform_device *op)
 	if (!par->regs || !par->clut || !par->cursor || !info->screen_base)
 		goto out_unmap_regs;
 
-	is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) ==
-		  (8 * 1024 * 1024));
+	is_8mb = (resource_size(&op->resource[1]) == (8 * 1024 * 1024));
 
 	BUILD_BUG_ON(sizeof(par->mmap_map) != sizeof(__cg14_mmap_map));
 		

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 03/10] fbdev: s1d13xxxfb: use resource_size
  2020-01-01 17:49 ` [PATCH 03/10] fbdev: s1d13xxxfb: " Julia Lawall
@ 2020-01-15 16:06   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2020-01-15 16:06 UTC (permalink / raw)
  To: Julia Lawall
  Cc: linux-fbdev, Kristoffer Ericson, kernel-janitors, linux-kernel,
	dri-devel



On 1/1/20 6:49 PM, Julia Lawall wrote:
> Use resource_size rather than a verbose computation on
> the end and start fields.
> 
> The semantic patch that makes these changes is as follows:
> (http://coccinelle.lip6.fr/)
> 
> <smpl>
> @@ struct resource ptr; @@
> - (ptr.end - ptr.start + 1)
> + resource_size(&ptr)
> </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Patch queued for v5.6, thanks.
 
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> ---
>  drivers/video/fbdev/s1d13xxxfb.c |   16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/video/fbdev/s1d13xxxfb.c b/drivers/video/fbdev/s1d13xxxfb.c
> index 8048499e398d..eaea8c373753 100644
> --- a/drivers/video/fbdev/s1d13xxxfb.c
> +++ b/drivers/video/fbdev/s1d13xxxfb.c
> @@ -746,9 +746,9 @@ s1d13xxxfb_remove(struct platform_device *pdev)
>  	}
>  
>  	release_mem_region(pdev->resource[0].start,
> -			pdev->resource[0].end - pdev->resource[0].start +1);
> +			   resource_size(&pdev->resource[0]));
>  	release_mem_region(pdev->resource[1].start,
> -			pdev->resource[1].end - pdev->resource[1].start +1);
> +			   resource_size(&pdev->resource[1]));
>  	return 0;
>  }
>  
> @@ -788,14 +788,14 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
>  	}
>  
>  	if (!request_mem_region(pdev->resource[0].start,
> -		pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) {
> +		resource_size(&pdev->resource[0]), "s1d13xxxfb mem")) {
>  		dev_dbg(&pdev->dev, "request_mem_region failed\n");
>  		ret = -EBUSY;
>  		goto bail;
>  	}
>  
>  	if (!request_mem_region(pdev->resource[1].start,
> -		pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) {
> +		resource_size(&pdev->resource[1]), "s1d13xxxfb regs")) {
>  		dev_dbg(&pdev->dev, "request_mem_region failed\n");
>  		ret = -EBUSY;
>  		goto bail;
> @@ -810,7 +810,7 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, info);
>  	default_par = info->par;
>  	default_par->regs = ioremap(pdev->resource[1].start,
> -			pdev->resource[1].end - pdev->resource[1].start +1);
> +				    resource_size(&pdev->resource[1]));
>  	if (!default_par->regs) {
>  		printk(KERN_ERR PFX "unable to map registers\n");
>  		ret = -ENOMEM;
> @@ -819,7 +819,7 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
>  	info->pseudo_palette = default_par->pseudo_palette;
>  
>  	info->screen_base = ioremap(pdev->resource[0].start,
> -			pdev->resource[0].end - pdev->resource[0].start +1);
> +				    resource_size(&pdev->resource[0]));
>  
>  	if (!info->screen_base) {
>  		printk(KERN_ERR PFX "unable to map framebuffer\n");
> @@ -857,9 +857,9 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
>  
>  	info->fix = s1d13xxxfb_fix;
>  	info->fix.mmio_start = pdev->resource[1].start;
> -	info->fix.mmio_len = pdev->resource[1].end - pdev->resource[1].start + 1;
> +	info->fix.mmio_len = resource_size(&pdev->resource[1]);
>  	info->fix.smem_start = pdev->resource[0].start;
> -	info->fix.smem_len = pdev->resource[0].end - pdev->resource[0].start + 1;
> +	info->fix.smem_len = resource_size(&pdev->resource[0]);
>  
>  	printk(KERN_INFO PFX "regs mapped at 0x%p, fb %d KiB mapped at 0x%p\n",
>  	       default_par->regs, info->fix.smem_len / 1024, info->screen_base);
> 
> 
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 07/10] video: fbdev: use resource_size
  2020-01-01 17:49 ` [PATCH 07/10] video: fbdev: " Julia Lawall
@ 2020-01-15 16:10   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2020-01-15 16:10 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-fbdev, kernel-janitors, linux-kernel, dri-devel


On 1/1/20 6:49 PM, Julia Lawall wrote:
> Use resource_size rather than a verbose computation on
> the end and start fields.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> <smpl>
> @@ struct resource ptr; @@
> - (ptr.end - ptr.start + 1)
> + resource_size(&ptr)
> </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Patch queued for v5.6 (with patch summary modified slightly to
reflect that this a change for cg14fb fbdev driver), thanks.
 
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> ---
>  drivers/video/fbdev/cg14.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbdev/cg14.c b/drivers/video/fbdev/cg14.c
> index a620b51cf7d0..6a745eb46ca1 100644
> --- a/drivers/video/fbdev/cg14.c
> +++ b/drivers/video/fbdev/cg14.c
> @@ -509,8 +509,7 @@ static int cg14_probe(struct platform_device *op)
>  	if (!par->regs || !par->clut || !par->cursor || !info->screen_base)
>  		goto out_unmap_regs;
>  
> -	is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) ==
> -		  (8 * 1024 * 1024));
> +	is_8mb = (resource_size(&op->resource[1]) == (8 * 1024 * 1024));
>  
>  	BUILD_BUG_ON(sizeof(par->mmap_map) != sizeof(__cg14_mmap_map));
>  		
> 
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-01-15 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-01 17:49 [PATCH 00/10] use resource_size Julia Lawall
2020-01-01 17:49 ` [PATCH 03/10] fbdev: s1d13xxxfb: " Julia Lawall
2020-01-15 16:06   ` Bartlomiej Zolnierkiewicz
2020-01-01 17:49 ` [PATCH 07/10] video: fbdev: " Julia Lawall
2020-01-15 16:10   ` Bartlomiej Zolnierkiewicz

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).