[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e217c4dc-dd66-4db0-a846-ca8ed462135e@arm.com>
Date: Tue, 18 Nov 2025 11:07:33 +0000
From: Ben Horgan <ben.horgan@....com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: james.morse@....com, amitsinght@...vell.com, baisheng.gao@...soc.com,
baolin.wang@...ux.alibaba.com, bobo.shaobowang@...wei.com,
carl@...amperecomputing.com, catalin.marinas@....com, dakr@...nel.org,
dave.martin@....com, david@...hat.com, dfustini@...libre.com,
fenghuay@...dia.com, gregkh@...uxfoundation.org, gshan@...hat.com,
guohanjun@...wei.com, jeremy.linton@....com, jonathan.cameron@...wei.com,
kobak@...dia.com, lcherian@...vell.com, lenb@...nel.org,
linux-acpi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, lpieralisi@...nel.org, peternewman@...gle.com,
quic_jiles@...cinc.com, robh@...nel.org, rohit.mathew@....com,
scott@...amperecomputing.com, sdonthineni@...dia.com, sudeep.holla@....com,
tan.shaopeng@...itsu.com, will@...nel.org, xhao@...ux.alibaba.com,
Shaopeng Tan <tan.shaopeng@...fujitsu.com>, Zeng Heng <zengheng4@...wei.com>
Subject: Re: [PATCH v5 08/34] ACPI: Define acpi_put_table cleanup handler and
acpi_get_table_ret() helper
Hi Rafael,
On 11/17/25 19:46, Rafael J. Wysocki wrote:
> On Mon, Nov 17, 2025 at 6:01 PM Ben Horgan <ben.horgan@....com> wrote:
>>
>> Define a cleanup helper for use with __free to release the acpi table when
>> the pointer goes out of scope. Also, introduce the helper
>> acpi_get_table_ret() to simplify a commonly used pattern involving
>> acpi_get_table().
>>
>> These are first used in a subsequent commit.
>>
>> Reviewed-by: Gavin Shan <gshan@...hat.com>
>> Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
>> Reviewed-by: Shaopeng Tan <tan.shaopeng@...fujitsu.com>
>> Reviewed-by: Fenghua Yu <fenghuay@...dia.com>
>> Tested-by: Fenghua Yu <fenghuay@...dia.com>
>> Tested-by: Carl Worth <carl@...amperecomputing.com>
>> Tested-by: Gavin Shan <gshan@...hat.com>
>> Tested-by: Zeng Heng <zengheng4@...wei.com>
>> Tested-by: Shaopeng Tan <tan.shaopeng@...fujitsu.com>
>> Signed-off-by: Ben Horgan <ben.horgan@....com>
>> ---
>> include/linux/acpi.h | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
>> index a9dbacabdf89..1124b7dc79fd 100644
>> --- a/include/linux/acpi.h
>> +++ b/include/linux/acpi.h
>> @@ -8,6 +8,7 @@
>> #ifndef _LINUX_ACPI_H
>> #define _LINUX_ACPI_H
>>
>> +#include <linux/cleanup.h>
>> #include <linux/errno.h>
>> #include <linux/ioport.h> /* for struct resource */
>> #include <linux/resource_ext.h>
>> @@ -221,6 +222,17 @@ void acpi_reserve_initial_tables (void);
>> void acpi_table_init_complete (void);
>> int acpi_table_init (void);
>>
>> +static inline struct acpi_table_header *acpi_get_table_ret(char *signature, u32 instance)
>
> Maybe call this acpi_get_table_pointer() ?
Ok, can do.
>
>> +{
>> + struct acpi_table_header *table;
>> + int status = acpi_get_table(signature, instance, &table);
>> +
>> + if (ACPI_FAILURE(status))
>> + return ERR_PTR(-ENOENT);
>> + return table;
>> +}
>> +DEFINE_FREE(acpi_put_table, struct acpi_table_header *, if (!IS_ERR_OR_NULL(_T)) acpi_put_table(_T))
>> +
>> int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
>> int __init_or_acpilib acpi_table_parse_entries(char *id,
>> unsigned long table_size, int entry_id,
>> --
Thanks,
Ben
Powered by blists - more mailing lists