forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/gpu/drm/msm/msm_debugfs.c
....@@ -1,22 +1,16 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2013-2016 Red Hat
34 * Author: Rob Clark <robdclark@gmail.com>
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of the GNU General Public License version 2 as published by
7
- * the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along with
15
- * this program. If not, see <http://www.gnu.org/licenses/>.
165 */
176
187 #ifdef CONFIG_DEBUG_FS
8
+
199 #include <linux/debugfs.h>
10
+
11
+#include <drm/drm_debugfs.h>
12
+#include <drm/drm_file.h>
13
+
2014 #include "msm_drv.h"
2115 #include "msm_gpu.h"
2216 #include "msm_kms.h"
....@@ -71,7 +65,7 @@
7165 struct msm_gpu_show_priv *show_priv;
7266 int ret;
7367
74
- if (!gpu)
68
+ if (!gpu || !gpu->funcs->gpu_state_get)
7569 return -ENODEV;
7670
7771 show_priv = kmalloc(sizeof(*show_priv), GFP_KERNEL);
....@@ -198,13 +192,13 @@
198192
199193 ret = msm_rd_debugfs_init(minor);
200194 if (ret) {
201
- dev_err(minor->dev->dev, "could not install rd debugfs\n");
195
+ DRM_DEV_ERROR(minor->dev->dev, "could not install rd debugfs\n");
202196 return ret;
203197 }
204198
205199 ret = msm_perf_debugfs_init(minor);
206200 if (ret) {
207
- dev_err(minor->dev->dev, "could not install perf debugfs\n");
201
+ DRM_DEV_ERROR(minor->dev->dev, "could not install perf debugfs\n");
208202 return ret;
209203 }
210204
....@@ -221,31 +215,20 @@
221215 return ret;
222216 }
223217
224
-int msm_debugfs_init(struct drm_minor *minor)
218
+void msm_debugfs_init(struct drm_minor *minor)
225219 {
226220 struct drm_device *dev = minor->dev;
227221 struct msm_drm_private *priv = dev->dev_private;
228
- int ret;
229222
230
- ret = drm_debugfs_create_files(msm_debugfs_list,
231
- ARRAY_SIZE(msm_debugfs_list),
232
- minor->debugfs_root, minor);
233
-
234
- if (ret) {
235
- dev_err(dev->dev, "could not install msm_debugfs_list\n");
236
- return ret;
237
- }
223
+ drm_debugfs_create_files(msm_debugfs_list,
224
+ ARRAY_SIZE(msm_debugfs_list),
225
+ minor->debugfs_root, minor);
238226
239227 debugfs_create_file("gpu", S_IRUSR, minor->debugfs_root,
240228 dev, &msm_gpu_fops);
241229
242
- if (priv->kms->funcs->debugfs_init) {
243
- ret = priv->kms->funcs->debugfs_init(priv->kms, minor);
244
- if (ret)
245
- return ret;
246
- }
247
-
248
- return ret;
230
+ if (priv->kms && priv->kms->funcs->debugfs_init)
231
+ priv->kms->funcs->debugfs_init(priv->kms, minor);
249232 }
250233 #endif
251234