public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: Do not pass NULL to acpi_get_handle() when looking for _EJD
@ 2008-02-14 12:40 Holger Macht
  2008-02-14 14:49 ` Thomas Renninger
  0 siblings, 1 reply; 3+ messages in thread
From: Holger Macht @ 2008-02-14 12:40 UTC (permalink / raw)
  To: linux-acpi; +Cc: Len Brown, Kristen Carlson Accardi, trenn

When trying to get the acpi_handle from an acpi_buffer, pass
ACPI_ROOT_OBJECT instead of NULL to acpi_get_handle(). This fixes the
detection of dock dependent bays.


Signed-off-by: Holger Macht <hmacht@suse.de>
---

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 3fac011..d9b9143 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -609,7 +609,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd)
 	status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);
 	if (ACPI_SUCCESS(status)) {
 		obj = buffer.pointer;
-		status = acpi_get_handle(NULL, obj->string.pointer, ejd);
+		status = acpi_get_handle(ACPI_ROOT_OBJECT, obj->string.pointer,
+					 ejd);
 		kfree(buffer.pointer);
 	}
 	return status;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: Do not pass NULL to acpi_get_handle() when looking for _EJD
  2008-02-14 12:40 [PATCH] ACPI: Do not pass NULL to acpi_get_handle() when looking for _EJD Holger Macht
@ 2008-02-14 14:49 ` Thomas Renninger
  2008-02-14 15:02   ` Thomas Renninger
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Renninger @ 2008-02-14 14:49 UTC (permalink / raw)
  To: Holger Macht; +Cc: linux-acpi, Len Brown, Kristen Carlson Accardi

On Thu, 2008-02-14 at 13:40 +0100, Holger Macht wrote:
> When trying to get the acpi_handle from an acpi_buffer, pass
> ACPI_ROOT_OBJECT instead of NULL to acpi_get_handle(). This fixes the
> detection of dock dependent bays.
> 
> 
> Signed-off-by: Holger Macht <hmacht@suse.de>
> ---
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 3fac011..d9b9143 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -609,7 +609,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd)
>  	status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);
>  	if (ACPI_SUCCESS(status)) {
>  		obj = buffer.pointer;
> -		status = acpi_get_handle(NULL, obj->string.pointer, ejd);
> +		status = acpi_get_handle(ACPI_ROOT_OBJECT, obj->string.pointer,
> +					 ejd);
>  		kfree(buffer.pointer);
>  	}
>  	return status;
> 

I can verify that acpi_bus_get_ejd is totally useless without that
patch.
If "status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);"
succeeds (and AE_NOT_FOUND is not returned), the function will return
AE_BAD_PARAMETER, because NULL never makes sense as first argument of
acpi_get_handle:
status = acpi_get_handle(NULL, obj->string.pointer, ejd);

I can also verify that the correct handle is evaluated with this patch
on a recent ThinkPad, otherwise not.

Please add it, looks like a typo.

   Thomas


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: Do not pass NULL to acpi_get_handle() when looking for _EJD
  2008-02-14 14:49 ` Thomas Renninger
@ 2008-02-14 15:02   ` Thomas Renninger
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Renninger @ 2008-02-14 15:02 UTC (permalink / raw)
  To: Holger Macht; +Cc: linux-acpi, Len Brown, Kristen Carlson Accardi

On Thu, 2008-02-14 at 15:49 +0100, Thomas Renninger wrote:
> On Thu, 2008-02-14 at 13:40 +0100, Holger Macht wrote:
> > When trying to get the acpi_handle from an acpi_buffer, pass
> > ACPI_ROOT_OBJECT instead of NULL to acpi_get_handle(). This fixes the
> > detection of dock dependent bays.
> > 
> > 
> > Signed-off-by: Holger Macht <hmacht@suse.de>
> > ---
> > 
> > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> > index 3fac011..d9b9143 100644
> > --- a/drivers/acpi/scan.c
> > +++ b/drivers/acpi/scan.c
> > @@ -609,7 +609,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd)
> >  	status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);
> >  	if (ACPI_SUCCESS(status)) {
> >  		obj = buffer.pointer;
> > -		status = acpi_get_handle(NULL, obj->string.pointer, ejd);
> > +		status = acpi_get_handle(ACPI_ROOT_OBJECT, obj->string.pointer,
> > +					 ejd);
> >  		kfree(buffer.pointer);
> >  	}
> >  	return status;
> > 
> 
> I can verify that acpi_bus_get_ejd is totally useless without that
> patch.
I mean I have verified and can confirm that..

> If "status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);"
> succeeds (and AE_NOT_FOUND is not returned), the function will return
> AE_BAD_PARAMETER, because NULL never makes sense as first argument of
> acpi_get_handle:
> status = acpi_get_handle(NULL, obj->string.pointer, ejd);
> 
> I can also verify that the correct handle is evaluated with this patch
> on a recent ThinkPad, otherwise not.
Same here.

> Please add it, looks like a typo.

  Thomas


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-14 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-14 12:40 [PATCH] ACPI: Do not pass NULL to acpi_get_handle() when looking for _EJD Holger Macht
2008-02-14 14:49 ` Thomas Renninger
2008-02-14 15:02   ` Thomas Renninger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox