|
@@ -53,6 +53,8 @@ MODULE_LICENSE("GPL");
|
|
#define MEMORY_ARG_CUR_BANDWIDTH 1
|
|
#define MEMORY_ARG_CUR_BANDWIDTH 1
|
|
#define MEMORY_ARG_MAX_BANDWIDTH 0
|
|
#define MEMORY_ARG_MAX_BANDWIDTH 0
|
|
|
|
|
|
|
|
+static void intel_menlow_unregister_sensor(void);
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* GTHS returning 'n' would mean that [0,n-1] states are supported
|
|
* GTHS returning 'n' would mean that [0,n-1] states are supported
|
|
* In that case max_cstate would be n-1
|
|
* In that case max_cstate would be n-1
|
|
@@ -406,8 +408,10 @@ static int intel_menlow_add_one_attribute(char *name, int mode, void *show,
|
|
attr->handle = handle;
|
|
attr->handle = handle;
|
|
|
|
|
|
result = device_create_file(dev, &attr->attr);
|
|
result = device_create_file(dev, &attr->attr);
|
|
- if (result)
|
|
|
|
|
|
+ if (result) {
|
|
|
|
+ kfree(attr);
|
|
return result;
|
|
return result;
|
|
|
|
+ }
|
|
|
|
|
|
mutex_lock(&intel_menlow_attr_lock);
|
|
mutex_lock(&intel_menlow_attr_lock);
|
|
list_add_tail(&attr->node, &intel_menlow_attr_list);
|
|
list_add_tail(&attr->node, &intel_menlow_attr_list);
|
|
@@ -431,11 +435,11 @@ static acpi_status intel_menlow_register_sensor(acpi_handle handle, u32 lvl,
|
|
/* _TZ must have the AUX0/1 methods */
|
|
/* _TZ must have the AUX0/1 methods */
|
|
status = acpi_get_handle(handle, GET_AUX0, &dummy);
|
|
status = acpi_get_handle(handle, GET_AUX0, &dummy);
|
|
if (ACPI_FAILURE(status))
|
|
if (ACPI_FAILURE(status))
|
|
- goto not_found;
|
|
|
|
|
|
+ return (status == AE_NOT_FOUND) ? AE_OK : status;
|
|
|
|
|
|
status = acpi_get_handle(handle, SET_AUX0, &dummy);
|
|
status = acpi_get_handle(handle, SET_AUX0, &dummy);
|
|
if (ACPI_FAILURE(status))
|
|
if (ACPI_FAILURE(status))
|
|
- goto not_found;
|
|
|
|
|
|
+ return (status == AE_NOT_FOUND) ? AE_OK : status;
|
|
|
|
|
|
result = intel_menlow_add_one_attribute("aux0", 0644,
|
|
result = intel_menlow_add_one_attribute("aux0", 0644,
|
|
aux0_show, aux0_store,
|
|
aux0_show, aux0_store,
|
|
@@ -445,17 +449,19 @@ static acpi_status intel_menlow_register_sensor(acpi_handle handle, u32 lvl,
|
|
|
|
|
|
status = acpi_get_handle(handle, GET_AUX1, &dummy);
|
|
status = acpi_get_handle(handle, GET_AUX1, &dummy);
|
|
if (ACPI_FAILURE(status))
|
|
if (ACPI_FAILURE(status))
|
|
- goto not_found;
|
|
|
|
|
|
+ goto aux1_not_found;
|
|
|
|
|
|
status = acpi_get_handle(handle, SET_AUX1, &dummy);
|
|
status = acpi_get_handle(handle, SET_AUX1, &dummy);
|
|
if (ACPI_FAILURE(status))
|
|
if (ACPI_FAILURE(status))
|
|
- goto not_found;
|
|
|
|
|
|
+ goto aux1_not_found;
|
|
|
|
|
|
result = intel_menlow_add_one_attribute("aux1", 0644,
|
|
result = intel_menlow_add_one_attribute("aux1", 0644,
|
|
aux1_show, aux1_store,
|
|
aux1_show, aux1_store,
|
|
&thermal->device, handle);
|
|
&thermal->device, handle);
|
|
- if (result)
|
|
|
|
|
|
+ if (result) {
|
|
|
|
+ intel_menlow_unregister_sensor();
|
|
return AE_ERROR;
|
|
return AE_ERROR;
|
|
|
|
+ }
|
|
|
|
|
|
/*
|
|
/*
|
|
* create the "dabney_enabled" attribute which means the user app
|
|
* create the "dabney_enabled" attribute which means the user app
|
|
@@ -465,14 +471,17 @@ static acpi_status intel_menlow_register_sensor(acpi_handle handle, u32 lvl,
|
|
result = intel_menlow_add_one_attribute("bios_enabled", 0444,
|
|
result = intel_menlow_add_one_attribute("bios_enabled", 0444,
|
|
bios_enabled_show, NULL,
|
|
bios_enabled_show, NULL,
|
|
&thermal->device, handle);
|
|
&thermal->device, handle);
|
|
- if (result)
|
|
|
|
|
|
+ if (result) {
|
|
|
|
+ intel_menlow_unregister_sensor();
|
|
return AE_ERROR;
|
|
return AE_ERROR;
|
|
|
|
+ }
|
|
|
|
|
|
- not_found:
|
|
|
|
|
|
+ aux1_not_found:
|
|
if (status == AE_NOT_FOUND)
|
|
if (status == AE_NOT_FOUND)
|
|
return AE_OK;
|
|
return AE_OK;
|
|
- else
|
|
|
|
- return status;
|
|
|
|
|
|
+
|
|
|
|
+ intel_menlow_unregister_sensor();
|
|
|
|
+ return status;
|
|
}
|
|
}
|
|
|
|
|
|
static void intel_menlow_unregister_sensor(void)
|
|
static void intel_menlow_unregister_sensor(void)
|
|
@@ -513,8 +522,10 @@ static int __init intel_menlow_module_init(void)
|
|
status = acpi_walk_namespace(ACPI_TYPE_THERMAL, ACPI_ROOT_OBJECT,
|
|
status = acpi_walk_namespace(ACPI_TYPE_THERMAL, ACPI_ROOT_OBJECT,
|
|
ACPI_UINT32_MAX,
|
|
ACPI_UINT32_MAX,
|
|
intel_menlow_register_sensor, NULL, NULL, NULL);
|
|
intel_menlow_register_sensor, NULL, NULL, NULL);
|
|
- if (ACPI_FAILURE(status))
|
|
|
|
|
|
+ if (ACPI_FAILURE(status)) {
|
|
|
|
+ acpi_bus_unregister_driver(&intel_menlow_memory_driver);
|
|
return -ENODEV;
|
|
return -ENODEV;
|
|
|
|
+ }
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|