Linux-MIPS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 00/10] use resource_size
@ 2020-01-01 17:49 Julia Lawall
  2020-01-01 17:49 ` [PATCH 08/10] MIPS: " Julia Lawall
  0 siblings, 1 reply; 4+ 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] 4+ messages in thread

* [PATCH 08/10] MIPS: 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 22:25   ` Philippe Mathieu-Daudé
  2020-01-10 19:36   ` Paul Burton
  0 siblings, 2 replies; 4+ 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	[flat|nested] 4+ 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; 4+ 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] 4+ 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; 4+ 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 --]
[-- Attachment #0: 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] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ 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 08/10] MIPS: " Julia Lawall
2020-01-01 22:25   ` Philippe Mathieu-Daudé
2020-01-10 19:36   ` Paul Burton

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org
	public-inbox-index linux-mips

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git