-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constify AcpiGetHandle pathname argument #773
Conversation
AcpiGetHandle doesn't write to the pathname argument, therefore make it const. This allows later on passing pathname to AcpiGetHandle which is const, without creating a copy of it. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
I'm worried that there are lots of these sprinkled throughout ACPICA - and this fix could open the door to lots of changes. |
Hi Robert,
On Thu, Aug 18, 2022 at 09:15:14AM -0700, Robert Moore wrote:
I'm worried that there are lots of these sprinkled throughout ACPICA - and
this fix could open the door to lots of changes.
Could you elaborate your concern a little? Is it that there are other
functions that do not write to the data behind a pointer taken as an
argument which could be const but is not, or something else? Const is being
used in acpica already, albeit perhaps not everywhere it could be.
The alternatives for this change are making the large data structure (a
single memory allocation) not const or allocating a temporary buffer for
the path name, checking the allocation succeeded and finally copying the
const pathname there before calling the function.
Both are poor workarounds compared to fixing the root issue.
…--
Regards,
Sakari Ailus
|
Ping.
|
Do you think that people will try to annotate pathname pointers all over with const? Or something else? |
From: Rafael J. Wysocki ***@***.***>
Sent: Thursday, October 13, 2022 10:16 AM
To: acpica/acpica ***@***.***>
Cc: Moore, Robert ***@***.***>; Comment ***@***.***>
Subject: Re: [acpica/acpica] Constify AcpiGetHandle pathname argument (PR #773)
I'm worried that there are lots of these sprinkled throughout ACPICA - and this fix could open the door to lots of changes.
Do you think that people will try to annotate pathname pointers all over with const? Or something else?
Yes, that might be the case. However, I was thinking about other external interfaces to ACPICA that have similar pointers.
—
Reply to this email directly, view it on GitHub<#773 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAHL7LDOZWXOOCAOU26FDLDWDA7WHANCNFSM5VHZSQVA>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
|
I don't see a problem with AcpiGetHandle() in particular TBH and the other cases can be considered individually IMO. |
acpi_get_handle() uses the pathname argument to find a handle related to that pathname but it does not need to modify it. Make it const, in order to be able to pass const pathname to it. Cc: "Moore, Robert" <robert.moore@intel.com> Link: acpica/acpica#773 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Hello,
This pull request contains a single patch, constifying the pathname argument to AcpiGetHandle. The objective is to allow passing a const pathname to the function, in order to avoid having to make a copy of it. This isn't needed by acpica per se, but by another caller in Linux.
It's the first time I'm using Github to do this, let's see how this works...