Re: [lm-sensors] [PATCH] hwmon: (asus_atk0110) Don't load if ACPI resources aren't enforced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
> Cc: Luca Tettamanti <kronos.it@xxxxxxxxx>
> Cc: Len Brown <lenb@xxxxxxxxxx>
> ---
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux