| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /** |
|---|
| 2 | 3 | * imr.c -- Intel Isolated Memory Region driver |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 28 | 29 | #include <asm/cpu_device_id.h> |
|---|
| 29 | 30 | #include <asm/imr.h> |
|---|
| 30 | 31 | #include <asm/iosf_mbi.h> |
|---|
| 32 | +#include <asm/io.h> |
|---|
| 33 | + |
|---|
| 31 | 34 | #include <linux/debugfs.h> |
|---|
| 32 | 35 | #include <linux/init.h> |
|---|
| 33 | 36 | #include <linux/mm.h> |
|---|
| 34 | 37 | #include <linux/types.h> |
|---|
| 35 | 38 | |
|---|
| 36 | 39 | struct imr_device { |
|---|
| 37 | | - struct dentry *file; |
|---|
| 38 | 40 | bool init; |
|---|
| 39 | 41 | struct mutex lock; |
|---|
| 40 | 42 | int max_imr; |
|---|
| .. | .. |
|---|
| 230 | 232 | * imr_debugfs_register - register debugfs hooks. |
|---|
| 231 | 233 | * |
|---|
| 232 | 234 | * @idev: pointer to imr_device structure. |
|---|
| 233 | | - * @return: 0 on success - errno on failure. |
|---|
| 234 | 235 | */ |
|---|
| 235 | | -static int imr_debugfs_register(struct imr_device *idev) |
|---|
| 236 | +static void imr_debugfs_register(struct imr_device *idev) |
|---|
| 236 | 237 | { |
|---|
| 237 | | - idev->file = debugfs_create_file("imr_state", 0444, NULL, idev, |
|---|
| 238 | | - &imr_dbgfs_state_fops); |
|---|
| 239 | | - return PTR_ERR_OR_ZERO(idev->file); |
|---|
| 238 | + debugfs_create_file("imr_state", 0444, NULL, idev, |
|---|
| 239 | + &imr_dbgfs_state_fops); |
|---|
| 240 | 240 | } |
|---|
| 241 | 241 | |
|---|
| 242 | 242 | /** |
|---|
| .. | .. |
|---|
| 569 | 569 | } |
|---|
| 570 | 570 | |
|---|
| 571 | 571 | static const struct x86_cpu_id imr_ids[] __initconst = { |
|---|
| 572 | | - { X86_VENDOR_INTEL, 5, 9 }, /* Intel Quark SoC X1000. */ |
|---|
| 572 | + X86_MATCH_VENDOR_FAM_MODEL(INTEL, 5, INTEL_FAM5_QUARK_X1000, NULL), |
|---|
| 573 | 573 | {} |
|---|
| 574 | 574 | }; |
|---|
| 575 | 575 | |
|---|
| .. | .. |
|---|
| 581 | 581 | static int __init imr_init(void) |
|---|
| 582 | 582 | { |
|---|
| 583 | 583 | struct imr_device *idev = &imr_dev; |
|---|
| 584 | | - int ret; |
|---|
| 585 | 584 | |
|---|
| 586 | 585 | if (!x86_match_cpu(imr_ids) || !iosf_mbi_available()) |
|---|
| 587 | 586 | return -ENODEV; |
|---|
| .. | .. |
|---|
| 591 | 590 | idev->init = true; |
|---|
| 592 | 591 | |
|---|
| 593 | 592 | mutex_init(&idev->lock); |
|---|
| 594 | | - ret = imr_debugfs_register(idev); |
|---|
| 595 | | - if (ret != 0) |
|---|
| 596 | | - pr_warn("debugfs register failed!\n"); |
|---|
| 593 | + imr_debugfs_register(idev); |
|---|
| 597 | 594 | imr_fixup_memmap(idev); |
|---|
| 598 | 595 | return 0; |
|---|
| 599 | 596 | } |
|---|