diff options
author | Matthew Garrett <mjg59@srcf.ucam.org> | 2008-11-27 12:48:13 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-02-20 10:52:37 -0500 |
commit | 6503e5df08008b9a47022b5e9ebba658c8fa69af (patch) | |
tree | 8ef36d1b85d2a03ac9e61f5074d717b67f9259ba /drivers/platform/x86/intel_menlow.c | |
parent | d2f8d7ee1a9b4650b4e43325b321801264f7c37a (diff) |
thermal: use integers rather than strings for thermal values
The thermal API currently uses strings to pass values to userspace. This
makes it difficult to use from within the kernel. Change the interface
to use integers and fix up the consumers.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform/x86/intel_menlow.c')
-rw-r--r-- | drivers/platform/x86/intel_menlow.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c index 27b7662955bb..29432a50be45 100644 --- a/drivers/platform/x86/intel_menlow.c +++ b/drivers/platform/x86/intel_menlow.c | |||
@@ -57,8 +57,8 @@ MODULE_LICENSE("GPL"); | |||
57 | * In that case max_cstate would be n-1 | 57 | * In that case max_cstate would be n-1 |
58 | * GTHS returning '0' would mean that no bandwidth control states are supported | 58 | * GTHS returning '0' would mean that no bandwidth control states are supported |
59 | */ | 59 | */ |
60 | static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev, | 60 | static int memory_get_max_bandwidth(struct thermal_cooling_device *cdev, |
61 | unsigned long *max_state) | 61 | unsigned long *max_state) |
62 | { | 62 | { |
63 | struct acpi_device *device = cdev->devdata; | 63 | struct acpi_device *device = cdev->devdata; |
64 | acpi_handle handle = device->handle; | 64 | acpi_handle handle = device->handle; |
@@ -83,22 +83,12 @@ static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev, | |||
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | static int memory_get_max_bandwidth(struct thermal_cooling_device *cdev, | ||
87 | char *buf) | ||
88 | { | ||
89 | unsigned long value; | ||
90 | if (memory_get_int_max_bandwidth(cdev, &value)) | ||
91 | return -EINVAL; | ||
92 | |||
93 | return sprintf(buf, "%ld\n", value); | ||
94 | } | ||
95 | |||
96 | static int memory_get_cur_bandwidth(struct thermal_cooling_device *cdev, | 86 | static int memory_get_cur_bandwidth(struct thermal_cooling_device *cdev, |
97 | char *buf) | 87 | unsigned long *value) |
98 | { | 88 | { |
99 | struct acpi_device *device = cdev->devdata; | 89 | struct acpi_device *device = cdev->devdata; |
100 | acpi_handle handle = device->handle; | 90 | acpi_handle handle = device->handle; |
101 | unsigned long long value; | 91 | unsigned long long result; |
102 | struct acpi_object_list arg_list; | 92 | struct acpi_object_list arg_list; |
103 | union acpi_object arg; | 93 | union acpi_object arg; |
104 | acpi_status status = AE_OK; | 94 | acpi_status status = AE_OK; |
@@ -108,15 +98,16 @@ static int memory_get_cur_bandwidth(struct thermal_cooling_device *cdev, | |||
108 | arg.type = ACPI_TYPE_INTEGER; | 98 | arg.type = ACPI_TYPE_INTEGER; |
109 | arg.integer.value = MEMORY_ARG_CUR_BANDWIDTH; | 99 | arg.integer.value = MEMORY_ARG_CUR_BANDWIDTH; |
110 | status = acpi_evaluate_integer(handle, MEMORY_GET_BANDWIDTH, | 100 | status = acpi_evaluate_integer(handle, MEMORY_GET_BANDWIDTH, |
111 | &arg_list, &value); | 101 | &arg_list, &result); |
112 | if (ACPI_FAILURE(status)) | 102 | if (ACPI_FAILURE(status)) |
113 | return -EFAULT; | 103 | return -EFAULT; |
114 | 104 | ||
115 | return sprintf(buf, "%llu\n", value); | 105 | *value = result; |
106 | return 0; | ||
116 | } | 107 | } |
117 | 108 | ||
118 | static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev, | 109 | static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev, |
119 | unsigned int state) | 110 | unsigned long state) |
120 | { | 111 | { |
121 | struct acpi_device *device = cdev->devdata; | 112 | struct acpi_device *device = cdev->devdata; |
122 | acpi_handle handle = device->handle; | 113 | acpi_handle handle = device->handle; |
@@ -126,7 +117,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev, | |||
126 | unsigned long long temp; | 117 | unsigned long long temp; |
127 | unsigned long max_state; | 118 | unsigned long max_state; |
128 | 119 | ||
129 | if (memory_get_int_max_bandwidth(cdev, &max_state)) | 120 | if (memory_get_max_bandwidth(cdev, &max_state)) |
130 | return -EFAULT; | 121 | return -EFAULT; |
131 | 122 | ||
132 | if (state > max_state) | 123 | if (state > max_state) |
@@ -142,7 +133,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev, | |||
142 | &temp); | 133 | &temp); |
143 | 134 | ||
144 | printk(KERN_INFO | 135 | printk(KERN_INFO |
145 | "Bandwidth value was %d: status is %d\n", state, status); | 136 | "Bandwidth value was %ld: status is %d\n", state, status); |
146 | if (ACPI_FAILURE(status)) | 137 | if (ACPI_FAILURE(status)) |
147 | return -EFAULT; | 138 | return -EFAULT; |
148 | 139 | ||