hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/acpi/acpi_lpit.c
....@@ -1,17 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12
23 /*
34 * acpi_lpit.c - LPIT table processing functions
45 *
56 * Copyright (C) 2017 Intel Corporation. All rights reserved.
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License version
9
- * 2 as published by the Free Software Foundation.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
157 */
168
179 #include <linux/cpu.h>
....@@ -112,7 +104,7 @@
112104
113105 info->gaddr = lpit_native->residency_counter;
114106 if (info->gaddr.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
115
- info->iomem_addr = ioremap_nocache(info->gaddr.address,
107
+ info->iomem_addr = ioremap(info->gaddr.address,
116108 info->gaddr.bit_width / 8);
117109 if (!info->iomem_addr)
118110 return;
....@@ -137,7 +129,7 @@
137129
138130 static void lpit_process(u64 begin, u64 end)
139131 {
140
- while (begin + sizeof(struct acpi_lpit_native) < end) {
132
+ while (begin + sizeof(struct acpi_lpit_native) <= end) {
141133 struct acpi_lpit_native *lpit_native = (struct acpi_lpit_native *)begin;
142134
143135 if (!lpit_native->header.type && !lpit_native->header.flags) {
....@@ -156,14 +148,14 @@
156148 void acpi_init_lpit(void)
157149 {
158150 acpi_status status;
159
- u64 lpit_begin;
160151 struct acpi_table_lpit *lpit;
161152
162153 status = acpi_get_table(ACPI_SIG_LPIT, 0, (struct acpi_table_header **)&lpit);
163
-
164154 if (ACPI_FAILURE(status))
165155 return;
166156
167
- lpit_begin = (u64)lpit + sizeof(*lpit);
168
- lpit_process(lpit_begin, lpit_begin + lpit->header.length);
157
+ lpit_process((u64)lpit + sizeof(*lpit),
158
+ (u64)lpit + lpit->header.length);
159
+
160
+ acpi_put_table((struct acpi_table_header *)lpit);
169161 }