diff --git a/arch/x86/boot/edd.c b/arch/x86/boot/edd.c index 1fb4bc70cee9..9956c611574b 100644 --- a/arch/x86/boot/edd.c +++ b/arch/x86/boot/edd.c @@ -15,7 +15,7 @@ #include #include "string.h" -#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) +#if IS_ENABLED(CONFIG_EDD) /* * Read the MBR (first sector) from a specific device. @@ -120,26 +120,22 @@ static int get_edd_info(u8 devno, struct edd_info *ei) void query_edd(void) { char eddarg[8]; - int do_mbr = 1; -#ifdef CONFIG_EDD_OFF - int do_edd = 0; -#else - int do_edd = 1; -#endif - int be_quiet; + bool do_mbr = true; + bool do_edd = !IS_ENABLED(CONFIG_EDD_OFF); + bool be_quiet; int devno; struct edd_info ei, *edp; u32 *mbrptr; if (cmdline_find_option("edd", eddarg, sizeof(eddarg)) > 0) { if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) { - do_edd = 1; - do_mbr = 0; + do_edd = true; + do_mbr = false; } else if (!strcmp(eddarg, "off")) - do_edd = 0; + do_edd = false; else if (!strcmp(eddarg, "on")) - do_edd = 1; + do_edd = true; } be_quiet = cmdline_find_option_bool("quiet"); diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c index 9d0fea18d3c8..4e382d95ef9a 100644 --- a/arch/x86/boot/main.c +++ b/arch/x86/boot/main.c @@ -164,14 +164,12 @@ void main(void) query_ist(); /* Query APM information */ -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) - query_apm_bios(); -#endif + if (IS_ENABLED(CONFIG_APM)) + query_apm_bios(); /* Query EDD information */ -#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) - query_edd(); -#endif + if (IS_ENABLED(CONFIG_EDD)) + query_edd(); /* Set the video mode */ set_video(); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 46882ce79c3a..fca42b178b3c 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -120,8 +120,7 @@ struct cpuinfo_x86 new_cpu_data; struct apm_info apm_info; EXPORT_SYMBOL(apm_info); -#if defined(CONFIG_X86_SPEEDSTEP_SMI) || \ - defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE) +#if IS_ENABLED(CONFIG_X86_SPEEDSTEP_SMI) struct ist_info ist_info; EXPORT_SYMBOL(ist_info); #else @@ -230,7 +229,7 @@ char builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; bool builtin_cmdline_added __ro_after_init; #endif -#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) +#if IS_ENABLED(CONFIG_EDD) struct edd edd; #ifdef CONFIG_EDD_MODULE EXPORT_SYMBOL(edd); diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c index 655139dd0532..45836aca1a4b 100644 --- a/arch/x86/purgatory/purgatory.c +++ b/arch/x86/purgatory/purgatory.c @@ -21,7 +21,7 @@ u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE] __section(".kexec-purgatory"); struct kexec_sha_region purgatory_sha_regions[KEXEC_SEGMENT_MAX] __section(".kexec-purgatory"); -static int verify_sha256_digest(void) +static bool verify_sha256_digest(void) { struct kexec_sha_region *ptr, *end; u8 digest[SHA256_DIGEST_SIZE]; @@ -31,22 +31,16 @@ static int verify_sha256_digest(void) end = purgatory_sha_regions + ARRAY_SIZE(purgatory_sha_regions); for (ptr = purgatory_sha_regions; ptr < end; ptr++) - sha256_update(&sctx, (uint8_t *)(ptr->start), ptr->len); + sha256_update(&sctx, (const u8 *)(ptr->start), ptr->len); sha256_final(&sctx, digest); - if (memcmp(digest, purgatory_sha256_digest, sizeof(digest))) - return 1; - - return 0; + return !memcmp(digest, purgatory_sha256_digest, sizeof(digest)); } void purgatory(void) { - int ret; - - ret = verify_sha256_digest(); - if (ret) { + if (!verify_sha256_digest()) { /* loop forever */ for (;;) ;