| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2013-2016 Red Hat |
|---|
| 3 | 4 | * 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/>. |
|---|
| 16 | 5 | */ |
|---|
| 17 | 6 | |
|---|
| 18 | 7 | #ifdef CONFIG_DEBUG_FS |
|---|
| 8 | + |
|---|
| 19 | 9 | #include <linux/debugfs.h> |
|---|
| 10 | + |
|---|
| 11 | +#include <drm/drm_debugfs.h> |
|---|
| 12 | +#include <drm/drm_file.h> |
|---|
| 13 | + |
|---|
| 20 | 14 | #include "msm_drv.h" |
|---|
| 21 | 15 | #include "msm_gpu.h" |
|---|
| 22 | 16 | #include "msm_kms.h" |
|---|
| .. | .. |
|---|
| 71 | 65 | struct msm_gpu_show_priv *show_priv; |
|---|
| 72 | 66 | int ret; |
|---|
| 73 | 67 | |
|---|
| 74 | | - if (!gpu) |
|---|
| 68 | + if (!gpu || !gpu->funcs->gpu_state_get) |
|---|
| 75 | 69 | return -ENODEV; |
|---|
| 76 | 70 | |
|---|
| 77 | 71 | show_priv = kmalloc(sizeof(*show_priv), GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 198 | 192 | |
|---|
| 199 | 193 | ret = msm_rd_debugfs_init(minor); |
|---|
| 200 | 194 | 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"); |
|---|
| 202 | 196 | return ret; |
|---|
| 203 | 197 | } |
|---|
| 204 | 198 | |
|---|
| 205 | 199 | ret = msm_perf_debugfs_init(minor); |
|---|
| 206 | 200 | 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"); |
|---|
| 208 | 202 | return ret; |
|---|
| 209 | 203 | } |
|---|
| 210 | 204 | |
|---|
| .. | .. |
|---|
| 221 | 215 | return ret; |
|---|
| 222 | 216 | } |
|---|
| 223 | 217 | |
|---|
| 224 | | -int msm_debugfs_init(struct drm_minor *minor) |
|---|
| 218 | +void msm_debugfs_init(struct drm_minor *minor) |
|---|
| 225 | 219 | { |
|---|
| 226 | 220 | struct drm_device *dev = minor->dev; |
|---|
| 227 | 221 | struct msm_drm_private *priv = dev->dev_private; |
|---|
| 228 | | - int ret; |
|---|
| 229 | 222 | |
|---|
| 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); |
|---|
| 238 | 226 | |
|---|
| 239 | 227 | debugfs_create_file("gpu", S_IRUSR, minor->debugfs_root, |
|---|
| 240 | 228 | dev, &msm_gpu_fops); |
|---|
| 241 | 229 | |
|---|
| 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); |
|---|
| 249 | 232 | } |
|---|
| 250 | 233 | #endif |
|---|
| 251 | 234 | |
|---|