All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI
@ 2010-03-09 12:56 Jean Delvare
  2010-03-09 20:20 ` Luca Tettamanti
  2010-03-30 10:03   ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI Jean Delvare
  0 siblings, 2 replies; 30+ messages in thread
From: Jean Delvare @ 2010-03-09 12:56 UTC (permalink / raw)
  To: lm-sensors

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

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

end of thread, other threads:[~2010-03-31 13:37 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced Jean Delvare
2010-03-30 10:03   ` [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI 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

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.