Skip to contentSkip to conversation

Note about acpi_get_table_header

DISCUSSION Jean Delvare 3 participants 3 messages Feb 4, 2020 ACPI

lore
Share & tools
lore
#0 lore raw

Hello,

The description block before acpi_get_table_header() in drivers/acpi/acpica/tbxface.c includes the following comment:

* NOTE: Caller is responsible in unmapping the header with
* acpi_os_unmap_memory

However, looking at the code, it seems that we are already calling acpi_os_unmap_memory() internally as appropriate, and we always return a copy of the header, not a pointer to it. So I see no reason why the caller would ever need to call acpi_os_unmap_memory(). As a matter of fact the only current caller of this function does NOT call acpi_os_unmap_memory() afterwards.

So I believe this note is wrong and should be removed?

Thanks,

Signature · 2 lines
Jean Delvare
SUSE L3 Support
#1 lore raw
Quoted 7 lines · Jean Delvare

Hello,

The description block before acpi_get_table_header() in drivers/acpi/acpica/tbxface.c includes the following comment:

* NOTE: Caller is responsible in unmapping the header with
* acpi_os_unmap_memory

I'm confused as well when I was reading the code.

Quoted 9 lines

However, looking at the code, it seems that we are already calling acpi_os_unmap_memory() internally as appropriate, and we always return a copy of the header, not a pointer to it. So I see no reason why the caller would ever need to call acpi_os_unmap_memory(). As a matter of fact the only current caller of this function does NOT call acpi_os_unmap_memory() afterwards.

So I believe this note is wrong and should be removed?

I think so.

Thanks
Hanjun

#2 lore raw

-----Original Message-----
From: Hanjun Guo <[email protected]>
Sent: Tuesday, February 04, 2020 2:05 AM
To: Jean Delvare <[email protected]>; [email protected]
Cc: Moore, Robert <[email protected]>; Kaneda, Erik <[email protected]>; Wysocki, Rafael J <[email protected]>
Subject: Re: Note about acpi_get_table_header

Quoted 7 lines · Jean Delvare

Hello,

The description block before acpi_get_table_header() in drivers/acpi/acpica/tbxface.c includes the following comment:

* NOTE: Caller is responsible in unmapping the header with
* acpi_os_unmap_memory

I'm confused as well when I was reading the code.

Quoted 9 lines

However, looking at the code, it seems that we are already calling acpi_os_unmap_memory() internally as appropriate, and we always return a copy of the header, not a pointer to it. So I see no reason why the caller would ever need to call acpi_os_unmap_memory(). As a matter of fact the only current caller of this function does NOT call acpi_os_unmap_memory() afterwards.

So I believe this note is wrong and should be removed?

Yes, the note is obsolete. I'll remove it.

Bob

I think so.

Thanks
Hanjun