linux-kernel.vger.kernel.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 01/10] USB: omap_udc: " Julia Lawall
                   ` (9 more replies)
  0 siblings, 10 replies; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: kernel-janitors, linuxppc-dev, linux-fbdev, dri-devel, linux-usb,
	linux-kernel, alsa-devel, netdev, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, linux-arm-kernel, linux-mips

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

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

* [PATCH 01/10] USB: omap_udc: 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-01 17:49 ` [PATCH 02/10] ALSA: ml403-ac97cr: " Julia Lawall
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: kernel-janitors, Greg Kroah-Hartman, linux-usb, linux-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)
</smpl>

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

---
 drivers/usb/gadget/udc/omap_udc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c
index f36f0730afab..bd12417996db 100644
--- a/drivers/usb/gadget/udc/omap_udc.c
+++ b/drivers/usb/gadget/udc/omap_udc.c
@@ -2757,7 +2757,7 @@ static int omap_udc_probe(struct platform_device *pdev)
 
 	/* NOTE:  "knows" the order of the resources! */
 	if (!request_mem_region(pdev->resource[0].start,
-			pdev->resource[0].end - pdev->resource[0].start + 1,
+			resource_size(&pdev->resource[0]),
 			driver_name)) {
 		DBG("request_mem_region failed\n");
 		return -EBUSY;
@@ -2934,7 +2934,7 @@ static int omap_udc_probe(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]));
 
 	return status;
 }
@@ -2950,7 +2950,7 @@ static int omap_udc_remove(struct platform_device *pdev)
 	wait_for_completion(&done);
 
 	release_mem_region(pdev->resource[0].start,
-			pdev->resource[0].end - pdev->resource[0].start + 1);
+			   resource_size(&pdev->resource[0]));
 
 	return 0;
 }


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

