hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/platform/x86/intel_menlow.c
....@@ -1,25 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
2
- * intel_menlow.c - Intel menlow Driver for thermal management extension
3
+ * Intel menlow Driver for thermal management extension
34 *
45 * Copyright (C) 2008 Intel Corp
56 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com>
67 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com>
7
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation; version 2 of the License.
12
- *
13
- * This program is distributed in the hope that it will be useful, but
14
- * WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License along
19
- * with this program; if not, write to the Free Software Foundation, Inc.,
20
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21
- *
22
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
238 *
249 * This driver creates the sys I/F for programming the sensors.
2510 * It also implements the driver for intel menlow memory controller (hardware
....@@ -29,20 +14,20 @@
2914
3015 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
3116
17
+#include <linux/acpi.h>
3218 #include <linux/kernel.h>
3319 #include <linux/module.h>
34
-#include <linux/init.h>
35
-#include <linux/slab.h>
36
-#include <linux/types.h>
3720 #include <linux/pci.h>
3821 #include <linux/pm.h>
22
+#include <linux/slab.h>
3923 #include <linux/thermal.h>
40
-#include <linux/acpi.h>
24
+#include <linux/types.h>
25
+#include <linux/units.h>
4126
4227 MODULE_AUTHOR("Thomas Sujith");
4328 MODULE_AUTHOR("Zhang Rui");
4429 MODULE_DESCRIPTION("Intel Menlow platform specific driver");
45
-MODULE_LICENSE("GPL");
30
+MODULE_LICENSE("GPL v2");
4631
4732 /*
4833 * Memory controller device control
....@@ -196,9 +181,13 @@
196181
197182 static int intel_menlow_memory_remove(struct acpi_device *device)
198183 {
199
- struct thermal_cooling_device *cdev = acpi_driver_data(device);
184
+ struct thermal_cooling_device *cdev;
200185
201
- if (!device || !cdev)
186
+ if (!device)
187
+ return -EINVAL;
188
+
189
+ cdev = acpi_driver_data(device);
190
+ if (!cdev)
202191 return -EINVAL;
203192
204193 sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
....@@ -314,8 +303,10 @@
314303 int result;
315304
316305 result = sensor_get_auxtrip(attr->handle, idx, &value);
306
+ if (result)
307
+ return result;
317308
318
- return result ? result : sprintf(buf, "%lu", DECI_KELVIN_TO_CELSIUS(value));
309
+ return sprintf(buf, "%lu", deci_kelvin_to_celsius(value));
319310 }
320311
321312 static ssize_t aux0_show(struct device *dev,
....@@ -344,8 +335,8 @@
344335 if (value < 0)
345336 return -EINVAL;
346337
347
- result = sensor_set_auxtrip(attr->handle, idx,
348
- CELSIUS_TO_DECI_KELVIN(value));
338
+ result = sensor_set_auxtrip(attr->handle, idx,
339
+ celsius_to_deci_kelvin(value));
349340 return result ? result : count;
350341 }
351342