hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/arch/x86/platform/atom/punit_atom_debug.c
....@@ -1,19 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Intel SOC Punit device state debug driver
34 * Punit controls power management for North Complex devices (Graphics
45 * blocks, Image Signal Processing, video processing, display, DSP etc.)
56 *
67 * Copyright (c) 2015, Intel Corporation.
7
- *
8
- * This program is free software; you can redistribute it and/or modify it
9
- * under the terms and conditions of the GNU General Public License,
10
- * version 2, as published by the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope it will be useful, but WITHOUT
13
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15
- * more details.
16
- *
178 */
189
1910 #include <linux/module.h>
....@@ -113,24 +104,12 @@
113104
114105 static struct dentry *punit_dbg_file;
115106
116
-static int punit_dbgfs_register(struct punit_device *punit_device)
107
+static void punit_dbgfs_register(struct punit_device *punit_device)
117108 {
118
- static struct dentry *dev_state;
119
-
120109 punit_dbg_file = debugfs_create_dir("punit_atom", NULL);
121
- if (!punit_dbg_file)
122
- return -ENXIO;
123110
124
- dev_state = debugfs_create_file("dev_power_state", 0444,
125
- punit_dbg_file, punit_device,
126
- &punit_dev_state_fops);
127
- if (!dev_state) {
128
- pr_err("punit_dev_state register failed\n");
129
- debugfs_remove(punit_dbg_file);
130
- return -ENXIO;
131
- }
132
-
133
- return 0;
111
+ debugfs_create_file("dev_power_state", 0444, punit_dbg_file,
112
+ punit_device, &punit_dev_state_fops);
134113 }
135114
136115 static void punit_dbgfs_unregister(void)
....@@ -138,31 +117,27 @@
138117 debugfs_remove_recursive(punit_dbg_file);
139118 }
140119
141
-#define ICPU(model, drv_data) \
142
- { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT,\
143
- (kernel_ulong_t)&drv_data }
120
+#define X86_MATCH(model, data) \
121
+ X86_MATCH_VENDOR_FAM_MODEL_FEATURE(INTEL, 6, INTEL_FAM6_##model, \
122
+ X86_FEATURE_MWAIT, data)
144123
145124 static const struct x86_cpu_id intel_punit_cpu_ids[] = {
146
- ICPU(INTEL_FAM6_ATOM_SILVERMONT, punit_device_byt),
147
- ICPU(INTEL_FAM6_ATOM_SILVERMONT_MID, punit_device_tng),
148
- ICPU(INTEL_FAM6_ATOM_AIRMONT, punit_device_cht),
125
+ X86_MATCH(ATOM_SILVERMONT, &punit_device_byt),
126
+ X86_MATCH(ATOM_SILVERMONT_MID, &punit_device_tng),
127
+ X86_MATCH(ATOM_AIRMONT, &punit_device_cht),
149128 {}
150129 };
151
-
152130 MODULE_DEVICE_TABLE(x86cpu, intel_punit_cpu_ids);
153131
154132 static int __init punit_atom_debug_init(void)
155133 {
156134 const struct x86_cpu_id *id;
157
- int ret;
158135
159136 id = x86_match_cpu(intel_punit_cpu_ids);
160137 if (!id)
161138 return -ENODEV;
162139
163
- ret = punit_dbgfs_register((struct punit_device *)id->driver_data);
164
- if (ret < 0)
165
- return ret;
140
+ punit_dbgfs_register((struct punit_device *)id->driver_data);
166141
167142 return 0;
168143 }