mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced
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> Acked-by: Luca Tettamanti <kronos.it@gmail.com> Cc: Len Brown <lenb@kernel.org>
This commit is contained in:
parent
31f4671799
commit
70dd6beac0
3 changed files with 18 additions and 0 deletions
|
@ -1206,6 +1206,15 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_check_mem_region);
|
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.
|
* Acquire a spinlock.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1411,6 +1411,13 @@ static int __init atk0110_init(void)
|
||||||
{
|
{
|
||||||
int ret;
|
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);
|
ret = acpi_bus_register_driver(&atk_driver);
|
||||||
if (ret)
|
if (ret)
|
||||||
pr_info("atk: acpi_bus_register_driver failed: %d\n", ret);
|
pr_info("atk: acpi_bus_register_driver failed: %d\n", ret);
|
||||||
|
|
|
@ -248,6 +248,8 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
|
||||||
int acpi_check_mem_region(resource_size_t start, resource_size_t n,
|
int acpi_check_mem_region(resource_size_t start, resource_size_t n,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
|
int acpi_resources_are_enforced(void);
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
void __init acpi_no_s4_hw_signature(void);
|
void __init acpi_no_s4_hw_signature(void);
|
||||||
void __init acpi_old_suspend_ordering(void);
|
void __init acpi_old_suspend_ordering(void);
|
||||||
|
|
Loading…
Reference in a new issue