hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/firmware/google/vpd.c
....@@ -1,18 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * vpd.c
34 *
45 * Driver for exporting VPD content to sysfs.
56 *
67 * Copyright 2017 Google Inc.
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License v2.0 as published by
10
- * the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
168 */
179
1810 #include <linux/ctype.h>
....@@ -40,7 +32,7 @@
4032 u32 version;
4133 u32 ro_size;
4234 u32 rw_size;
43
- u8 blob[0];
35
+ u8 blob[];
4436 };
4537
4638 struct vpd_section {
....@@ -198,7 +190,7 @@
198190
199191 sec->name = name;
200192
201
- /* We want to export the raw partion with name ${name}_raw */
193
+ /* We want to export the raw partition with name ${name}_raw */
202194 sec->raw_name = kasprintf(GFP_KERNEL, "%s_raw", name);
203195 if (!sec->raw_name) {
204196 err = -ENOMEM;
....@@ -254,7 +246,7 @@
254246
255247 static int vpd_sections_init(phys_addr_t physaddr)
256248 {
257
- struct vpd_cbmem __iomem *temp;
249
+ struct vpd_cbmem *temp;
258250 struct vpd_cbmem header;
259251 int ret = 0;
260252
....@@ -262,7 +254,7 @@
262254 if (!temp)
263255 return -ENOMEM;
264256
265
- memcpy_fromio(&header, temp, sizeof(struct vpd_cbmem));
257
+ memcpy(&header, temp, sizeof(struct vpd_cbmem));
266258 memunmap(temp);
267259
268260 if (header.magic != VPD_CBMEM_MAGIC)
....@@ -324,19 +316,7 @@
324316 },
325317 .tag = CB_TAG_VPD,
326318 };
327
-
328
-static int __init coreboot_vpd_init(void)
329
-{
330
- return coreboot_driver_register(&vpd_driver);
331
-}
332
-
333
-static void __exit coreboot_vpd_exit(void)
334
-{
335
- coreboot_driver_unregister(&vpd_driver);
336
-}
337
-
338
-module_init(coreboot_vpd_init);
339
-module_exit(coreboot_vpd_exit);
319
+module_coreboot_driver(vpd_driver);
340320
341321 MODULE_AUTHOR("Google, Inc.");
342322 MODULE_LICENSE("GPL");