From: Jean Delvare <khali@linux-fr.org>
To: linux-acpi@vger.kernel.org
Cc: LM Sensors <lm-sensors@lm-sensors.org>, Len Brown <lenb@kernel.org>
Subject: Re: [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced
Date: Tue, 30 Mar 2010 12:03:19 +0200 [thread overview]
Message-ID: <20100330120319.627e8f9a@hyperion.delvare> (raw)
In-Reply-To: <20100309135636.373a40a9@hyperion.delvare>
ACPI people,
Do you have any objection to the patch below, or can I push it upstream?
On Tue, 9 Mar 2010 13:56:36 +0100, Jean Delvare wrote:
> When the user passes the kernel parameter acpi_enforce_resources=lax,
> the ACPI resources are no longer protected, so a native driver can
> make use of them. In that case, we do not want the asus_atk0110 to be
> loaded. Unfortunately, this driver loads automatically due to its
> MODULE_DEVICE_TABLE, so the user ends up with two drivers loaded for
> the same device - this is bad.
>
> So I suggest that we prevent the asus_atk0110 driver from loading if
> acpi_enforce_resources=lax.
>
> Signed-off-by: Jean Delvare <khali@linux-fr.org>
> Cc: Luca Tettamanti <kronos.it@gmail.com>
> Cc: Len Brown <lenb@kernel.org>
> ---
> Luca, what do you think? I had the idea to write this patch after
> seeing this bug report:
> https://bugzilla.novell.com/show_bug.cgi?id=580988
> I'm not sure if the driver conflict is the root cause of the problem,
> but it certainly did not help.
>
> Another approach would be to hide the ATK0110 ACPI device itself, but I
> don't know if it is possible?
>
> drivers/acpi/osl.c | 9 +++++++++
> drivers/hwmon/asus_atk0110.c | 7 +++++++
> include/linux/acpi.h | 2 ++
> 3 files changed, 18 insertions(+)
>
> --- linux-2.6.34-rc1.orig/drivers/acpi/osl.c 2010-03-09 08:24:52.000000000 +0100
> +++ linux-2.6.34-rc1/drivers/acpi/osl.c 2010-03-09 13:38:49.000000000 +0100
> @@ -1206,6 +1206,15 @@ int acpi_check_mem_region(resource_size_
> EXPORT_SYMBOL(acpi_check_mem_region);
>
> /*
> + * Let drivers know whether the resource checks are effective
> + */
> +int acpi_resources_are_enforced(void)
> +{
> + return acpi_enforce_resources == ENFORCE_RESOURCES_STRICT;
> +}
> +EXPORT_SYMBOL(acpi_resources_are_enforced);
> +
> +/*
> * Acquire a spinlock.
> *
> * handle is a pointer to the spinlock_t.
> --- linux-2.6.34-rc1.orig/drivers/hwmon/asus_atk0110.c 2010-02-25 09:12:22.000000000 +0100
> +++ linux-2.6.34-rc1/drivers/hwmon/asus_atk0110.c 2010-03-09 13:23:50.000000000 +0100
> @@ -1406,6 +1406,13 @@ static int __init atk0110_init(void)
> {
> int ret;
>
> + /* Make sure it's safe to access the device through ACPI */
> + if (!acpi_resources_are_enforced()) {
> + pr_err("atk: Resources not safely usable due to "
> + "acpi_enforce_resources kernel parameter\n");
> + return -EBUSY;
> + }
> +
> ret = acpi_bus_register_driver(&atk_driver);
> if (ret)
> pr_info("atk: acpi_bus_register_driver failed: %d\n", ret);
> --- linux-2.6.34-rc1.orig/include/linux/acpi.h 2010-02-25 09:13:22.000000000 +0100
> +++ linux-2.6.34-rc1/include/linux/acpi.h 2010-03-09 13:46:33.000000000 +0100
> @@ -247,6 +247,8 @@ int acpi_check_region(resource_size_t st
> int acpi_check_mem_region(resource_size_t start, resource_size_t n,
> const char *name);
>
> +int acpi_resources_are_enforced(void);
> +
> #ifdef CONFIG_PM_SLEEP
> void __init acpi_no_s4_hw_signature(void);
> void __init acpi_old_suspend_ordering(void);
>
>
--
Jean Delvare
WARNING: multiple messages have this Message-ID (diff)
From: Jean Delvare <khali@linux-fr.org>
To: linux-acpi@vger.kernel.org
Cc: LM Sensors <lm-sensors@lm-sensors.org>, Len Brown <lenb@kernel.org>
Subject: Re: [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI
Date: Tue, 30 Mar 2010 10:03:19 +0000 [thread overview]
Message-ID: <20100330120319.627e8f9a@hyperion.delvare> (raw)
In-Reply-To: <20100309135636.373a40a9@hyperion.delvare>
ACPI people,
Do you have any objection to the patch below, or can I push it upstream?
On Tue, 9 Mar 2010 13:56:36 +0100, Jean Delvare wrote:
> When the user passes the kernel parameter acpi_enforce_resources=lax,
> the ACPI resources are no longer protected, so a native driver can
> make use of them. In that case, we do not want the asus_atk0110 to be
> loaded. Unfortunately, this driver loads automatically due to its
> MODULE_DEVICE_TABLE, so the user ends up with two drivers loaded for
> the same device - this is bad.
>
> So I suggest that we prevent the asus_atk0110 driver from loading if
> acpi_enforce_resources=lax.
>
> Signed-off-by: Jean Delvare <khali@linux-fr.org>
> Cc: Luca Tettamanti <kronos.it@gmail.com>
> Cc: Len Brown <lenb@kernel.org>
> ---
> Luca, what do you think? I had the idea to write this patch after
> seeing this bug report:
> https://bugzilla.novell.com/show_bug.cgi?idX0988
> I'm not sure if the driver conflict is the root cause of the problem,
> but it certainly did not help.
>
> Another approach would be to hide the ATK0110 ACPI device itself, but I
> don't know if it is possible?
>
> drivers/acpi/osl.c | 9 +++++++++
> drivers/hwmon/asus_atk0110.c | 7 +++++++
> include/linux/acpi.h | 2 ++
> 3 files changed, 18 insertions(+)
>
> --- linux-2.6.34-rc1.orig/drivers/acpi/osl.c 2010-03-09 08:24:52.000000000 +0100
> +++ linux-2.6.34-rc1/drivers/acpi/osl.c 2010-03-09 13:38:49.000000000 +0100
> @@ -1206,6 +1206,15 @@ int acpi_check_mem_region(resource_size_
> EXPORT_SYMBOL(acpi_check_mem_region);
>
> /*
> + * Let drivers know whether the resource checks are effective
> + */
> +int acpi_resources_are_enforced(void)
> +{
> + return acpi_enforce_resources = ENFORCE_RESOURCES_STRICT;
> +}
> +EXPORT_SYMBOL(acpi_resources_are_enforced);
> +
> +/*
> * Acquire a spinlock.
> *
> * handle is a pointer to the spinlock_t.
> --- linux-2.6.34-rc1.orig/drivers/hwmon/asus_atk0110.c 2010-02-25 09:12:22.000000000 +0100
> +++ linux-2.6.34-rc1/drivers/hwmon/asus_atk0110.c 2010-03-09 13:23:50.000000000 +0100
> @@ -1406,6 +1406,13 @@ static int __init atk0110_init(void)
> {
> int ret;
>
> + /* Make sure it's safe to access the device through ACPI */
> + if (!acpi_resources_are_enforced()) {
> + pr_err("atk: Resources not safely usable due to "
> + "acpi_enforce_resources kernel parameter\n");
> + return -EBUSY;
> + }
> +
> ret = acpi_bus_register_driver(&atk_driver);
> if (ret)
> pr_info("atk: acpi_bus_register_driver failed: %d\n", ret);
> --- linux-2.6.34-rc1.orig/include/linux/acpi.h 2010-02-25 09:13:22.000000000 +0100
> +++ linux-2.6.34-rc1/include/linux/acpi.h 2010-03-09 13:46:33.000000000 +0100
> @@ -247,6 +247,8 @@ int acpi_check_region(resource_size_t st
> int acpi_check_mem_region(resource_size_t start, resource_size_t n,
> const char *name);
>
> +int acpi_resources_are_enforced(void);
> +
> #ifdef CONFIG_PM_SLEEP
> void __init acpi_no_s4_hw_signature(void);
> void __init acpi_old_suspend_ordering(void);
>
>
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2010-03-30 10:03 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-09 12:56 [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI Jean Delvare
2010-03-09 20:20 ` Luca Tettamanti
2010-03-30 10:03 ` Jean Delvare [this message]
2010-03-30 10:03 ` Jean Delvare
2010-03-30 13:21 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Matthew Garrett
2010-03-30 13:21 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if Matthew Garrett
2010-03-30 19:47 ` [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Jean Delvare
2010-03-30 19:47 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI Jean Delvare
2010-03-30 19:48 ` [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Matthew Garrett
2010-03-30 19:48 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI Matthew Garrett
2010-03-30 20:32 ` [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Jean Delvare
2010-03-30 20:32 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI Jean Delvare
2010-03-30 21:10 ` [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Matthew Garrett
2010-03-30 21:10 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI Matthew Garrett
2010-03-30 21:45 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Luca Tettamanti
2010-03-30 21:45 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI Luca Tettamanti
2010-03-30 21:53 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Matthew Garrett
2010-03-30 21:53 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if Matthew Garrett
2010-03-31 7:30 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Jean Delvare
2010-03-31 7:30 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI Jean Delvare
2010-03-31 12:51 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Matthew Garrett
2010-03-31 12:51 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if Matthew Garrett
2010-03-31 13:25 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Jean Delvare
2010-03-31 13:25 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI Jean Delvare
2010-03-31 13:27 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Matthew Garrett
2010-03-31 13:27 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if Matthew Garrett
2010-03-31 13:37 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Jean Delvare
2010-03-31 13:37 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI Jean Delvare
2010-03-31 7:42 ` [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Jean Delvare
2010-03-31 7:42 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI Jean Delvare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100330120319.627e8f9a@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.