* [PATCH 02/10] ALSA: ml403-ac97cr: use resource_size
  2020-01-01 17:49 [PATCH 00/10] use resource_size Julia Lawall
  2020-01-01 17:49 ` [PATCH 01/10] USB: omap_udc: " Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-01 19:17   ` Takashi Iwai
  2020-01-01 17:49 ` [PATCH 03/10] fbdev: s1d13xxxfb: " Julia Lawall
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: kernel-janitors, Takashi Iwai, alsa-devel, linux-kernel

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>

---
 sound/drivers/ml403-ac97cr.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c
index 4e6042e652f0..9de5caaf6047 100644
--- a/sound/drivers/ml403-ac97cr.c
+++ b/sound/drivers/ml403-ac97cr.c
@@ -1100,9 +1100,7 @@ snd_ml403_ac97cr_create(struct snd_card *card, struct platform_device *pfdev,
 	PDEBUG(INIT_INFO, "Trying to reserve resources now ...\n");
 	resource = platform_get_resource(pfdev, IORESOURCE_MEM, 0);
 	/* get "port" */
-	ml403_ac97cr->port = ioremap(resource->start,
-					     (resource->end) -
-					     (resource->start) + 1);
+	ml403_ac97cr->port = ioremap(resource->start, resource_size(resource));
 	if (ml403_ac97cr->port == NULL) {
 		snd_printk(KERN_ERR SND_ML403_AC97CR_DRIVER ": "
 			   "unable to remap memory region (%pR)\n",


^ permalink raw reply related	[flat|nested] 24+ 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 ` [PATCH 01/10] USB: omap_udc: " Julia Lawall
  2020-01-01 17:49 ` [PATCH 02/10] ALSA: ml403-ac97cr: " Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-15 16:06   ` Bartlomiej Zolnierkiewicz
  2020-01-01 17:49 ` [PATCH 04/10] fsl/fman: " Julia Lawall
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Kristoffer Ericson
  Cc: kernel-janitors, Bartlomiej Zolnierkiewicz, dri-devel,
	linux-fbdev, linux-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)
</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);


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

* [PATCH 04/10] fsl/fman: use resource_size
  2020-01-01 17:49 [PATCH 00/10] use resource_size Julia Lawall
                   ` (2 preceding siblings ...)
  2020-01-01 17:49 ` [PATCH 03/10] fbdev: s1d13xxxfb: " Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-03  0:31   ` David Miller
  2020-01-01 17:49 ` [PATCH 05/10] powerpc/83xx: " Julia Lawall
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Madalin Bucur; +Cc: kernel-janitors, David S. Miller, netdev, linux-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 + 1 - ptr.start)
+ resource_size(&ptr)

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

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

---
 drivers/net/ethernet/freescale/fman/mac.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index f0806ace1ae2..55f2122c3217 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -692,7 +692,7 @@ static int mac_probe(struct platform_device *_of_dev)
 
 	mac_dev->res = __devm_request_region(dev,
 					     fman_get_mem_region(priv->fman),
-					     res.start, res.end + 1 - res.start,
+					     res.start, resource_size(&res),
 					     "mac");
 	if (!mac_dev->res) {
 		dev_err(dev, "__devm_request_mem_region(mac) failed\n");
@@ -701,7 +701,7 @@ static int mac_probe(struct platform_device *_of_dev)
 	}
 
 	priv->vaddr = devm_ioremap(dev, mac_dev->res->start,
-				   mac_dev->res->end + 1 - mac_dev->res->start);
+				   resource_size(mac_dev->res));
 	if (!priv->vaddr) {
 		dev_err(dev, "devm_ioremap() failed\n");
 		err = -EIO;


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

* [PATCH 05/10] powerpc/83xx: use resource_size
  2020-01-01 17:49 [PATCH 00/10] use resource_size Julia Lawall
                   ` (3 preceding siblings ...)
  2020-01-01 17:49 ` [PATCH 04/10] fsl/fman: " Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-06 18:06   ` Scott Wood
  2020-01-29  5:17   ` Michael Ellerman
  2020-01-01 17:49 ` [PATCH 06/10] ASoC: SOF: imx8: " Julia Lawall
                   ` (4 subsequent siblings)
  9 siblings, 2 replies; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Scott Wood
  Cc: kernel-janitors, Kumar Gala, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, linuxppc-dev, linux-kernel

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>

---
 arch/powerpc/platforms/83xx/km83xx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/83xx/km83xx.c b/arch/powerpc/platforms/83xx/km83xx.c
index 3d89569e9e71..ada42f03915a 100644
--- a/arch/powerpc/platforms/83xx/km83xx.c
+++ b/arch/powerpc/platforms/83xx/km83xx.c
@@ -63,7 +63,7 @@ static void quirk_mpc8360e_qe_enet10(void)
 		return;
 	}
 
-	base = ioremap(res.start, res.end - res.start + 1);
+	base = ioremap(res.start, resource_size(&res));
 
 	/*
 	 * set output delay adjustments to default values according


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

* [PATCH 06/10] ASoC: SOF: imx8: use resource_size
  2020-01-01 17:49 [PATCH 00/10] use resource_size Julia Lawall
                   ` (4 preceding siblings ...)
  2020-01-01 17:49 ` [PATCH 05/10] powerpc/83xx: " Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-01 21:41   ` Applied "ASoC: SOF: imx8: use resource_size" to the asoc tree Mark Brown
  2020-01-01 17:49 ` [PATCH 07/10] video: fbdev: use resource_size Julia Lawall
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: kernel-janitors, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, alsa-devel, linux-arm-kernel, linux-kernel

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>

---
 sound/soc/sof/imx/imx8.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index cfefcfd92798..1fc48abfd46c 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -294,8 +294,7 @@ static int imx8_probe(struct snd_sof_dev *sdev)
 	}
 
 	sdev->bar[SOF_FW_BLK_TYPE_SRAM] = devm_ioremap_wc(sdev->dev, res.start,
-							  res.end - res.start +
-							  1);
+							  resource_size(&res));
 	if (!sdev->bar[SOF_FW_BLK_TYPE_SRAM]) {
 		dev_err(sdev->dev, "failed to ioremap mem 0x%x size 0x%x\n",
 			base, size);


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

* [PATCH 07/10] video: fbdev: use resource_size
  2020-01-01 17:49 [PATCH 00/10] use resource_size Julia Lawall
                   ` (5 preceding siblings ...)
  2020-01-01 17:49 ` [PATCH 06/10] ASoC: SOF: imx8: " Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-15 16:10   ` Bartlomiej Zolnierkiewicz
  2020-01-01 17:49 ` [PATCH 08/10] MIPS: " Julia Lawall
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: kernel-janitors, dri-devel, linux-fbdev, linux-kernel

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


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

* [PATCH 08/10] MIPS: use resource_size
  2020-01-01 17:49 [PATCH 00/10] use resource_size Julia Lawall
                   ` (6 preceding siblings ...)
  2020-01-01 17:49 ` [PATCH 07/10] video: fbdev: use resource_size Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-01 22:25   ` Philippe Mathieu-Daudé
  2020-01-10 19:36   ` Paul Burton
  2020-01-01 17:49 ` [PATCH 09/10] x86/crash: " Julia Lawall
  2020-01-01 17:49 ` [PATCH 10/10] powerpc/powernv: use resource_size Julia Lawall
  9 siblings, 2 replies; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: kernel-janitors, Paul Burton, James Hogan, linux-mips, linux-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)
</smpl>

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

---
 arch/mips/kernel/setup.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index c3d4212b5f1d..701f4bc3046f 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -515,8 +515,7 @@ static void __init request_crashkernel(struct resource *res)
 	ret = request_resource(res, &crashk_res);
 	if (!ret)
 		pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n",
-			(unsigned long)((crashk_res.end -
-					 crashk_res.start + 1) >> 20),
+			(unsigned long)(resource_size(&crashk_res) >> 20),
 			(unsigned long)(crashk_res.start  >> 20));
 }
 #else /* !defined(CONFIG_KEXEC)		*/
@@ -698,8 +697,7 @@ static void __init arch_mem_init(char **cmdline_p)
 	mips_parse_crashkernel();
 #ifdef CONFIG_KEXEC
 	if (crashk_res.start != crashk_res.end)
-		memblock_reserve(crashk_res.start,
-				 crashk_res.end - crashk_res.start + 1);
+		memblock_reserve(crashk_res.start, resource_size(&crashk_res));
 #endif
 	device_tree_init();
 	sparse_init();


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

* [PATCH 09/10] x86/crash: use resource_size
  2020-01-01 17:49 [PATCH 00/10] use resource_size Julia Lawall
                   ` (7 preceding siblings ...)
  2020-01-01 17:49 ` [PATCH 08/10] MIPS: " Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-09 13:47   ` [tip: x86/cleanups] x86/crash: Use resource_size() tip-bot2 for Julia Lawall
  2020-01-01 17:49 ` [PATCH 10/10] powerpc/powernv: use resource_size Julia Lawall
  9 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: kernel-janitors, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
	x86, linux-kernel

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>

---
 arch/x86/kernel/crash.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 00fc55ac7ffa..fd87b59452a3 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -370,7 +370,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params)
 	/* Add crashk_low_res region */
 	if (crashk_low_res.end) {
 		ei.addr = crashk_low_res.start;
-		ei.size = crashk_low_res.end - crashk_low_res.start + 1;
+		ei.size = resource_size(&crashk_low_res);
 		ei.type = E820_TYPE_RAM;
 		add_e820_entry(params, &ei);
 	}


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

* [PATCH 10/10] powerpc/powernv: use resource_size
  2020-01-01 17:49 [PATCH 00/10] use resource_size Julia Lawall
                   ` (8 preceding siblings ...)
  2020-01-01 17:49 ` [PATCH 09/10] x86/crash: " Julia Lawall
@ 2020-01-01 17:49 ` Julia Lawall
  2020-01-29  5:17   ` Michael Ellerman
  9 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 17:49 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: kernel-janitors, Paul Mackerras, Michael Ellerman, linuxppc-dev,
	linux-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)
</smpl>

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

---
 arch/powerpc/platforms/powernv/pci-ioda.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index da1068a9c263..364140145ce0 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -792,7 +792,7 @@ static int pnv_ioda_deconfigure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
 		fcomp = OPAL_IGNORE_RID_FUNCTION_NUMBER;
 		parent = pe->pbus->self;
 		if (pe->flags & PNV_IODA_PE_BUS_ALL)
-			count = pe->pbus->busn_res.end - pe->pbus->busn_res.start + 1;
+			count = resource_size(&pe->pbus->busn_res);
 		else
 			count = 1;
 
@@ -874,7 +874,7 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
 		fcomp = OPAL_IGNORE_RID_FUNCTION_NUMBER;
 		parent = pe->pbus->self;
 		if (pe->flags & PNV_IODA_PE_BUS_ALL)
-			count = pe->pbus->busn_res.end - pe->pbus->busn_res.start + 1;
+			count = resource_size(&pe->pbus->busn_res);
 		else
 			count = 1;
 


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

* Re: [PATCH 02/10] ALSA: ml403-ac97cr: use resource_size
  2020-01-01 17:49 ` [PATCH 02/10] ALSA: ml403-ac97cr: " Julia Lawall
