public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 12/12] acpi: fix a if-statement in setup_sys_fs_device_files()
@ 2005-02-23  9:53 akpm-3NddpPZAyC0
       [not found] ` <200502230953.j1N9rRAo020726-bipKiLWnuIsyyg0EjBt7GtHuzzzSOjJt@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: akpm-3NddpPZAyC0 @ 2005-02-23  9:53 UTC (permalink / raw)
  To: len.brown-ral2JQCrhuEAvxtiuMwx3w
  Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, akpm-3NddpPZAyC0,
	tokunaga.keiich-+CUm20s59erQFUHtdCDX3A


From: Keiichiro Tokunaga <tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>

This fixes a if-statement in setup_sys_fs_device_files().  It seems to
assume that 'struct acpi_device_flags.ejectable' indicates whether a device
has _EJ0 or not.  But this is not a right assumption.  It indicates whether
a device has _EJ0|_EJD (See acpi_bus_get_flags() function).

setup_sys_fs_device_files() creates 'eject' file for devices that have _EJ0
control method under a corresponding directory in
/sys/firmware/acpi/namespace/ACPI/.  'eject' file is used to trigger
hot-removal function from userland.

Signed-off-by: Keiichiro Tokunaga <tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
Signed-off-by: Andrew Morton <akpm-3NddpPZAyC0@public.gmane.org>
---

 25-akpm/drivers/acpi/scan.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)

diff -puN drivers/acpi/scan.c~acpi-fix-a-if-statement-in-setup_sys_fs_device_files drivers/acpi/scan.c
--- 25/drivers/acpi/scan.c~acpi-fix-a-if-statement-in-setup_sys_fs_device_files	2005-02-23 01:48:12.000000000 -0800
+++ 25-akpm/drivers/acpi/scan.c	2005-02-23 01:48:12.000000000 -0800
@@ -383,7 +383,15 @@ setup_sys_fs_device_files (
 	struct acpi_device *dev,
 	acpi_device_sysfs_files *func)
 {
-	if (dev->flags.ejectable == 1)
+	acpi_status		status;
+	acpi_handle		temp = NULL;
+
+	/*
+	 * If device has _EJ0, 'eject' file is created that is used to trigger
+	 * hot-removal function from userland.
+	 */
+	status = acpi_get_handle(dev->handle, "_EJ0", &temp);
+	if (ACPI_SUCCESS(status))
 		(*(func))(&dev->kobj,&acpi_device_attr_eject.attr);
 }
 
_


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

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

* Re: [patch 12/12] acpi: fix a if-statement in setup_sys_fs_device_files()
       [not found] ` <200502230953.j1N9rRAo020726-bipKiLWnuIsyyg0EjBt7GtHuzzzSOjJt@public.gmane.org>
@ 2005-03-02 19:17   ` Len Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Len Brown @ 2005-03-02 19:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: ACPI Developers, tokunaga.keiich-+CUm20s59erQFUHtdCDX3A,
	Anil S Keshavamurthy

Applied,
thanks,
-Len

On Wed, 2005-02-23 at 04:53, akpm-3NddpPZAyC0@public.gmane.org wrote:
> From: Keiichiro Tokunaga <tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
> 
> This fixes a if-statement in setup_sys_fs_device_files().  It seems to
> assume that 'struct acpi_device_flags.ejectable' indicates whether a
> device
> has _EJ0 or not.  But this is not a right assumption.  It indicates
> whether
> a device has _EJ0|_EJD (See acpi_bus_get_flags() function).
> 
> setup_sys_fs_device_files() creates 'eject' file for devices that have
> _EJ0
> control method under a corresponding directory in
> /sys/firmware/acpi/namespace/ACPI/.  'eject' file is used to trigger
> hot-removal function from userland.
> 
> Signed-off-by: Keiichiro Tokunaga <tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
> Signed-off-by: Andrew Morton <akpm-3NddpPZAyC0@public.gmane.org>
> ---
> 
>  25-akpm/drivers/acpi/scan.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff -puN
> drivers/acpi/scan.c~acpi-fix-a-if-statement-in-setup_sys_fs_device_files drivers/acpi/scan.c
> ---
> 25/drivers/acpi/scan.c~acpi-fix-a-if-statement-in-setup_sys_fs_device_files 2005-02-23 01:48:12.000000000 -0800
> +++ 25-akpm/drivers/acpi/scan.c 2005-02-23 01:48:12.000000000 -0800
> @@ -383,7 +383,15 @@ setup_sys_fs_device_files (
>         struct acpi_device *dev,
>         acpi_device_sysfs_files *func)
>  {
> -       if (dev->flags.ejectable == 1)
> +       acpi_status             status;
> +       acpi_handle             temp = NULL;
> +
> +       /*
> +        * If device has _EJ0, 'eject' file is created that is used to
> trigger
> +        * hot-removal function from userland.
> +        */
> +       status = acpi_get_handle(dev->handle, "_EJ0", &temp);
> +       if (ACPI_SUCCESS(status))
>                 (*(func))(&dev->kobj,&acpi_device_attr_eject.attr);
>  }
> 
> _
> 
> 



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

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

end of thread, other threads:[~2005-03-02 19:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-23  9:53 [patch 12/12] acpi: fix a if-statement in setup_sys_fs_device_files() akpm-3NddpPZAyC0
     [not found] ` <200502230953.j1N9rRAo020726-bipKiLWnuIsyyg0EjBt7GtHuzzzSOjJt@public.gmane.org>
2005-03-02 19:17   ` Len Brown

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