hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/acpi/acpi_pad.c
....@@ -1,17 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * acpi_pad.c ACPI Processor Aggregator Driver
34 *
45 * Copyright (c) 2009, Intel Corporation.
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms and conditions of the GNU General Public License,
8
- * version 2, as published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope it will be useful, but WITHOUT
11
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13
- * more details.
14
- *
156 */
167
178 #include <linux/kernel.h>
....@@ -70,8 +61,10 @@
7061
7162 #if defined(CONFIG_X86)
7263 switch (boot_cpu_data.x86_vendor) {
64
+ case X86_VENDOR_HYGON:
7365 case X86_VENDOR_AMD:
7466 case X86_VENDOR_INTEL:
67
+ case X86_VENDOR_ZHAOXIN:
7568 /*
7669 * AMD Fam10h TSC will tick in all
7770 * C/P/S0/S1 states when this bit is set.
....@@ -95,7 +88,7 @@
9588 cpumask_var_t tmp;
9689 int cpu;
9790 unsigned long min_weight = -1;
98
- unsigned long uninitialized_var(preferred_cpu);
91
+ unsigned long preferred_cpu;
9992
10093 if (!alloc_cpumask_var(&tmp, GFP_KERNEL))
10194 return;
....@@ -143,12 +136,11 @@
143136 static unsigned int round_robin_time = 1; /* second */
144137 static int power_saving_thread(void *data)
145138 {
146
- struct sched_param param = {.sched_priority = 1};
147139 int do_sleep;
148140 unsigned int tsk_index = (unsigned long)data;
149141 u64 last_jiffies = 0;
150142
151
- sched_setscheduler(current, SCHED_RR, &param);
143
+ sched_set_fifo_low(current);
152144
153145 while (!kthread_should_stop()) {
154146 unsigned long expire_time;
....@@ -269,7 +261,7 @@
269261 return ps_tsk_num;
270262 }
271263
272
-static ssize_t acpi_pad_rrtime_store(struct device *dev,
264
+static ssize_t rrtime_store(struct device *dev,
273265 struct device_attribute *attr, const char *buf, size_t count)
274266 {
275267 unsigned long num;
....@@ -283,16 +275,14 @@
283275 return count;
284276 }
285277
286
-static ssize_t acpi_pad_rrtime_show(struct device *dev,
278
+static ssize_t rrtime_show(struct device *dev,
287279 struct device_attribute *attr, char *buf)
288280 {
289281 return scnprintf(buf, PAGE_SIZE, "%d\n", round_robin_time);
290282 }
291
-static DEVICE_ATTR(rrtime, S_IRUGO|S_IWUSR,
292
- acpi_pad_rrtime_show,
293
- acpi_pad_rrtime_store);
283
+static DEVICE_ATTR_RW(rrtime);
294284
295
-static ssize_t acpi_pad_idlepct_store(struct device *dev,
285
+static ssize_t idlepct_store(struct device *dev,
296286 struct device_attribute *attr, const char *buf, size_t count)
297287 {
298288 unsigned long num;
....@@ -306,16 +296,14 @@
306296 return count;
307297 }
308298
309
-static ssize_t acpi_pad_idlepct_show(struct device *dev,
299
+static ssize_t idlepct_show(struct device *dev,
310300 struct device_attribute *attr, char *buf)
311301 {
312302 return scnprintf(buf, PAGE_SIZE, "%d\n", idle_pct);
313303 }
314
-static DEVICE_ATTR(idlepct, S_IRUGO|S_IWUSR,
315
- acpi_pad_idlepct_show,
316
- acpi_pad_idlepct_store);
304
+static DEVICE_ATTR_RW(idlepct);
317305
318
-static ssize_t acpi_pad_idlecpus_store(struct device *dev,
306
+static ssize_t idlecpus_store(struct device *dev,
319307 struct device_attribute *attr, const char *buf, size_t count)
320308 {
321309 unsigned long num;
....@@ -327,16 +315,14 @@
327315 return count;
328316 }
329317
330
-static ssize_t acpi_pad_idlecpus_show(struct device *dev,
318
+static ssize_t idlecpus_show(struct device *dev,
331319 struct device_attribute *attr, char *buf)
332320 {
333321 return cpumap_print_to_pagebuf(false, buf,
334322 to_cpumask(pad_busy_cpus_bits));
335323 }
336324
337
-static DEVICE_ATTR(idlecpus, S_IRUGO|S_IWUSR,
338
- acpi_pad_idlecpus_show,
339
- acpi_pad_idlecpus_store);
325
+static DEVICE_ATTR_RW(idlecpus);
340326
341327 static int acpi_pad_add_sysfs(struct acpi_device *device)
342328 {