@ 2020-01-01 19:17   ` Takashi Iwai
  2020-01-01 19:23     ` Julia Lawall
  0 siblings, 1 reply; 24+ messages in thread
From: Takashi Iwai @ 2020-01-01 19:17 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Jaroslav Kysela, kernel-janitors, Takashi Iwai, alsa-devel, linux-kernel

On Wed, 01 Jan 2020 18:49:42 +0100,
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>

Unfortunately this doesn't apply cleanly on my tree.  I guess you
worked on linux-next which contains a change outside the sound git
tree that converts ioremap_nocache() to ioremap().

We may apply it in sound git tree and let conflicts resolved at the
merge time.  OTOH, it's no urgent fix at all and can be postponed
after 5.6-rc1 merge, too -- then everything can be applied in a
cleaner way.

Let me know your preference.


thanks,

Takashi

> 
> ---
>  sound/drivers/ml403-ac97cr.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c
> index 4e6042e652f0..9de5caaf6047 100644
> --- a/sound/drivers/ml403-ac97cr.c
> +++ b/sound/drivers/ml403-ac97cr.c
> @@ -1100,9 +1100,7 @@ snd_ml403_ac97cr_create(struct snd_card *card, struct platform_device *pfdev,
>  	PDEBUG(INIT_INFO, "Trying to reserve resources now ...\n");
>  	resource = platform_get_resource(pfdev, IORESOURCE_MEM, 0);
>  	/* get "port" */
> -	ml403_ac97cr->port = ioremap(resource->start,
> -					     (resource->end) -
> -					     (resource->start) + 1);
> +	ml403_ac97cr->port = ioremap(resource->start, resource_size(resource));
>  	if (ml403_ac97cr->port == NULL) {
>  		snd_printk(KERN_ERR SND_ML403_AC97CR_DRIVER ": "
>  			   "unable to remap memory region (%pR)\n",
> 

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

* Re: [PATCH 02/10] ALSA: ml403-ac97cr: use resource_size
  2020-01-01 19:17   ` Takashi Iwai
@ 2020-01-01 19:23     ` Julia Lawall
  2020-01-02 15:13       ` Takashi Iwai
  0 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2020-01-01 19:23 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Jaroslav Kysela, kernel-janitors, Takashi Iwai, alsa-devel, linux-kernel

On Wed, 1 Jan 2020, Takashi Iwai wrote:

> On Wed, 01 Jan 2020 18:49:42 +0100,
> 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>
>
> Unfortunately this doesn't apply cleanly on my tree.  I guess you
> worked on linux-next which contains a change outside the sound git
> tree that converts ioremap_nocache() to ioremap().
>
> We may apply it in sound git tree and let conflicts resolved at the
> merge time.  OTOH, it's no urgent fix at all and can be postponed
> after 5.6-rc1 merge, too -- then everything can be applied in a
> cleaner way.
>
> Let me know your preference.

It's from linux-next.  No hurry.  Postponing it is fine.

thanks,
julia

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

* Applied "ASoC: SOF: imx8: use resource_size" to the asoc tree
  2020-01-01 17:49 ` [PATCH 06/10] ASoC: SOF: imx8: " Julia Lawall
@ 2020-01-01 21:41   ` Mark Brown
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Brown @ 2020-01-01 21:41 UTC (permalink / raw)
  To: Julia Lawall
  Cc: alsa-devel, Fabio Estevam, Jaroslav Kysela, kernel-janitors,
	Liam Girdwood, linux-arm-kernel, linux-kernel, Mark Brown,
	NXP Linux Team, Pengutronix Kernel Team, Sascha Hauer, Shawn Guo,
	Takashi Iwai

The patch

   ASoC: SOF: imx8: use resource_size

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 49f261e273078a5dc0272296a833dc72571efd92 Mon Sep 17 00:00:00 2001
From: Julia Lawall <Julia.Lawall@inria.fr>
Date: Wed, 1 Jan 2020 18:49:46 +0100
Subject: [PATCH] ASoC: SOF: imx8: use resource_size

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>
Link: https://lore.kernel.org/r/1577900990-8588-7-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/imx/imx8.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index aef6ca167b9c..b2556f5e2871 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -294,8 +294,7 @@ static int imx8_probe(struct snd_sof_dev *sdev)
 	}
 
 	sdev->bar[SOF_FW_BLK_TYPE_SRAM] = devm_ioremap_wc(sdev->dev, res.start,
-							  res.end - res.start +
-							  1);
+							  resource_size(&res));
 	if (!sdev->bar[SOF_FW_BLK_TYPE_SRAM]) {
 		dev_err(sdev->dev, "failed to ioremap mem 0x%x size 0x%x\n",
 			base, size);
-- 
2.20.1


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

* Re: [PATCH 08/10] MIPS: use resource_size
  2020-01-01 17:49 ` [PATCH 08/10] MIPS: " Julia Lawall
@ 2020-01-01 22:25   ` Philippe Mathieu-Daudé
  2020-01-10 19:36   ` Paul Burton
  1 sibling, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-01-01 22:25 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Ralf Baechle, kernel-janitors, Paul Burton, James Hogan,
	open list:BROADCOM NVRAM DRIVER, open list

On Wed, Jan 1, 2020 at 7:26 PM Julia Lawall <Julia.Lawall@inria.fr> 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>
>
> ---
>  arch/mips/kernel/setup.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> index c3d4212b5f1d..701f4bc3046f 100644
> --- a/arch/mips/kernel/setup.c
> +++ b/arch/mips/kernel/setup.c
> @@ -515,8 +515,7 @@ static void __init request_crashkernel(struct resource *res)
>         ret = request_resource(res, &crashk_res);
>         if (!ret)
>                 pr_info("Reserving %ldMB of memory at %ldMB for crashkernel\n",
> -                       (unsigned long)((crashk_res.end -
> -                                        crashk_res.start + 1) >> 20),
> +                       (unsigned long)(resource_size(&crashk_res) >> 20),
>                         (unsigned long)(crashk_res.start  >> 20));
>  }
>  #else /* !defined(CONFIG_KEXEC)                */
> @@ -698,8 +697,7 @@ static void __init arch_mem_init(char **cmdline_p)
>         mips_parse_crashkernel();
>  #ifdef CONFIG_KEXEC
>         if (crashk_res.start != crashk_res.end)
> -               memblock_reserve(crashk_res.start,
> -                                crashk_res.end - crashk_res.start + 1);
> +               memblock_reserve(crashk_res.start, resource_size(&crashk_res));
>  #endif
>         device_tree_init();
>         sparse_init();
>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Thanks Julia!

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

* Re: [PATCH 02/10] ALSA: ml403-ac97cr: use resource_size
  2020-01-01 19:23     ` Julia Lawall
@ 2020-01-02 15:13       ` Takashi Iwai
  0 siblings, 0 replies; 24+ messages in thread
From: Takashi Iwai @ 2020-01-02 15:13 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Jaroslav Kysela, kernel-janitors, Takashi Iwai, alsa-devel, linux-kernel

On Wed, 01 Jan 2020 20:23:24 +0100,
Julia Lawall wrote:
> 
> On Wed, 1 Jan 2020, Takashi Iwai wrote:
> 
> > On Wed, 01 Jan 2020 18:49:42 +0100,
> > 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>
> >
> > Unfortunately this doesn't apply cleanly on my tree.  I guess you
> > worked on linux-next which contains a change outside the sound git
> > tree that converts ioremap_nocache() to ioremap().
> >
> > We may apply it in sound git tree and let conflicts resolved at the
> > merge time.  OTOH, it's no urgent fix at all and can be postponed
> > after 5.6-rc1 merge, too -- then everything can be applied in a
> > cleaner way.
> >
> > Let me know your preference.
> 
> It's from linux-next.  No hurry.  Postponing it is fine.

OK, let's postpone this.  Thanks.


Takashi

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

* Re: [PATCH 04/10] fsl/fman: use resource_size
  2020-01-01 17:49 ` [PATCH 04/10] fsl/fman: " Julia Lawall
@ 2020-01-03  0:31   ` David Miller
  0 siblings, 0 replies; 24+ messages in thread
From: David Miller @ 2020-01-03  0:31 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: madalin.bucur, kernel-janitors, netdev, linux-kernel

From: Julia Lawall <Julia.Lawall@inria.fr>
Date: Wed,  1 Jan 2020 18:49:44 +0100

> 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 + 1 - ptr.start)
> + resource_size(&ptr)
> 
> @@ struct resource *ptr; @@
> - (ptr->end + 1 - ptr->start)
> + resource_size(ptr)
> </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Applied to net-next.

Thanks Julia.

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

* Re: [PATCH 05/10] powerpc/83xx: use resource_size
  2020-01-01 17:49 ` [PATCH 05/10] powerpc/83xx: " Julia Lawall
@ 2020-01-06 18:06   ` Scott Wood
  2020-01-29  5:17   ` Michael Ellerman
  1 sibling, 0 replies; 24+ messages in thread
From: Scott Wood @ 2020-01-06 18:06 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Kumar Gala, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, linuxppc-dev, linux-kernel

On Wed, 2020-01-01 at 18:49 +0100, 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>
> 
> ---
>  arch/powerpc/platforms/83xx/km83xx.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Scott Wood <oss@buserror.net>

-Scott



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

* [tip: x86/cleanups] x86/crash: Use resource_size()
  2020-01-01 17:49 ` [PATCH 09/10] x86/crash: " Julia Lawall
@ 2020-01-09 13:47   ` tip-bot2 for Julia Lawall
  0 siblings, 0 replies; 24+ messages in thread
From: tip-bot2 for Julia Lawall @ 2020-01-09 13:47 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Julia Lawall, Borislav Petkov, x86, LKML

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     1429b568ad71943a374aa4a8d3772d5a8816ddba
Gitweb:        https://git.kernel.org/tip/1429b568ad71943a374aa4a8d3772d5a8816ddba
Author:        Julia Lawall <Julia.Lawall@inria.fr>
AuthorDate:    Wed, 01 Jan 2020 18:49:49 +01:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Thu, 09 Jan 2020 14:40:03 +01:00

x86/crash: Use resource_size()

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>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/1577900990-8588-10-git-send-email-Julia.Lawall@inria.fr
---
 arch/x86/kernel/crash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 00fc55a..fd87b59 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -370,7 +370,7 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params)
 	/* Add crashk_low_res region */
 	if (crashk_low_res.end) {
 		ei.addr = crashk_low_res.start;
-		ei.size = crashk_low_res.end - crashk_low_res.start + 1;
+		ei.size = resource_size(&crashk_low_res);
 		ei.type = E820_TYPE_RAM;
 		add_e820_entry(params, &ei);
 	}

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

* Re: [PATCH 08/10] MIPS: use resource_size
  2020-01-01 17:49 ` [PATCH 08/10] MIPS: " Julia Lawall
  2020-01-01 22:25   ` Philippe Mathieu-Daudé
@ 2020-01-10 19:36   ` Paul Burton
  1 sibling, 0 replies; 24+ messages in thread
From: Paul Burton @ 2020-01-10 19:36 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Ralf Baechle, kernel-janitors, Paul Burton, James Hogan,
	linux-mips, linux-kernel, linux-mips

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 720 bytes --]

