From: Zhang Yanfei <zhangyanfei.yes@gmail.com>
To: Simon Horman <horms@verge.net.au>
Cc: "kexec@lists.infradead.org" <kexec@lists.infradead.org>
Subject: [PATCH 07/13] kexec: ia64: use _ALIGN* to make the logic clear
Date: Thu, 14 Mar 2013 01:30:27 +0800 [thread overview]
Message-ID: <5140B7B3.2010300@gmail.com> (raw)
In-Reply-To: <5140B511.7020109@gmail.com>
From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
By replacing all the explicit align opertion with marco _ALIGN*,
the code logic could be simplified.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
kexec/arch/ia64/crashdump-ia64.c | 6 +++---
kexec/arch/ia64/kexec-elf-ia64.c | 2 +-
kexec/arch/ia64/kexec-ia64.c | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/kexec/arch/ia64/crashdump-ia64.c b/kexec/arch/ia64/crashdump-ia64.c
index 782f49e..726c9f4 100644
--- a/kexec/arch/ia64/crashdump-ia64.c
+++ b/kexec/arch/ia64/crashdump-ia64.c
@@ -83,7 +83,7 @@ static void add_loaded_segments_info(struct mem_ehdr *ehdr)
}
loaded_segments[loaded_segments_num].start =
- phdr->p_paddr & ~(ELF_PAGE_SIZE-1);
+ _ALIGN_DOWN(phdr->p_paddr, ELF_PAGE_SIZE);
loaded_segments[loaded_segments_num].end =
loaded_segments[loaded_segments_num].start;
@@ -97,8 +97,8 @@ static void add_loaded_segments_info(struct mem_ehdr *ehdr)
if (phdr->p_type != PT_LOAD)
break;
loaded_segments[loaded_segments_num].end =
- (phdr->p_paddr + phdr->p_memsz +
- ELF_PAGE_SIZE - 1) & ~(ELF_PAGE_SIZE - 1);
+ _ALIGN(phdr->p_paddr + phdr->p_memsz,
+ ELF_PAGE_SIZE);
i++;
}
loaded_segments_num++;
diff --git a/kexec/arch/ia64/kexec-elf-ia64.c b/kexec/arch/ia64/kexec-elf-ia64.c
index 8da061e..7303c03 100644
--- a/kexec/arch/ia64/kexec-elf-ia64.c
+++ b/kexec/arch/ia64/kexec-elf-ia64.c
@@ -264,7 +264,7 @@ int elf_ia64_load(int argc, char **argv, const char *buf, off_t len,
strcat(cmdline, buf);
}
- command_line_len = (command_line_len + 15)&(~15);
+ command_line_len = _ALIGN(command_line_len, 16);
command_line_base = add_buffer(info, cmdline,
command_line_len, command_line_len,
getpagesize(), 0UL,
diff --git a/kexec/arch/ia64/kexec-ia64.c b/kexec/arch/ia64/kexec-ia64.c
index aa510a9..418d997 100644
--- a/kexec/arch/ia64/kexec-ia64.c
+++ b/kexec/arch/ia64/kexec-ia64.c
@@ -50,8 +50,8 @@ static int split_range(int range, unsigned long start, unsigned long end)
unsigned int type = memory_range[range - 1].type;
int i;
//align end and start to page size of EFI
- start = start & ~((1UL<<12) - 1);
- end = (end + (1UL<<12) - 1)& ~((1UL<<12) - 1);
+ start = _ALIGN_DOWN(start, 1UL<<12);
+ end = _ALIGN(end, 1UL<<12);
for (i = 0; i < range; i++)
if(memory_range[i].start <= start && memory_range[i].end >=end)
break;
@@ -230,7 +230,7 @@ int update_loaded_segments(struct mem_ehdr *ehdr)
for (i = 0; i < memory_ranges; i++) {
if (memory_range[i].type != RANGE_RAM)
continue;
- start = (memory_range[i].start + align - 1) & ~(align - 1);
+ start = _ALIGN(memory_range[i].start, align);
end = memory_range[i].end;
if (end > start && (end - start) > (end_addr - start_addr)) {
move_loaded_segments(ehdr, start);
--
1.7.1
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2013-03-13 17:30 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-13 17:19 [PATCH 01/13] kexec: add _ALIGN* marcos for align operation Zhang Yanfei
2013-03-13 17:21 ` [PATCH 02/13] kexec: use _ALIGN() instead of align() Zhang Yanfei
2013-03-14 9:48 ` Simon Horman
2013-03-13 17:23 ` [PATCH 03/13] kexec: ppc: remove duplicated _ALIGN_* macros Zhang Yanfei
2013-03-14 9:48 ` Simon Horman
2013-03-13 17:26 ` [PATCH 04/13] kexec: use _ALIGN* to make the logic clear Zhang Yanfei
2013-03-14 9:08 ` Simon Horman
2013-03-14 9:48 ` Zhang Yanfei
2013-03-14 10:06 ` Simon Horman
2013-03-14 9:49 ` Simon Horman
2013-03-14 9:58 ` Simon Horman
2013-03-14 11:24 ` [PATCH v2 " Zhang Yanfei
2013-03-14 11:26 ` [PATCH " Zhang Yanfei
2013-03-15 8:35 ` Simon Horman
2013-03-15 9:46 ` [PATCH v3 " Zhang Yanfei
2013-03-15 15:52 ` Simon Horman
2013-03-13 17:28 ` [PATCH 05/13] kexec: i386: " Zhang Yanfei
2013-03-14 9:50 ` Simon Horman
2013-03-13 17:29 ` [PATCH 06/13] kexec: arm: " Zhang Yanfei
2013-03-14 9:50 ` Simon Horman
2013-03-13 17:30 ` Zhang Yanfei [this message]
2013-03-14 9:50 ` [PATCH 07/13] kexec: ia64: " Simon Horman
2013-03-13 17:31 ` [PATCH 08/13] kexec: mips: " Zhang Yanfei
2013-03-14 9:51 ` Simon Horman
2013-03-13 17:32 ` [PATCH 09/13] kexec: ppc: " Zhang Yanfei
2013-03-14 9:09 ` Simon Horman
2013-03-14 9:32 ` Zhang Yanfei
2013-03-14 9:33 ` [PATCH v2 " Zhang Yanfei
2013-03-14 9:54 ` Simon Horman
2013-03-14 9:57 ` Simon Horman
2013-03-14 10:01 ` Simon Horman
2013-03-13 17:33 ` [PATCH 10/13] kexec: ppc64: " Zhang Yanfei
2013-03-14 9:23 ` Simon Horman
2013-03-14 9:38 ` [PATCH v2 " Zhang Yanfei
2013-03-14 10:04 ` Simon Horman
2013-03-13 17:33 ` [PATCH 11/13] kexec: s390: remove ALIGN_UP and use _ALIGN_UP Zhang Yanfei
2013-03-14 10:02 ` Simon Horman
2013-03-13 17:34 ` [PATCH 12/13] kexec: sh: use _ALIGN* to make the logic clear Zhang Yanfei
2013-03-14 10:03 ` Simon Horman
2013-03-13 17:35 ` [PATCH 13/13] kexec: x86_64: " Zhang Yanfei
2013-03-14 10:03 ` Simon Horman
2013-03-14 9:47 ` [PATCH 01/13] kexec: add _ALIGN* marcos for align operation Simon Horman
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=5140B7B3.2010300@gmail.com \
--to=zhangyanfei.yes@gmail.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
/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 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.