public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: <linux-acpi@vger.kernel.org>, <robert.moore@intel.com>,
	<pierre-louis.bossart@linux.intel.com>,
	<amadeuszx.slawinski@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH v2 2/4] ACPI: NHLT: Introduce acpi_gbl_NHLT
Date: Fri, 21 Jul 2023 11:49:17 +0200	[thread overview]
Message-ID: <df2bd70b-c480-27fe-5806-8d96b0713358@intel.com> (raw)
In-Reply-To: <CAJZ5v0goKBLxQO6hJq8Gpj-JEb9D1YuXHWyzwyr9YV4iEBteig@mail.gmail.com>

On 2023-07-20 7:05 PM, Rafael J. Wysocki wrote:
> On Thu, Jul 20, 2023 at 7:01 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>>
>> On Thu, Jul 20, 2023 at 11:15 AM Cezary Rojewski
>> <cezary.rojewski@intel.com> wrote:

...

>>>>> This approach generates a problem with undefined symbol "acpi_gbl_NHLT" when
>>>>> ACPI_NHLT is disabled. As nhlt.c is not built when said kconfig is disabled,
>>>>> symbol is never defined.
>>>>>
>>>>> Proposed solution - modify drivers/acpi/tables.c with:
>>>>>
>>>>> +#include <acpi/nhlt.h>
>>>>> +
>>>>> +struct acpi_table_nhlt *acpi_gbl_NHLT;
> 
> No capitals in variable names, please.

acpi_gbl_NHLT follows the path set by acpi_gbl_DSDT, _FADT and others. 
Why would NHLT be an exception? Is this because it's not defined under 
ACPICA?

Uncapitalizing nonetheless in v3.

>>>>> +EXPORT_SYMBOL_GPL(acpi_gbl_NHLT);
>>>>>
>>>>> as tables.c is always built the symbol is always there.
>>>>> The only other option I see is:
>>>>>
>>>>> -obj-$(CONFIG_ACPI_NHLT)     += nhlt.o
>>>>> +obj-y                               += nhlt.o
>>>>>
>>>>> and modifying nhlt.c so it's essentially split in half with:
>>>>> #if IS_ENABLED(CONFIG_ACPI_NHLT)
>>>>>
>>>>> but such solutions stinks. I prefer the first approach.
>>>>> What to you find guys?
>>>>
>>>> I leave this to Rafael as it's his territory.
>>>
>>> Rafael, which option do you prefer?
>>>
>>> Regardless of IKP and my CI returning success on compilation tests,
>>> clearly there is a problem when CONFIG_ACPI_NHLT.
>>
>> Putting the definition of acpi_gbl_NHLT into tables.c would be fine
>> with me, but in any case, because it is an exported symbol, it needs a
>> description in a kerneldoc comment.
> 
> That said, you can also do something like this in a header file:
> 
> #ifdef CONFIG_ACPI_NHLT
> extern struct acpi_table_nhlt *acpi_gbl_nhlt;
> #else
> #define acpi_gbl_nhlt    NULL
> #endif
> 
> and require the acpi_gbl_nhlt users to include it.

Simplest solutions usually work the best. Surprised I haven't thought 
about it earlier!

  reply	other threads:[~2023-07-21  9:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 15:00 [PATCH v2 0/4] ACPI: NHLT: Access and query helpers Cezary Rojewski
2023-07-17 15:00 ` [PATCH v2 1/4] ACPI: NHLT: Device configuration access interface Cezary Rojewski
2023-07-17 15:00 ` [PATCH v2 2/4] ACPI: NHLT: Introduce acpi_gbl_NHLT Cezary Rojewski
2023-07-19 14:47   ` Cezary Rojewski
2023-07-19 15:36     ` Andy Shevchenko
2023-07-20  9:15       ` Cezary Rojewski
2023-07-20 17:01         ` Rafael J. Wysocki
2023-07-20 17:05           ` Rafael J. Wysocki
2023-07-21  9:49             ` Cezary Rojewski [this message]
2023-07-21  9:51               ` Rafael J. Wysocki
2023-07-17 15:00 ` [PATCH v2 3/4] ACPI: NHLT: Table manipulation helpers Cezary Rojewski
2023-07-17 15:00 ` [PATCH v2 4/4] ACPI: NHLT: Add query functions Cezary Rojewski
2023-07-17 15:13   ` Andy Shevchenko
2023-07-19 14:56 ` [PATCH v2 0/4] ACPI: NHLT: Access and query helpers Cezary Rojewski
2023-07-19 15:59   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df2bd70b-c480-27fe-5806-8d96b0713358@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rafael@kernel.org \
    --cc=robert.moore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox