Re: [PATCH 4/4] ACPI: NHLT: Add query functions

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

 



On Tue, Jul 18, 2023 at 01:11:03PM +0200, Cezary Rojewski wrote:
> On 2023-07-17 11:47 AM, Andy Shevchenko wrote:
> > On Mon, Jul 17, 2023 at 10:29:17AM +0200, Cezary Rojewski wrote:

...

> > I prefer to get rid of those.
> 
> Decided to do some manual tests on more exotic setups that are not part of
> our daily CI/CD routine and, completely getting rid of those ifs causes
> problems. Those setups are part of the market, expose DSP capabilities but
> have invalid BIOS configurations.
> 
> Rather than just bringing back the if-statement, different solution came to
> my mind:
> 
> static struct acpi_table_nhlt empty_nhlt = {
> 	.header = {
> 		.signature = ACPI_SIG_NHLT,
> 	},
> };
> 
> struct acpi_table_nhlt *acpi_gbl_NHLT;
> EXPORT_SYMBOL_GPL(acpi_gbl_NHLT);
> 
> acpi_status acpi_nhlt_get_gbl_table(void)
> {
> 	acpi_status status;
> 
> 	status = acpi_get_table(ACPI_SIG_NHLT, 0, (struct acpi_table_header
> **)(&acpi_gbl_NHLT));
> 	if (!acpi_gbl_NHLT)
> 		acpi_gbl_NHLT = &empty_nhlt;
> 	return status;
> }
> EXPORT_SYMBOL_GPL(acpi_nhlt_get_gbl_table);
> 
> What do you think?

I think it's wonderful what you found and I dunno how I missed this.
Go for this, definitely!

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux