diff mbox

[V2,06/13] ACPI: introduce enumerable_id flag

Message ID 1394727413-3587-7-git-send-email-rui.zhang@intel.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Zhang, Rui March 13, 2014, 4:16 p.m. UTC
Only certain kind of ACPI device objects can be enumerated via ACPI.
These ACPI device objects include
1. ACPI device objects that have _HID control method.
2. some ACPI device objects that have Linux specified HID strings.

In order to distinguish those device objects from the others, a new flag
enumerable_id and a new function acpi_add_eid() are introduced in this patch.

Currently, only devices with _HID method have this flag set.
And in the future, if a device that has Linux specified HID strings
wants to be enumerated to platform bus, acpi_add_eid() should be used
instead of acpi_add_id() when adding its Linux specified HID string.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/acpi/scan.c     |    8 +++++++-
 include/acpi/acpi_bus.h |    3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

Comments

Wysocki, Rafael J March 15, 2014, 1:03 a.m. UTC | #1
On 3/13/2014 5:16 PM, Zhang Rui wrote:
> Only certain kind of ACPI device objects can be enumerated via ACPI.
> These ACPI device objects include
> 1. ACPI device objects that have _HID control method.
> 2. some ACPI device objects that have Linux specified HID strings.
>
> In order to distinguish those device objects from the others, a new flag
> enumerable_id and a new function acpi_add_eid() are introduced in this patch.

I don't really like the name of the new flag.  What about calling it 
platform_id (it is supposed to indicate that the core should create a 
platform device for it)?

> Currently, only devices with _HID method have this flag set.
> And in the future, if a device that has Linux specified HID strings
> wants to be enumerated to platform bus, acpi_add_eid() should be used

And what about calling the new function acpi_add_platform_id() accordingly?

> instead of acpi_add_id() when adding its Linux specified HID string.

And I don't quite understand the last paragraph as a whole.  Is it 
supposed to mean "if you want platform devices to be created for device 
objects without _HID, use acpi_add_platform_id() when adding artificial 
Linux-specific ID strings to them"?

> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> ---
>   drivers/acpi/scan.c     |    8 +++++++-
>   include/acpi/acpi_bus.h |    3 ++-
>   2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 399257e..768f81d 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -1679,6 +1679,12 @@ static void acpi_add_id(struct acpi_device_pnp *pnp, const char *dev_id)
>   	pnp->type.hardware_id = 1;
>   }
>   
> +static void acpi_add_eid(struct acpi_device_pnp *pnp, const char *dev_id)
> +{
> +	acpi_add_id(pnp, dev_id);
> +	pnp->type.enumerable_id = 1;
> +}
> +
>   /*
>    * Old IBM workstations have a DSDT bug wherein the SMBus object
>    * lacks the SMBUS01 HID and the methods do not have the necessary "_"
> @@ -1729,7 +1735,7 @@ static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp,
>   		}
>   
>   		if (info->valid & ACPI_VALID_HID)
> -			acpi_add_id(pnp, info->hardware_id.string);
> +			acpi_add_eid(pnp, info->hardware_id.string);
>   		if (info->valid & ACPI_VALID_CID) {
>   			cid_list = &info->compatible_id_list;
>   			for (i = 0; i < cid_list->count; i++)
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index 8c5e235..688ca44 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -217,7 +217,8 @@ struct acpi_hardware_id {
>   struct acpi_pnp_type {
>   	u32 hardware_id:1;
>   	u32 bus_address:1;
> -	u32 reserved:30;
> +	u32 enumerable_id:1;
> +	u32 reserved:29;
>   };
>   
>   struct acpi_device_pnp {

--
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
Zhang, Rui March 15, 2014, 1:12 a.m. UTC | #2
> -----Original Message-----
> From: Wysocki, Rafael J
> Sent: Saturday, March 15, 2014 9:03 AM
> To: Zhang, Rui
> Cc: linux-acpi@vger.kernel.org; linux-kernel@vger.kernel.org;
> bhelgaas@google.com; matthew.garrett@nebula.com;
> dmitry.torokhov@gmail.com
> Subject: Re: [PATCH V2 06/13] ACPI: introduce enumerable_id flag
> Importance: High
> 
> On 3/13/2014 5:16 PM, Zhang Rui wrote:
> > Only certain kind of ACPI device objects can be enumerated via ACPI.
> > These ACPI device objects include
> > 1. ACPI device objects that have _HID control method.
> > 2. some ACPI device objects that have Linux specified HID strings.
> >
> > In order to distinguish those device objects from the others, a new
> > flag enumerable_id and a new function acpi_add_eid() are introduced
> in this patch.
> 
> I don't really like the name of the new flag.  What about calling it
> platform_id (it is supposed to indicate that the core should create a
> platform device for it)?
>
I concerned about the same problem, but could not get a better name.
Yes, platform_id sounds much better.

> > Currently, only devices with _HID method have this flag set.
> > And in the future, if a device that has Linux specified HID strings
> > wants to be enumerated to platform bus, acpi_add_eid() should be used
> 
> And what about calling the new function acpi_add_platform_id()
> accordingly?
>
Agreed.
 
> > instead of acpi_add_id() when adding its Linux specified HID string.
> 
> And I don't quite understand the last paragraph as a whole.  Is it
> supposed to mean "if you want platform devices to be created for device
> objects without _HID, use acpi_add_platform_id() when adding artificial
> Linux-specific ID strings to them"?
> 
Yes.
Currently, we use acpi_add_id() for devices like video, thermal, etc,
If we want to see them in platform bus, we just a one line change to
replace acpi_add_id() with acpi_add_platform_id().

Thanks,
rui

> > Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> > ---
> >   drivers/acpi/scan.c     |    8 +++++++-
> >   include/acpi/acpi_bus.h |    3 ++-
> >   2 files changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index
> > 399257e..768f81d 100644
> > --- a/drivers/acpi/scan.c
> > +++ b/drivers/acpi/scan.c
> > @@ -1679,6 +1679,12 @@ static void acpi_add_id(struct acpi_device_pnp
> *pnp, const char *dev_id)
> >   	pnp->type.hardware_id = 1;
> >   }
> >
> > +static void acpi_add_eid(struct acpi_device_pnp *pnp, const char
> > +*dev_id) {
> > +	acpi_add_id(pnp, dev_id);
> > +	pnp->type.enumerable_id = 1;
> > +}
> > +
> >   /*
> >    * Old IBM workstations have a DSDT bug wherein the SMBus object
> >    * lacks the SMBUS01 HID and the methods do not have the necessary
> "_"
> > @@ -1729,7 +1735,7 @@ static void acpi_set_pnp_ids(acpi_handle handle,
> struct acpi_device_pnp *pnp,
> >   		}
> >
> >   		if (info->valid & ACPI_VALID_HID)
> > -			acpi_add_id(pnp, info->hardware_id.string);
> > +			acpi_add_eid(pnp, info->hardware_id.string);
> >   		if (info->valid & ACPI_VALID_CID) {
> >   			cid_list = &info->compatible_id_list;
> >   			for (i = 0; i < cid_list->count; i++) diff --git
> > a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index
> > 8c5e235..688ca44 100644
> > --- a/include/acpi/acpi_bus.h
> > +++ b/include/acpi/acpi_bus.h
> > @@ -217,7 +217,8 @@ struct acpi_hardware_id {
> >   struct acpi_pnp_type {
> >   	u32 hardware_id:1;
> >   	u32 bus_address:1;
> > -	u32 reserved:30;
> > +	u32 enumerable_id:1;
> > +	u32 reserved:29;
> >   };
> >
> >   struct acpi_device_pnp {

--
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 399257e..768f81d 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1679,6 +1679,12 @@  static void acpi_add_id(struct acpi_device_pnp *pnp, const char *dev_id)
 	pnp->type.hardware_id = 1;
 }
 
+static void acpi_add_eid(struct acpi_device_pnp *pnp, const char *dev_id)
+{
+	acpi_add_id(pnp, dev_id);
+	pnp->type.enumerable_id = 1;
+}
+
 /*
  * Old IBM workstations have a DSDT bug wherein the SMBus object
  * lacks the SMBUS01 HID and the methods do not have the necessary "_"
@@ -1729,7 +1735,7 @@  static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp,
 		}
 
 		if (info->valid & ACPI_VALID_HID)
-			acpi_add_id(pnp, info->hardware_id.string);
+			acpi_add_eid(pnp, info->hardware_id.string);
 		if (info->valid & ACPI_VALID_CID) {
 			cid_list = &info->compatible_id_list;
 			for (i = 0; i < cid_list->count; i++)
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 8c5e235..688ca44 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -217,7 +217,8 @@  struct acpi_hardware_id {
 struct acpi_pnp_type {
 	u32 hardware_id:1;
 	u32 bus_address:1;
-	u32 reserved:30;
+	u32 enumerable_id:1;
+	u32 reserved:29;
 };
 
 struct acpi_device_pnp {