diff mbox

[1/3] ACPI: move ACPI_SYSTEM_HID to acpi_drivers.h

Message ID 1458157022-18633-2-git-send-email-pprakash@codeaurora.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Prakash, Prashanth March 16, 2016, 7:37 p.m. UTC
From: "Jonathan (Zhixiong) Zhang" <zjzhang@codeaurora.org>

ACPI_SYSTEM_HID is defined in drivers/acpi/bus.c out-of-band.

Move the definition to include/acpi/acpi_drivers.h, together
with other Linux specific HIDs, so that it can be used by other
code.

Signed-off-by: Jonathan (Zhixiong) Zhang <zjzhang@codeaurora.org>
---
 drivers/acpi/scan.c         | 3 ++-
 include/acpi/acpi_drivers.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Rafael J. Wysocki March 17, 2016, 1:50 a.m. UTC | #1
On Wed, Mar 16, 2016 at 8:37 PM, Prashanth Prakash
<pprakash@codeaurora.org> wrote:
> From: "Jonathan (Zhixiong) Zhang" <zjzhang@codeaurora.org>
>
> ACPI_SYSTEM_HID is defined in drivers/acpi/bus.c out-of-band.
>
> Move the definition to include/acpi/acpi_drivers.h, together
> with other Linux specific HIDs, so that it can be used by other
> code.
>
> Signed-off-by: Jonathan (Zhixiong) Zhang <zjzhang@codeaurora.org>
> ---
>  drivers/acpi/scan.c         | 3 ++-
>  include/acpi/acpi_drivers.h | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 407a376..358e3c8 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -13,6 +13,8 @@
>  #include <linux/nls.h>
>  #include <linux/dma-mapping.h>
>
> +#include <acpi/acpi_drivers.h>
> +
>  #include <asm/pgtable.h>
>
>  #include "internal.h"
> @@ -22,7 +24,6 @@ ACPI_MODULE_NAME("scan");
>  extern struct acpi_device *acpi_root;
>
>  #define ACPI_BUS_CLASS                 "system_bus"
> -#define ACPI_BUS_HID                   "LNXSYBUS"

No.

This is not a valid device ID and should never be used as such.

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Prakash, Prashanth March 17, 2016, 4:53 p.m. UTC | #2
Hi Rafael,

On 3/16/2016 7:50 PM, Rafael J. Wysocki wrote:
>  #include "internal.h"
> @@ -22,7 +24,6 @@ ACPI_MODULE_NAME("scan");
>  extern struct acpi_device *acpi_root;
>
>  #define ACPI_BUS_CLASS                 "system_bus"
> -#define ACPI_BUS_HID                   "LNXSYBUS"
> No.
>
> This is not a valid device ID and should never be used as such.
Section 5.6.6 in ACPI 6.1 is defining the notification value for the graceful
shutdown request as a ACPI device specific value(0x81) and it is targeting
the system bus(\_SB), so we took the current approach of creating a sybus
driver to handle the notifications targeting the system bus.

Let me go through the code again and see if we can avoid using the
ACPI_BUS_HID. In the meantime, if you have any specific thoughts on
how this should be handled, please let us know.

Thanks,
Prashanth

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki March 17, 2016, 9:54 p.m. UTC | #3
On Thu, Mar 17, 2016 at 5:53 PM, Prakash, Prashanth
<pprakash@codeaurora.org> wrote:
> Hi Rafael,
>
> On 3/16/2016 7:50 PM, Rafael J. Wysocki wrote:
>>  #include "internal.h"
>> @@ -22,7 +24,6 @@ ACPI_MODULE_NAME("scan");
>>  extern struct acpi_device *acpi_root;
>>
>>  #define ACPI_BUS_CLASS                 "system_bus"
>> -#define ACPI_BUS_HID                   "LNXSYBUS"
>> No.
>>
>> This is not a valid device ID and should never be used as such.
> Section 5.6.6 in ACPI 6.1 is defining the notification value for the graceful
> shutdown request as a ACPI device specific value(0x81) and it is targeting
> the system bus(\_SB), so we took the current approach of creating a sybus
> driver to handle the notifications targeting the system bus.
>
> Let me go through the code again and see if we can avoid using the
> ACPI_BUS_HID.

You can.

> In the meantime, if you have any specific thoughts on
> how this should be handled, please let us know.

Your goal is relatively simple.  You want to register a notify handler
for the \_SB object.  You don't need a driver for that, because the
\_SB object is always present, so you don't need to enumerate it or
wait for it to show up etc.

I'd just scan the namespace 1 level below the root and install the
handler for the object with the matching name (not a fake device ID).

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Prakash, Prashanth March 18, 2016, 3:33 p.m. UTC | #4
Than

On 3/17/2016 3:54 PM, Rafael J. Wysocki wrote:
> On Thu, Mar 17, 2016 at 5:53 PM, Prakash, Prashanth
> <pprakash@codeaurora.org> wrote:
>> Hi Rafael,
>>
>> On 3/16/2016 7:50 PM, Rafael J. Wysocki wrote:
>>>  #include "internal.h"
>>> @@ -22,7 +24,6 @@ ACPI_MODULE_NAME("scan");
>>>  extern struct acpi_device *acpi_root;
>>>
>>>  #define ACPI_BUS_CLASS                 "system_bus"
>>> -#define ACPI_BUS_HID                   "LNXSYBUS"
>>> No.
>>>
>>> This is not a valid device ID and should never be used as such.
>> Section 5.6.6 in ACPI 6.1 is defining the notification value for the graceful
>> shutdown request as a ACPI device specific value(0x81) and it is targeting
>> the system bus(\_SB), so we took the current approach of creating a sybus
>> driver to handle the notifications targeting the system bus.
>>
>> Let me go through the code again and see if we can avoid using the
>> ACPI_BUS_HID.
> You can.
>
>> In the meantime, if you have any specific thoughts on
>> how this should be handled, please let us know.
> Your goal is relatively simple.  You want to register a notify handler
> for the \_SB object.  You don't need a driver for that, because the
> \_SB object is always present, so you don't need to enumerate it or
> wait for it to show up etc.
>
> I'd just scan the namespace 1 level below the root and install the
> handler for the object with the matching name (not a fake device ID).
Thanks Rafael! I will update the patch using the above approach.

-Prashanth
> Thanks,
> Rafael
>
>


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 407a376..358e3c8 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -13,6 +13,8 @@ 
 #include <linux/nls.h>
 #include <linux/dma-mapping.h>
 
+#include <acpi/acpi_drivers.h>
+
 #include <asm/pgtable.h>
 
 #include "internal.h"
@@ -22,7 +24,6 @@  ACPI_MODULE_NAME("scan");
 extern struct acpi_device *acpi_root;
 
 #define ACPI_BUS_CLASS			"system_bus"
-#define ACPI_BUS_HID			"LNXSYBUS"
 #define ACPI_BUS_DEVICE_NAME		"System Bus"
 
 #define ACPI_IS_ROOT_DEVICE(device)    (!(device)->parent)
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index 29c6912..3638f6f 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -52,6 +52,7 @@ 
 #define ACPI_POWER_HID			"LNXPOWER"
 #define ACPI_PROCESSOR_OBJECT_HID	"LNXCPU"
 #define ACPI_SYSTEM_HID			"LNXSYSTM"
+#define ACPI_BUS_HID			"LNXSYBUS"
 #define ACPI_THERMAL_HID		"LNXTHERM"
 #define ACPI_BUTTON_HID_POWERF		"LNXPWRBN"
 #define ACPI_BUTTON_HID_SLEEPF		"LNXSLPBN"