Hello,

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>

Applied to mips-next.

> commit ecb983790fe8
> https://git.kernel.org/mips/c/ecb983790fe8
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Signed-off-by: Paul Burton <paulburton@kernel.org>

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paulburton@kernel.org to report it. ]

^ permalink raw reply	[flat|nested] 24+ 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; 24+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2020-01-15 16:06 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Kristoffer Ericson, kernel-janitors, dri-devel, linux-fbdev,
	linux-kernel



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

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

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


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

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

* Re: [PATCH 05/10] powerpc/83xx: use resource_size
  2020-01-01 17:49 ` [PATCH 05/10] powerpc/83xx: " Julia Lawall
  2020-01-06 18:06   ` Scott Wood
@ 2020-01-29  5:17   ` Michael Ellerman
  1 sibling, 0 replies; 24+ messages in thread
From: Michael Ellerman @ 2020-01-29  5:17 UTC (permalink / raw)
  To: Julia Lawall, Scott Wood
  Cc: kernel-janitors, linux-kernel, Paul Mackerras, linuxppc-dev

On Wed, 2020-01-01 at 17:49:45 UTC, 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>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/bfbe37f0ce994e7a9945653d7624fadc5c500a9f

cheers

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

* Re: [PATCH 10/10] powerpc/powernv: use resource_size
  2020-01-01 17:49 ` [PATCH 10/10] powerpc/powernv: use resource_size Julia Lawall
