Re: [RFC PATCH v1 31/57] edac: Remove PAGE_SIZE compile-time constant assumption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



+ Borislav Petkov, Tony Luck

This was a rather tricky series to get the recipients correct for and my script
did not realize that "supporter" was a pseudonym for "maintainer" so you were
missed off the original post. Appologies!

More context in cover letter:
https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@xxxxxxx/


On 14/10/2024 11:58, Ryan Roberts wrote:
> To prepare for supporting boot-time page size selection, refactor code
> to remove assumptions about PAGE_SIZE being compile-time constant. Code
> intended to be equivalent when compile-time page size is active.
> 
> Convert PAGES_TO_MiB() and MiB_TO_PAGES() to use the ternary operator so
> that they continue to work with boot-time page size; Boot-time page size
> can't be used with CPP because it's value is not known at compile time.
> For compile-time page size builds, the compiler will dead code strip for
> the same result.
> 
> Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx>
> ---
> 
> ***NOTE***
> Any confused maintainers may want to read the cover note here for context:
> https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@xxxxxxx/
> 
>  drivers/edac/edac_mc.h | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h
> index 881b00eadf7a5..22132ee86e953 100644
> --- a/drivers/edac/edac_mc.h
> +++ b/drivers/edac/edac_mc.h
> @@ -37,13 +37,12 @@
>  #include <linux/workqueue.h>
>  #include <linux/edac.h>
>  
> -#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 PAGES_TO_MiB(pages)	(PAGE_SHIFT < 20 ?			\
> +					((pages) >> (20 - PAGE_SHIFT)) :\
> +					((pages) << (PAGE_SHIFT - 20)))
> +#define MiB_TO_PAGES(mb)	(PAGE_SHIFT < 20 ?			\
> +					((mb) << (20 - PAGE_SHIFT)) :	\
> +					((mb) >> (PAGE_SHIFT - 20)))
>  
>  #define edac_printk(level, prefix, fmt, arg...) \
>  	printk(level "EDAC " prefix ": " fmt, ##arg)





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux