Re: [PATCH v9 26/43] x86/compressed/acpi: Move EFI config table lookup to helper

From: Borislav Petkov
Date: Thu Feb 03 2022 - 10:13:46 EST


On Fri, Jan 28, 2022 at 11:17:47AM -0600, Brijesh Singh wrote:
> +int efi_get_conf_table(struct boot_params *boot_params, unsigned long *cfg_tbl_pa,
> + unsigned int *cfg_tbl_len)
> +{
> + unsigned long sys_tbl_pa = 0;
> + enum efi_type et;
> + int ret;
> +
> + if (!cfg_tbl_pa || !cfg_tbl_len)
> + return -EINVAL;
> +
> + sys_tbl_pa = efi_get_system_table(boot_params);
> + if (!sys_tbl_pa)
> + return -EINVAL;
> +
> + /* Handle EFI bitness properly */
> + et = efi_get_type(boot_params);
> + if (et == EFI_TYPE_64) {
> + efi_system_table_64_t *stbl =
> + (efi_system_table_64_t *)sys_tbl_pa;
> +
> + *cfg_tbl_pa = stbl->tables;
> + *cfg_tbl_len = stbl->nr_tables;
> + } else if (et == EFI_TYPE_32) {
> + efi_system_table_32_t *stbl =
> + (efi_system_table_32_t *)sys_tbl_pa;

You don't have to break those assignment lines - the 80 cols rule is not
a hard one. Readability is more important.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette