From e9144601d364d5b81f3e63949337f8507eb58dca Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 10 Aug 2010 20:26:35 -0300 Subject: [PATCH] i7core_edac: move #if PAGE_SHIFT to edac_core.h Signed-off-by: Mauro Carvalho Chehab --- drivers/edac/edac_core.h | 2 ++ drivers/edac/i7core_edac.c | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h index 69eb1c268f9f..d7ca43a828bd 100644 --- a/drivers/edac/edac_core.h +++ b/drivers/edac/edac_core.h @@ -42,8 +42,10 @@ #if PAGE_SHIFT < 20 #define PAGES_TO_MiB( pages ) ( ( pages ) >> ( 20 - PAGE_SHIFT ) ) +#define MiB_TO_PAGES(mb) ((mb) >> (20 - PAGE_SHIFT)) #else /* PAGE_SHIFT > 20 */ #define PAGES_TO_MiB( pages ) ( ( pages ) << ( PAGE_SHIFT - 20 ) ) +#define MiB_TO_PAGES(mb) ((mb) >> (PAGE_SHIFT - 20)) #endif #define edac_printk(level, prefix, fmt, arg...) \ diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index 5d15daaec8b8..36b4e1422838 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c @@ -666,11 +666,7 @@ static int get_dimm_config(const struct mem_ctl_info *mci, int *csrow) RANKOFFSET(dimm_dod[j]), banks, ranks, rows, cols); -#if PAGE_SHIFT > 20 - npages = size >> (PAGE_SHIFT - 20); -#else - npages = size << (20 - PAGE_SHIFT); -#endif + npages = MiB_TO_PAGES(size); csr = &mci->csrows[*csrow]; csr->first_page = last_page + 1; -- 2.39.5