* [PATCH] x86, setup: code clean of e820_reserve_setup_data()
@ 2015-06-04 2:18 Wei Yang
2015-06-04 5:42 ` Ingo Molnar
2015-06-04 6:18 ` Wei Yang
0 siblings, 2 replies; 5+ messages in thread
From: Wei Yang @ 2015-06-04 2:18 UTC (permalink / raw)
To: yinghai; +Cc: x86, linux-kernel, Wei Yang
pa_data and found are highly related, so there is no need to set a found
flag.
This patch removes the found and just return when pa_data is NULL.
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
---
arch/x86/kernel/setup.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 0a2421c..b95e653 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -461,19 +461,18 @@ static void __init e820_reserve_setup_data(void)
{
struct setup_data *data;
u64 pa_data;
- int found = 0;
pa_data = boot_params.hdr.setup_data;
+ if (!pa_data)
+ return;
+
while (pa_data) {
data = early_memremap(pa_data, sizeof(*data));
e820_update_range(pa_data, sizeof(*data)+data->len,
E820_RAM, E820_RESERVED_KERN);
- found = 1;
pa_data = data->next;
early_iounmap(data, sizeof(*data));
}
- if (!found)
- return;
sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
memcpy(&e820_saved, &e820, sizeof(struct e820map));
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] x86, setup: code clean of e820_reserve_setup_data()
2015-06-04 2:18 [PATCH] x86, setup: code clean of e820_reserve_setup_data() Wei Yang
@ 2015-06-04 5:42 ` Ingo Molnar
2015-06-04 7:07 ` Wei Yang
2015-06-04 6:18 ` Wei Yang
1 sibling, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2015-06-04 5:42 UTC (permalink / raw)
To: Wei Yang; +Cc: yinghai, x86, linux-kernel
* Wei Yang <weiyang@linux.vnet.ibm.com> wrote:
> pa_data and found are highly related, so there is no need to set a found
> flag.
>
> This patch removes the found and just return when pa_data is NULL.
>
> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
> ---
> arch/x86/kernel/setup.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 0a2421c..b95e653 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -461,19 +461,18 @@ static void __init e820_reserve_setup_data(void)
> {
> struct setup_data *data;
> u64 pa_data;
> - int found = 0;
>
> pa_data = boot_params.hdr.setup_data;
> + if (!pa_data)
> + return;
> +
> while (pa_data) {
> data = early_memremap(pa_data, sizeof(*data));
> e820_update_range(pa_data, sizeof(*data)+data->len,
> E820_RAM, E820_RESERVED_KERN);
> - found = 1;
> pa_data = data->next;
> early_iounmap(data, sizeof(*data));
> }
> - if (!found)
> - return;
>
> sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
> memcpy(&e820_saved, &e820, sizeof(struct e820map));
This patch does not apply to Linus's latest tree.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] x86, setup: code clean of e820_reserve_setup_data()
2015-06-04 2:18 [PATCH] x86, setup: code clean of e820_reserve_setup_data() Wei Yang
2015-06-04 5:42 ` Ingo Molnar
@ 2015-06-04 6:18 ` Wei Yang
2015-06-07 8:33 ` [tip:x86/boot] x86/boot/setup: Clean up the e820_reserve_setup_data() code tip-bot for Wei Yang
1 sibling, 1 reply; 5+ messages in thread
From: Wei Yang @ 2015-06-04 6:18 UTC (permalink / raw)
To: yinghai; +Cc: x86, linux-kernel, Wei Yang
pa_data and found are highly related, so there is no need to set a found
flag.
This patch removes the found and just return when pa_data is NULL.
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
---
arch/x86/kernel/setup.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index d74ac33..c3992c3 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -461,19 +461,18 @@ static void __init e820_reserve_setup_data(void)
{
struct setup_data *data;
u64 pa_data;
- int found = 0;
pa_data = boot_params.hdr.setup_data;
+ if (!pa_data)
+ return;
+
while (pa_data) {
data = early_memremap(pa_data, sizeof(*data));
e820_update_range(pa_data, sizeof(*data)+data->len,
E820_RAM, E820_RESERVED_KERN);
- found = 1;
pa_data = data->next;
early_memunmap(data, sizeof(*data));
}
- if (!found)
- return;
sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
memcpy(&e820_saved, &e820, sizeof(struct e820map));
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] x86, setup: code clean of e820_reserve_setup_data()
2015-06-04 5:42 ` Ingo Molnar
@ 2015-06-04 7:07 ` Wei Yang
0 siblings, 0 replies; 5+ messages in thread
From: Wei Yang @ 2015-06-04 7:07 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Wei Yang, yinghai, x86, linux-kernel
On Thu, Jun 04, 2015 at 07:42:38AM +0200, Ingo Molnar wrote:
>
>* Wei Yang <weiyang@linux.vnet.ibm.com> wrote:
>
>> pa_data and found are highly related, so there is no need to set a found
>> flag.
>>
>> This patch removes the found and just return when pa_data is NULL.
>>
>> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
>> ---
>> arch/x86/kernel/setup.c | 7 +++----
>> 1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
>> index 0a2421c..b95e653 100644
>> --- a/arch/x86/kernel/setup.c
>> +++ b/arch/x86/kernel/setup.c
>> @@ -461,19 +461,18 @@ static void __init e820_reserve_setup_data(void)
>> {
>> struct setup_data *data;
>> u64 pa_data;
>> - int found = 0;
>>
>> pa_data = boot_params.hdr.setup_data;
>> + if (!pa_data)
>> + return;
>> +
>> while (pa_data) {
>> data = early_memremap(pa_data, sizeof(*data));
>> e820_update_range(pa_data, sizeof(*data)+data->len,
>> E820_RAM, E820_RESERVED_KERN);
>> - found = 1;
>> pa_data = data->next;
>> early_iounmap(data, sizeof(*data));
>> }
>> - if (!found)
>> - return;
>>
>> sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
>> memcpy(&e820_saved, &e820, sizeof(struct e820map));
>
>This patch does not apply to Linus's latest tree.
Thanks Ingo.
Rebased on top of v4.1-rc6.
>
>Thanks,
>
> Ingo
--
Richard Yang
Help you, Help me
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip:x86/boot] x86/boot/setup: Clean up the e820_reserve_setup_data() code
2015-06-04 6:18 ` Wei Yang
@ 2015-06-07 8:33 ` tip-bot for Wei Yang
0 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Wei Yang @ 2015-06-07 8:33 UTC (permalink / raw)
To: linux-tip-commits
Cc: yinghai, weiyang, peterz, mingo, torvalds, akpm, bp,
linux-kernel, tglx, hpa
Commit-ID: f2af7d25b4aa5b01203cc76e7530ea7fd18864a0
Gitweb: http://git.kernel.org/tip/f2af7d25b4aa5b01203cc76e7530ea7fd18864a0
Author: Wei Yang <weiyang@linux.vnet.ibm.com>
AuthorDate: Thu, 4 Jun 2015 14:18:49 +0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 5 Jun 2015 13:53:22 +0200
x86/boot/setup: Clean up the e820_reserve_setup_data() code
Deobfuscate the 'found' logic, it can be replaced with a simple:
if (!pa_data)
return;
and 'found' can be eliminated.
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1433398729-8314-1-git-send-email-weiyang@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/setup.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index d74ac33..c3992c3 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -461,19 +461,18 @@ static void __init e820_reserve_setup_data(void)
{
struct setup_data *data;
u64 pa_data;
- int found = 0;
pa_data = boot_params.hdr.setup_data;
+ if (!pa_data)
+ return;
+
while (pa_data) {
data = early_memremap(pa_data, sizeof(*data));
e820_update_range(pa_data, sizeof(*data)+data->len,
E820_RAM, E820_RESERVED_KERN);
- found = 1;
pa_data = data->next;
early_memunmap(data, sizeof(*data));
}
- if (!found)
- return;
sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
memcpy(&e820_saved, &e820, sizeof(struct e820map));
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-06-07 8:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-04 2:18 [PATCH] x86, setup: code clean of e820_reserve_setup_data() Wei Yang
2015-06-04 5:42 ` Ingo Molnar
2015-06-04 7:07 ` Wei Yang
2015-06-04 6:18 ` Wei Yang
2015-06-07 8:33 ` [tip:x86/boot] x86/boot/setup: Clean up the e820_reserve_setup_data() code tip-bot for Wei Yang
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).