The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Yuntao Wang <ytcoode@gmail.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Simon Horman <horms@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] x86/kexec: Simplify the logic of mem_region_callback()
Date: Wed, 13 Dec 2023 10:47:52 +0800	[thread overview]
Message-ID: <ZXkbWMzCsU5S5szm@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20231212150506.31711-1-ytcoode@gmail.com>

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
> 


      reply	other threads:[~2023-12-13  2:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZXkbWMzCsU5S5szm@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=horms@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=ytcoode@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox