All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/kexec: Simplify the logic of mem_region_callback()
@ 2023-12-12 15:05 Yuntao Wang
  2023-12-13  2:47 ` Baoquan He
  0 siblings, 1 reply; 2+ messages in thread
From: Yuntao Wang @ 2023-12-12 15:05 UTC (permalink / raw)
  To: linux-kernel, x86
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Baoquan He, Bjorn Helgaas, Simon Horman,
	Andrew Morton, Yuntao Wang

The expression `mstart + resource_size(res) - 1` is actually equivalent to
`res->end`, simplify the logic of this function to improve readability.

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
 arch/x86/kernel/machine_kexec_64.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 1a3e2c05a8a5..6f8df998890e 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -42,12 +42,9 @@ struct init_pgtable_data {
 static int mem_region_callback(struct resource *res, void *arg)
 {
 	struct init_pgtable_data *data = arg;
-	unsigned long mstart, mend;
-
-	mstart = res->start;
-	mend = mstart + resource_size(res) - 1;
 
-	return kernel_ident_mapping_init(data->info, data->level4p, mstart, mend);
+	return kernel_ident_mapping_init(data->info, data->level4p,
+					 res->start, res->end);
 }
 
 static int
-- 
2.43.0


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

* Re: [PATCH] x86/kexec: Simplify the logic of mem_region_callback()
  2023-12-12 15:05 [PATCH] x86/kexec: Simplify the logic of mem_region_callback() Yuntao Wang
@ 2023-12-13  2:47 ` Baoquan He
  0 siblings, 0 replies; 2+ messages in thread
From: Baoquan He @ 2023-12-13  2:47 UTC (permalink / raw)
  To: Yuntao Wang
  Cc: linux-kernel, x86, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Bjorn Helgaas, Simon Horman,
	Andrew Morton

On 12/12/23 at 11:05pm, Yuntao Wang wrote:
> The expression `mstart + resource_size(res) - 1` is actually equivalent to
> `res->end`, simplify the logic of this function to improve readability.
> 
> Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
> ---
>  arch/x86/kernel/machine_kexec_64.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

LGTM,

Acked-by: Baoquan He <bhe@redhat.com>

> 
> diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
> index 1a3e2c05a8a5..6f8df998890e 100644
> --- a/arch/x86/kernel/machine_kexec_64.c
> +++ b/arch/x86/kernel/machine_kexec_64.c
> @@ -42,12 +42,9 @@ struct init_pgtable_data {
>  static int mem_region_callback(struct resource *res, void *arg)
>  {
>  	struct init_pgtable_data *data = arg;
> -	unsigned long mstart, mend;
> -
> -	mstart = res->start;
> -	mend = mstart + resource_size(res) - 1;
>  
> -	return kernel_ident_mapping_init(data->info, data->level4p, mstart, mend);
> +	return kernel_ident_mapping_init(data->info, data->level4p,
> +					 res->start, res->end);
>  }
>  
>  static int
> -- 
> 2.43.0
> 


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

end of thread, other threads:[~2023-12-13  2:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-12 15:05 [PATCH] x86/kexec: Simplify the logic of mem_region_callback() Yuntao Wang
2023-12-13  2:47 ` Baoquan He

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.