@ 2020-01-29  5:17   ` Michael Ellerman
  0 siblings, 0 replies; 24+ messages in thread
From: Michael Ellerman @ 2020-01-29  5:17 UTC (permalink / raw)
  To: Julia Lawall, Benjamin Herrenschmidt
  Cc: Paul Mackerras, kernel-janitors, linuxppc-dev, linux-kernel

On Wed, 2020-01-01 at 17:49:50 UTC, 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>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/552aa086944a9aeabd599892007c2c7faedb894e

cheers

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

end of thread, other threads:[~2020-01-29  5:18 UTC | newest]

Thread overview: 24+ 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 01/10] USB: omap_udc: " Julia Lawall
2020-01-01 17:49 ` [PATCH 02/10] ALSA: ml403-ac97cr: " Julia Lawall
2020-01-01 19:17   ` Takashi Iwai
2020-01-01 19:23     ` Julia Lawall
2020-01-02 15:13       ` Takashi Iwai
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 04/10] fsl/fman: " Julia Lawall
2020-01-03  0:31   ` David Miller
2020-01-01 17:49 ` [PATCH 05/10] powerpc/83xx: " Julia Lawall
2020-01-06 18:06   ` Scott Wood
2020-01-29  5:17   ` Michael Ellerman
2020-01-01 17:49 ` [PATCH 06/10] ASoC: SOF: imx8: " Julia Lawall
2020-01-01 21:41   ` Applied "ASoC: SOF: imx8: use resource_size" to the asoc tree Mark Brown
2020-01-01 17:49 ` [PATCH 07/10] video: fbdev: use resource_size Julia Lawall
2020-01-15 16:10   ` Bartlomiej Zolnierkiewicz
2020-01-01 17:49 ` [PATCH 08/10] MIPS: " Julia Lawall
2020-01-01 22:25   ` Philippe Mathieu-Daudé
2020-01-10 19:36   ` Paul Burton
2020-01-01 17:49 ` [PATCH 09/10] x86/crash: " Julia Lawall
2020-01-09 13:47   ` [tip: x86/cleanups] x86/crash: Use resource_size() tip-bot2 for Julia Lawall
2020-01-01 17:49 ` [PATCH 10/10] powerpc/powernv: use resource_size Julia Lawall
2020-01-29  5:17   ` Michael Ellerman

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