linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: EC: revert fix for 8709 bug
@ 2007-08-24  4:10 Alexey Starikovskiy
  2007-08-24  4:33 ` Len Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Starikovskiy @ 2007-08-24  4:10 UTC (permalink / raw)
  To: Len Brown, ACPI Devel Maling List

This fix breaks another ASUS in 8909 and 8919. Revert it for now.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>

---

 drivers/acpi/ec.c |   47 +++++++++++++++++++++++++++++++----------------
 1 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 56bee9e..43749c8 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -696,14 +696,6 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
 	return AE_CTRL_TERMINATE;
 }
 
-static void ec_remove_handlers(struct acpi_ec *ec)
-{
-	acpi_remove_address_space_handler(ec->handle,
-					  ACPI_ADR_SPACE_EC,
-					  &acpi_ec_space_handler);
-	acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
-}
-
 static int acpi_ec_add(struct acpi_device *device)
 {
 	struct acpi_ec *ec = NULL;
@@ -727,13 +719,16 @@ static int acpi_ec_add(struct acpi_device *device)
 	/* Check if we found the boot EC */
 	if (boot_ec) {
 		if (boot_ec->gpe == ec->gpe) {
-			ec_remove_handlers(boot_ec);
-			mutex_destroy(&boot_ec->lock);
-			kfree(boot_ec);
-			first_ec = boot_ec = NULL;
+			/* We might have incorrect info for GL at boot time */
+			mutex_lock(&boot_ec->lock);
+			boot_ec->global_lock = ec->global_lock;
+			/* Copy handlers from new ec into boot ec */
+			list_splice(&ec->list, &boot_ec->list);
+			mutex_unlock(&boot_ec->lock);
+			kfree(ec);
+			ec = boot_ec;
 		}
-	}
-	if (!first_ec)
+	} else
 		first_ec = ec;
 	ec->handle = device->handle;
 	acpi_driver_data(device) = ec;
@@ -762,6 +757,9 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
 	if (ec == first_ec)
 		first_ec = NULL;
 
+	/* Don't touch boot EC */
+	if (boot_ec != ec)
+		kfree(ec);
 	return 0;
 }
 
@@ -825,7 +823,9 @@ static int acpi_ec_start(struct acpi_device *device)
 	if (!ec)
 		return -EINVAL;
 
-	ret = ec_install_handlers(ec);
+	/* Boot EC is already working */
+	if (ec != boot_ec)
+		ret = ec_install_handlers(ec);
 
 	/* EC is fully operational, allow queries */
 	atomic_set(&ec->query_pending, 0);
@@ -835,6 +835,7 @@ static int acpi_ec_start(struct acpi_device *device)
 
 static int acpi_ec_stop(struct acpi_device *device, int type)
 {
+	acpi_status status;
 	struct acpi_ec *ec;
 
 	if (!device)
@@ -843,7 +844,21 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
 	ec = acpi_driver_data(device);
 	if (!ec)
 		return -EINVAL;
-	ec_remove_handlers(ec);
+
+	/* Don't touch boot EC */
+	if (ec == boot_ec)
+		return 0;
+
+	status = acpi_remove_address_space_handler(ec->handle,
+						   ACPI_ADR_SPACE_EC,
+						   &acpi_ec_space_handler);
+	if (ACPI_FAILURE(status))
+		return -ENODEV;
+
+	status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
+	if (ACPI_FAILURE(status))
+		return -ENODEV;
+
 	return 0;
 }
 

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

* Re: [PATCH] ACPI: EC: revert fix for 8709 bug
  2007-08-24  4:10 [PATCH] ACPI: EC: revert fix for 8709 bug Alexey Starikovskiy
@ 2007-08-24  4:33 ` Len Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Len Brown @ 2007-08-24  4:33 UTC (permalink / raw)
  To: Alexey Starikovskiy; +Cc: ACPI Devel Maling List

On Friday 24 August 2007 00:10, Alexey Starikovskiy wrote:
> This fix breaks another ASUS in 8909 and 8919. Revert it for now.

