| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * vpd.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Driver for exporting VPD content to sysfs. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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. |
|---|
| 16 | 8 | */ |
|---|
| 17 | 9 | |
|---|
| 18 | 10 | #include <linux/ctype.h> |
|---|
| .. | .. |
|---|
| 40 | 32 | u32 version; |
|---|
| 41 | 33 | u32 ro_size; |
|---|
| 42 | 34 | u32 rw_size; |
|---|
| 43 | | - u8 blob[0]; |
|---|
| 35 | + u8 blob[]; |
|---|
| 44 | 36 | }; |
|---|
| 45 | 37 | |
|---|
| 46 | 38 | struct vpd_section { |
|---|
| .. | .. |
|---|
| 198 | 190 | |
|---|
| 199 | 191 | sec->name = name; |
|---|
| 200 | 192 | |
|---|
| 201 | | - /* We want to export the raw partion with name ${name}_raw */ |
|---|
| 193 | + /* We want to export the raw partition with name ${name}_raw */ |
|---|
| 202 | 194 | sec->raw_name = kasprintf(GFP_KERNEL, "%s_raw", name); |
|---|
| 203 | 195 | if (!sec->raw_name) { |
|---|
| 204 | 196 | err = -ENOMEM; |
|---|
| .. | .. |
|---|
| 254 | 246 | |
|---|
| 255 | 247 | static int vpd_sections_init(phys_addr_t physaddr) |
|---|
| 256 | 248 | { |
|---|
| 257 | | - struct vpd_cbmem __iomem *temp; |
|---|
| 249 | + struct vpd_cbmem *temp; |
|---|
| 258 | 250 | struct vpd_cbmem header; |
|---|
| 259 | 251 | int ret = 0; |
|---|
| 260 | 252 | |
|---|
| .. | .. |
|---|
| 262 | 254 | if (!temp) |
|---|
| 263 | 255 | return -ENOMEM; |
|---|
| 264 | 256 | |
|---|
| 265 | | - memcpy_fromio(&header, temp, sizeof(struct vpd_cbmem)); |
|---|
| 257 | + memcpy(&header, temp, sizeof(struct vpd_cbmem)); |
|---|
| 266 | 258 | memunmap(temp); |
|---|
| 267 | 259 | |
|---|
| 268 | 260 | if (header.magic != VPD_CBMEM_MAGIC) |
|---|
| .. | .. |
|---|
| 324 | 316 | }, |
|---|
| 325 | 317 | .tag = CB_TAG_VPD, |
|---|
| 326 | 318 | }; |
|---|
| 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); |
|---|
| 340 | 320 | |
|---|
| 341 | 321 | MODULE_AUTHOR("Google, Inc."); |
|---|
| 342 | 322 | MODULE_LICENSE("GPL"); |
|---|