thanks Alexey.
Being -rc3, I agree it is prudent for now to apply this
and go back to the situation we had in 2.6.22
while a fix that doesn't cause other regressions develops.

applied.
-Len

> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
> 
> ---
> 
>  drivers/acpi/ec.c |   47 +++++++++++++++++++++++++++++++----------------
>  1 files changed, 31 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
> index 56bee9e..43749c8 100644
> --- a/drivers/acpi/ec.c
> +++ b/drivers/acpi/ec.c
> @@ -696,14 +696,6 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
>  	return AE_CTRL_TERMINATE;
>  }
>  
> -static void ec_remove_handlers(struct acpi_ec *ec)
> -{
> -	acpi_remove_address_space_handler(ec->handle,
> -					  ACPI_ADR_SPACE_EC,
> -					  &acpi_ec_space_handler);
> -	acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
> -}
> -
>  static int acpi_ec_add(struct acpi_device *device)
>  {
>  	struct acpi_ec *ec = NULL;
> @@ -727,13 +719,16 @@ static int acpi_ec_add(struct acpi_device *device)
>  	/* Check if we found the boot EC */
>  	if (boot_ec) {
>  		if (boot_ec->gpe == ec->gpe) {
> -			ec_remove_handlers(boot_ec);
> -			mutex_destroy(&boot_ec->lock);
> -			kfree(boot_ec);
> -			first_ec = boot_ec = NULL;
> +			/* We might have incorrect info for GL at boot time */
> +			mutex_lock(&boot_ec->lock);
> +			boot_ec->global_lock = ec->global_lock;
> +			/* Copy handlers from new ec into boot ec */
> +			list_splice(&ec->list, &boot_ec->list);
> +			mutex_unlock(&boot_ec->lock);
> +			kfree(ec);
> +			ec = boot_ec;
>  		}
> -	}
> -	if (!first_ec)
> +	} else
>  		first_ec = ec;
>  	ec->handle = device->handle;
>  	acpi_driver_data(device) = ec;
> @@ -762,6 +757,9 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
>  	if (ec == first_ec)
>  		first_ec = NULL;
>  
> +	/* Don't touch boot EC */
> +	if (boot_ec != ec)
> +		kfree(ec);
>  	return 0;
>  }
>  
> @@ -825,7 +823,9 @@ static int acpi_ec_start(struct acpi_device *device)
>  	if (!ec)
>  		return -EINVAL;
>  
> -	ret = ec_install_handlers(ec);
> +	/* Boot EC is already working */
> +	if (ec != boot_ec)
> +		ret = ec_install_handlers(ec);
>  
>  	/* EC is fully operational, allow queries */
>  	atomic_set(&ec->query_pending, 0);
> @@ -835,6 +835,7 @@ static int acpi_ec_start(struct acpi_device *device)
>  
>  static int acpi_ec_stop(struct acpi_device *device, int type)
>  {
> +	acpi_status status;
>  	struct acpi_ec *ec;
>  
>  	if (!device)
> @@ -843,7 +844,21 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
>  	ec = acpi_driver_data(device);
>  	if (!ec)
>  		return -EINVAL;
> -	ec_remove_handlers(ec);
> +
> +	/* Don't touch boot EC */
> +	if (ec == boot_ec)
> +		return 0;
> +
> +	status = acpi_remove_address_space_handler(ec->handle,
> +						   ACPI_ADR_SPACE_EC,
> +						   &acpi_ec_space_handler);
> +	if (ACPI_FAILURE(status))
> +		return -ENODEV;
> +
> +	status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
> +	if (ACPI_FAILURE(status))
> +		return -ENODEV;
> +
>  	return 0;
>  }
>  
> 

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

end of thread, other threads:[~2007-08-24  4:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-24  4:10 [PATCH] ACPI: EC: revert fix for 8709 bug Alexey Starikovskiy
2007-08-24  4:33 ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).