2020-03-10 13:32:26

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 00/17] drm: subsytem-wide debugfs functions refactor

This series includes work on various debugfs functions both in drm/core
and across various drivers in the subsystem.
Since commit 987d65d01356 (drm: debugfs: make drm_debugfs_create_files()
never fail), drm_debugfs_create_files() does not fail and only returns
zero. This series therefore removes the left over error handling and
checks for its return value across drm drivers.

As a result of these changes, most drm_debugfs functions are converted
to return void in this series. This also enables the
drm_driver, debugfs_init() hook to be changed to return void.

v2: individual driver patches have been converted to have debugfs
functions return 0 instead of void to prevent breaking individual driver
builds.
The last patch then converts the .debugfs_hook() and its users across
all drivers to return void.

Wambui Karuga (17):
drm/tegra: remove checks for debugfs functions return value
drm/tilcdc: remove check for return value of debugfs functions.
drm/v3d: make v3d_debugfs_init() return 0
drm/vc4: remove check of return value of drm_debugfs functions
drm/arc: make arcgpu_debugfs_init() return 0.
drm/arm: make hdlcd_debugfs_init() return 0
drm/etnaviv: remove check for return value of
drm_debugfs_create_files()
drm/msm: remove checks for return value of drm_debugfs_create_files()
drm/sti: remove use of drm_debugfs functions as return values
drm/vram-helper: make drm_vram_mm_debugfs_init() return 0
drm/nouveau: make nouveau_drm_debugfs_init() return 0
drm/pl111: make pl111_debugfs_init return 0
drm/omap: remove checks for return value of drm_debugfs functions
drm/i915: have *_debugfs_init() functions return void.
drm: make various debugfs_init() functions return 0
drm/debugfs: remove checks for return value of drm_debugfs functions.
drm: convert .debugfs_init() hook to return void.

drivers/gpu/drm/arc/arcpgu_drv.c | 7 +--
drivers/gpu/drm/arm/hdlcd_drv.c | 7 +--
drivers/gpu/drm/arm/malidp_drv.c | 3 +-
drivers/gpu/drm/drm_atomic.c | 8 ++--
drivers/gpu/drm/drm_client.c | 8 ++--
drivers/gpu/drm/drm_crtc_internal.h | 2 +-
drivers/gpu/drm/drm_debugfs.c | 45 +++++--------------
drivers/gpu/drm/drm_framebuffer.c | 8 ++--
drivers/gpu/drm/drm_gem_vram_helper.c | 14 ++----
drivers/gpu/drm/drm_internal.h | 2 +-
drivers/gpu/drm/drm_mipi_dbi.c | 6 +--
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 18 ++------
.../drm/i915/display/intel_display_debugfs.c | 8 ++--
.../drm/i915/display/intel_display_debugfs.h | 4 +-
drivers/gpu/drm/i915/i915_debugfs.c | 8 ++--
drivers/gpu/drm/i915/i915_debugfs.h | 4 +-
drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 18 +++-----
drivers/gpu/drm/msm/adreno/a5xx_gpu.h | 2 +-
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 14 ++----
drivers/gpu/drm/msm/msm_debugfs.c | 23 +++-------
drivers/gpu/drm/msm/msm_debugfs.h | 2 +-
drivers/gpu/drm/msm/msm_gpu.h | 2 +-
drivers/gpu/drm/nouveau/nouveau_debugfs.c | 26 +++++------
drivers/gpu/drm/nouveau/nouveau_debugfs.h | 8 ++--
drivers/gpu/drm/omapdrm/omap_debugfs.c | 29 +++---------
drivers/gpu/drm/omapdrm/omap_drv.h | 2 +-
drivers/gpu/drm/pl111/pl111_debugfs.c | 8 ++--
drivers/gpu/drm/pl111/pl111_drm.h | 2 +-
drivers/gpu/drm/qxl/qxl_debugfs.c | 21 +++------
drivers/gpu/drm/qxl/qxl_drv.h | 13 +++---
drivers/gpu/drm/qxl/qxl_ttm.c | 6 +--
drivers/gpu/drm/sti/sti_compositor.c | 6 +--
drivers/gpu/drm/sti/sti_compositor.h | 4 +-
drivers/gpu/drm/sti/sti_crtc.c | 2 +-
drivers/gpu/drm/sti/sti_cursor.c | 14 +++---
drivers/gpu/drm/sti/sti_drv.c | 16 ++-----
drivers/gpu/drm/sti/sti_dvo.c | 13 +++---
drivers/gpu/drm/sti/sti_gdp.c | 7 +--
drivers/gpu/drm/sti/sti_hda.c | 13 +++---
drivers/gpu/drm/sti/sti_hdmi.c | 13 +++---
drivers/gpu/drm/sti/sti_hqvdp.c | 12 ++---
drivers/gpu/drm/sti/sti_mixer.c | 10 ++---
drivers/gpu/drm/sti/sti_mixer.h | 2 +-
drivers/gpu/drm/sti/sti_tvout.c | 13 +++---
drivers/gpu/drm/sti/sti_vid.c | 8 ++--
drivers/gpu/drm/sti/sti_vid.h | 2 +-
drivers/gpu/drm/tegra/dc.c | 11 +----
drivers/gpu/drm/tegra/drm.c | 8 ++--
drivers/gpu/drm/tegra/dsi.c | 11 +----
drivers/gpu/drm/tegra/hdmi.c | 11 +----
drivers/gpu/drm/tegra/sor.c | 11 +----
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 17 ++-----
drivers/gpu/drm/v3d/v3d_debugfs.c | 8 ++--
drivers/gpu/drm/v3d/v3d_drv.h | 2 +-
drivers/gpu/drm/vc4/vc4_debugfs.c | 11 ++---
drivers/gpu/drm/vc4/vc4_drv.h | 2 +-
drivers/gpu/drm/virtio/virtgpu_debugfs.c | 3 +-
drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
include/drm/drm_client.h | 2 +-
include/drm/drm_debugfs.h | 16 +++----
include/drm/drm_drv.h | 2 +-
include/drm/drm_gem_vram_helper.h | 2 +-
include/drm/drm_mipi_dbi.h | 2 +-
63 files changed, 204 insertions(+), 380 deletions(-)

--
2.25.1


2020-03-10 13:32:31

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 03/17] drm/v3d: make v3d_debugfs_init() return 0

Since commit 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
fails and should return void. Therefore, remove its use as the
return value of v3d_debugfs_init() and have the function return 0
directly instead.

v2: remove conversion of v3d_debugfs_init() to void to avoid build
breakage and enable individual compilation.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/v3d/v3d_debugfs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c b/drivers/gpu/drm/v3d/v3d_debugfs.c
index 9e953ce64ef7..57dded6a3957 100644
--- a/drivers/gpu/drm/v3d/v3d_debugfs.c
+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
@@ -261,7 +261,8 @@ static const struct drm_info_list v3d_debugfs_list[] = {
int
v3d_debugfs_init(struct drm_minor *minor)
{
- return drm_debugfs_create_files(v3d_debugfs_list,
- ARRAY_SIZE(v3d_debugfs_list),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(v3d_debugfs_list,
+ ARRAY_SIZE(v3d_debugfs_list),
+ minor->debugfs_root, minor);
+ return 0;
}
--
2.25.1

2020-03-10 13:32:38

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 06/17] drm/arm: make hdlcd_debugfs_init() return 0

Since commit 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
fails and should return void. Therefore, remove its use as the
return value of hdlcd_debugfs_init() and have the latter function return
0 directly.

v2: make hdlcd_debugfs_init() return 0 instead of void to ensure that
each patch compiles individually.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/arm/hdlcd_drv.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 2e053815b54a..bd0ad6f46a97 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -226,8 +226,10 @@ static struct drm_info_list hdlcd_debugfs_list[] = {

static int hdlcd_debugfs_init(struct drm_minor *minor)
{
- return drm_debugfs_create_files(hdlcd_debugfs_list,
- ARRAY_SIZE(hdlcd_debugfs_list), minor->debugfs_root, minor);
+ drm_debugfs_create_files(hdlcd_debugfs_list,
+ ARRAY_SIZE(hdlcd_debugfs_list),
+ minor->debugfs_root, minor);
+ return 0;
}
#endif

--
2.25.1

2020-03-10 13:32:41

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 07/17] drm/etnaviv: remove check for return value of drm_debugfs_create_files()

Since commit 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
fails and only returns 0. Therefore, remove the unnecessary check of its
return value and error handling in etnaviv_debugfs_init() and have the
function return 0 directly.

v2: have etnaviv_debugfs_init() return 0 instead of void to ensure
individual compilation and avoid build breakage.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 6b43c1c94e8f..a65d30a48a9d 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -233,19 +233,11 @@ static struct drm_info_list etnaviv_debugfs_list[] = {

static int etnaviv_debugfs_init(struct drm_minor *minor)
{
- struct drm_device *dev = minor->dev;
- int ret;
-
- ret = drm_debugfs_create_files(etnaviv_debugfs_list,
- ARRAY_SIZE(etnaviv_debugfs_list),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(etnaviv_debugfs_list,
+ ARRAY_SIZE(etnaviv_debugfs_list),
+ minor->debugfs_root, minor);

- if (ret) {
- dev_err(dev->dev, "could not install etnaviv_debugfs_list\n");
- return ret;
- }
-
- return ret;
+ return 0;
}
#endif

--
2.25.1

2020-03-10 13:32:47

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 08/17] drm/msm: remove checks for return value of drm_debugfs_create_files()

Since commit 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), drm_debugfs_create_files never
fails and only returns 0. Therefore, the unnecessary checks for its
return value and error handling in various debugfs_init() functions in
drm/msm and have the functions return 0 directly.

v2: have debug functions return 0 instead of void to avoid build
breakage and ensure standalone compilation.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 12 +++---------
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 14 +++-----------
drivers/gpu/drm/msm/msm_debugfs.c | 13 ++++---------
3 files changed, 10 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c b/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
index 075ecce4b5e0..011ab6353dbb 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
@@ -151,21 +151,15 @@ DEFINE_SIMPLE_ATTRIBUTE(reset_fops, NULL, reset_set, "%llx\n");
int a5xx_debugfs_init(struct msm_gpu *gpu, struct drm_minor *minor)
{
struct drm_device *dev;
- int ret;

if (!minor)
return 0;

dev = minor->dev;

- ret = drm_debugfs_create_files(a5xx_debugfs_list,
- ARRAY_SIZE(a5xx_debugfs_list),
- minor->debugfs_root, minor);
-
- if (ret) {
- DRM_DEV_ERROR(dev->dev, "could not install a5xx_debugfs_list\n");
- return ret;
- }
+ drm_debugfs_create_files(a5xx_debugfs_list,
+ ARRAY_SIZE(a5xx_debugfs_list),
+ minor->debugfs_root, minor);

debugfs_create_file("reset", S_IWUGO, minor->debugfs_root, dev,
&reset_fops);
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 6650f478b226..41b461128bbc 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -259,17 +259,9 @@ static struct drm_info_list mdp5_debugfs_list[] = {

static int mdp5_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
{
- struct drm_device *dev = minor->dev;
- int ret;
-
- ret = drm_debugfs_create_files(mdp5_debugfs_list,
- ARRAY_SIZE(mdp5_debugfs_list),
- minor->debugfs_root, minor);
-
- if (ret) {
- DRM_DEV_ERROR(dev->dev, "could not install mdp5_debugfs_list\n");
- return ret;
- }
+ drm_debugfs_create_files(mdp5_debugfs_list,
+ ARRAY_SIZE(mdp5_debugfs_list),
+ minor->debugfs_root, minor);

return 0;
}
diff --git a/drivers/gpu/drm/msm/msm_debugfs.c b/drivers/gpu/drm/msm/msm_debugfs.c
index 1c74381a4fc9..6378157e1fff 100644
--- a/drivers/gpu/drm/msm/msm_debugfs.c
+++ b/drivers/gpu/drm/msm/msm_debugfs.c
@@ -220,14 +220,9 @@ int msm_debugfs_init(struct drm_minor *minor)
struct msm_drm_private *priv = dev->dev_private;
int ret;

- ret = drm_debugfs_create_files(msm_debugfs_list,
- ARRAY_SIZE(msm_debugfs_list),
- minor->debugfs_root, minor);
-
- if (ret) {
- DRM_DEV_ERROR(dev->dev, "could not install msm_debugfs_list\n");
- return ret;
- }
+ drm_debugfs_create_files(msm_debugfs_list,
+ ARRAY_SIZE(msm_debugfs_list),
+ minor->debugfs_root, minor);

debugfs_create_file("gpu", S_IRUSR, minor->debugfs_root,
dev, &msm_gpu_fops);
@@ -238,7 +233,7 @@ int msm_debugfs_init(struct drm_minor *minor)
return ret;
}

- return ret;
+ return 0;
}
#endif

--
2.25.1

2020-03-10 13:32:55

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 10/17] drm/vram-helper: make drm_vram_mm_debugfs_init() return 0

Since 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
fails and should return void. Therefore, remove its use as the
return value of drm_vram_mm_debugfs_init(), and have the function
return 0 directly.

v2: have drm_vram_mm_debugfs_init() return 0 instead of void to avoid
introducing build issues and build breakage.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
Acked-by: Thomas Zimmermann <[email protected]>
---
drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
index 92a11bb42365..c8bcc8609650 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -1048,14 +1048,12 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = {
*/
int drm_vram_mm_debugfs_init(struct drm_minor *minor)
{
- int ret = 0;
-
#if defined(CONFIG_DEBUG_FS)
- ret = drm_debugfs_create_files(drm_vram_mm_debugfs_list,
- ARRAY_SIZE(drm_vram_mm_debugfs_list),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(drm_vram_mm_debugfs_list,
+ ARRAY_SIZE(drm_vram_mm_debugfs_list),
+ minor->debugfs_root, minor);
#endif
- return ret;
+ return 0;
}
EXPORT_SYMBOL(drm_vram_mm_debugfs_init);

--
2.25.1

2020-03-10 13:33:09

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 16/17] drm/debugfs: remove checks for return value of drm_debugfs functions.

Since 987d65d01356 (drm: debugfs: make drm_debugfs_create_files() never
fail), there is no need to check the return value of
drm_debugfs_create_files(). Therefore, remove remove unnecessary checks
and error handling statement blocks for its return value.

These changes also enable changing drm_debugfs_create_files() to return
void.

Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/drm_debugfs.c | 33 +++++++--------------------------
include/drm/drm_debugfs.h | 16 +++++++---------
2 files changed, 14 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 4e673d318503..e13f21642f88 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -172,8 +172,8 @@ static const struct file_operations drm_debugfs_fops = {
* &struct drm_info_list in the given root directory. These files will be removed
* automatically on drm_debugfs_cleanup().
*/
-int drm_debugfs_create_files(const struct drm_info_list *files, int count,
- struct dentry *root, struct drm_minor *minor)
+void drm_debugfs_create_files(const struct drm_info_list *files, int count,
+ struct dentry *root, struct drm_minor *minor)
{
struct drm_device *dev = minor->dev;
struct drm_info_node *tmp;
@@ -199,7 +199,6 @@ int drm_debugfs_create_files(const struct drm_info_list *files, int count,
list_add(&tmp->list, &minor->debugfs_list);
mutex_unlock(&minor->debugfs_lock);
}
- return 0;
}
EXPORT_SYMBOL(drm_debugfs_create_files);

@@ -215,35 +214,17 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
sprintf(name, "%d", minor_id);
minor->debugfs_root = debugfs_create_dir(name, root);

- ret = drm_debugfs_create_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES,
- minor->debugfs_root, minor);
- if (ret) {
- debugfs_remove(minor->debugfs_root);
- minor->debugfs_root = NULL;
- DRM_ERROR("Failed to create core drm debugfs files\n");
- return ret;
- }
+ drm_debugfs_create_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES,
+ minor->debugfs_root, minor);

if (drm_drv_uses_atomic_modeset(dev)) {
- ret = drm_atomic_debugfs_init(minor);
- if (ret) {
- DRM_ERROR("Failed to create atomic debugfs files\n");
- return ret;
- }
+ drm_atomic_debugfs_init(minor);
}

if (drm_core_check_feature(dev, DRIVER_MODESET)) {
- ret = drm_framebuffer_debugfs_init(minor);
- if (ret) {
- DRM_ERROR("Failed to create framebuffer debugfs file\n");
- return ret;
- }
+ drm_framebuffer_debugfs_init(minor);

- ret = drm_client_debugfs_init(minor);
- if (ret) {
- DRM_ERROR("Failed to create client debugfs file\n");
- return ret;
- }
+ drm_client_debugfs_init(minor);
}

if (dev->driver->debugfs_init) {
diff --git a/include/drm/drm_debugfs.h b/include/drm/drm_debugfs.h
index 7501e323d383..2188dc83957f 100644
--- a/include/drm/drm_debugfs.h
+++ b/include/drm/drm_debugfs.h
@@ -80,18 +80,16 @@ struct drm_info_node {
};

#if defined(CONFIG_DEBUG_FS)
-int drm_debugfs_create_files(const struct drm_info_list *files,
- int count, struct dentry *root,
- struct drm_minor *minor);
+void drm_debugfs_create_files(const struct drm_info_list *files,
+ int count, struct dentry *root,
+ struct drm_minor *minor);
int drm_debugfs_remove_files(const struct drm_info_list *files,
int count, struct drm_minor *minor);
#else
-static inline int drm_debugfs_create_files(const struct drm_info_list *files,
- int count, struct dentry *root,
- struct drm_minor *minor)
-{
- return 0;
-}
+static inline void drm_debugfs_create_files(const struct drm_info_list *files,
+ int count, struct dentry *root,
+ struct drm_minor *minor)
+{}

static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
int count, struct drm_minor *minor)
--
2.25.1

2020-03-10 13:33:14

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 17/17] drm: convert .debugfs_init() hook to return void.

As a result of commit 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail) and changes to various debugfs
functions in drm/core and across various drivers, there is no need for
the drm_driver.debugfs_init() hook to have a return value. Therefore,
declare it as void.

This also includes refactoring all users of the .debugfs_init() hook to
return void across the subsystem.

v2: include changes to the hook and drivers that use it in one patch to
prevent driver breakage and enable individual successful compilation of
this change.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/arc/arcpgu_drv.c | 3 +--
drivers/gpu/drm/arm/hdlcd_drv.c | 3 +--
drivers/gpu/drm/arm/malidp_drv.c | 3 +--
drivers/gpu/drm/drm_atomic.c | 3 +--
drivers/gpu/drm/drm_client.c | 4 +---
drivers/gpu/drm/drm_crtc_internal.h | 2 +-
drivers/gpu/drm/drm_debugfs.c | 12 +++---------
drivers/gpu/drm/drm_framebuffer.c | 4 +---
drivers/gpu/drm/drm_gem_vram_helper.c | 6 +-----
drivers/gpu/drm/drm_internal.h | 2 +-
drivers/gpu/drm/drm_mipi_dbi.c | 6 +-----
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 4 +---
drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 6 ++----
drivers/gpu/drm/msm/adreno/a5xx_gpu.h | 2 +-
drivers/gpu/drm/msm/msm_debugfs.c | 12 +++---------
drivers/gpu/drm/msm/msm_debugfs.h | 2 +-
drivers/gpu/drm/msm/msm_gpu.h | 2 +-
drivers/gpu/drm/nouveau/nouveau_debugfs.c | 6 ++----
drivers/gpu/drm/nouveau/nouveau_debugfs.h | 8 +++-----
drivers/gpu/drm/omapdrm/omap_debugfs.c | 4 +---
drivers/gpu/drm/omapdrm/omap_drv.h | 2 +-
drivers/gpu/drm/pl111/pl111_debugfs.c | 4 +---
drivers/gpu/drm/pl111/pl111_drm.h | 2 +-
drivers/gpu/drm/qxl/qxl_debugfs.c | 21 +++++++--------------
drivers/gpu/drm/qxl/qxl_drv.h | 13 +++++--------
drivers/gpu/drm/qxl/qxl_ttm.c | 6 ++----
drivers/gpu/drm/sti/sti_drv.c | 3 +--
drivers/gpu/drm/tegra/drm.c | 3 +--
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 4 +---
drivers/gpu/drm/v3d/v3d_debugfs.c | 3 +--
drivers/gpu/drm/v3d/v3d_drv.h | 2 +-
drivers/gpu/drm/vc4/vc4_debugfs.c | 4 +---
drivers/gpu/drm/vc4/vc4_drv.h | 2 +-
drivers/gpu/drm/virtio/virtgpu_debugfs.c | 3 +--
drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +-
include/drm/drm_client.h | 2 +-
include/drm/drm_drv.h | 2 +-
include/drm/drm_gem_vram_helper.h | 2 +-
include/drm/drm_mipi_dbi.h | 2 +-
39 files changed, 58 insertions(+), 118 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index 660b25f9588e..c05d001163e0 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -137,12 +137,11 @@ static struct drm_info_list arcpgu_debugfs_list[] = {
{ "clocks", arcpgu_show_pxlclock, 0 },
};

-static int arcpgu_debugfs_init(struct drm_minor *minor)
+static void arcpgu_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(arcpgu_debugfs_list,
ARRAY_SIZE(arcpgu_debugfs_list),
minor->debugfs_root, minor);
- return 0;
}
#endif

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index bd0ad6f46a97..194419f47c5e 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -224,12 +224,11 @@ static struct drm_info_list hdlcd_debugfs_list[] = {
{ "clocks", hdlcd_show_pxlclock, 0 },
};

-static int hdlcd_debugfs_init(struct drm_minor *minor)
+static void hdlcd_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(hdlcd_debugfs_list,
ARRAY_SIZE(hdlcd_debugfs_list),
minor->debugfs_root, minor);
- return 0;
}
#endif

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 37d92a06318e..def8c9ffafca 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -548,7 +548,7 @@ static const struct file_operations malidp_debugfs_fops = {
.release = single_release,
};

-static int malidp_debugfs_init(struct drm_minor *minor)
+static void malidp_debugfs_init(struct drm_minor *minor)
{
struct malidp_drm *malidp = minor->dev->dev_private;

@@ -557,7 +557,6 @@ static int malidp_debugfs_init(struct drm_minor *minor)
spin_lock_init(&malidp->errors_lock);
debugfs_create_file("debug", S_IRUGO | S_IWUSR, minor->debugfs_root,
minor->dev, &malidp_debugfs_fops);
- return 0;
}

#endif //CONFIG_DEBUG_FS
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index c0056d9cc139..965173fd0ac2 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1641,11 +1641,10 @@ static const struct drm_info_list drm_atomic_debugfs_list[] = {
{"state", drm_state_info, 0},
};

-int drm_atomic_debugfs_init(struct drm_minor *minor)
+void drm_atomic_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(drm_atomic_debugfs_list,
ARRAY_SIZE(drm_atomic_debugfs_list),
minor->debugfs_root, minor);
- return 0;
}
#endif
diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index 82fbdee407b2..8cb93f5209a4 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -457,12 +457,10 @@ static const struct drm_info_list drm_client_debugfs_list[] = {
{ "internal_clients", drm_client_debugfs_internal_clients, 0 },
};

-int drm_client_debugfs_init(struct drm_minor *minor)
+void drm_client_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(drm_client_debugfs_list,
ARRAY_SIZE(drm_client_debugfs_list),
minor->debugfs_root, minor);
-
- return 0;
}
#endif
diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
index 16f2413403aa..1b620ba9244b 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -224,7 +224,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
/* drm_atomic.c */
#ifdef CONFIG_DEBUG_FS
struct drm_minor;
-int drm_atomic_debugfs_init(struct drm_minor *minor);
+void drm_atomic_debugfs_init(struct drm_minor *minor);
#endif

int __drm_atomic_helper_disable_plane(struct drm_plane *plane,
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index e13f21642f88..2bea22130703 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -207,7 +207,6 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
{
struct drm_device *dev = minor->dev;
char name[64];
- int ret;

INIT_LIST_HEAD(&minor->debugfs_list);
mutex_init(&minor->debugfs_lock);
@@ -227,14 +226,9 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
drm_client_debugfs_init(minor);
}

- if (dev->driver->debugfs_init) {
- ret = dev->driver->debugfs_init(minor);
- if (ret) {
- DRM_ERROR("DRM: Driver failed to initialize "
- "/sys/kernel/debug/dri.\n");
- return ret;
- }
- }
+ if (dev->driver->debugfs_init)
+ dev->driver->debugfs_init(minor);
+
return 0;
}

diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 46be88271fe5..0375b3d7f8d0 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -1207,12 +1207,10 @@ static const struct drm_info_list drm_framebuffer_debugfs_list[] = {
{ "framebuffer", drm_framebuffer_info, 0 },
};

-int drm_framebuffer_debugfs_init(struct drm_minor *minor)
+void drm_framebuffer_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(drm_framebuffer_debugfs_list,
ARRAY_SIZE(drm_framebuffer_debugfs_list),
minor->debugfs_root, minor);
-
- return 0;
}
#endif
diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
index c8bcc8609650..76506bedac11 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -1042,18 +1042,14 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = {
*
* @minor: drm minor device.
*
- * Returns:
- * 0 on success, or
- * a negative error code otherwise.
*/
-int drm_vram_mm_debugfs_init(struct drm_minor *minor)
+void drm_vram_mm_debugfs_init(struct drm_minor *minor)
{
#if defined(CONFIG_DEBUG_FS)
drm_debugfs_create_files(drm_vram_mm_debugfs_list,
ARRAY_SIZE(drm_vram_mm_debugfs_list),
minor->debugfs_root, minor);
#endif
- return 0;
}
EXPORT_SYMBOL(drm_vram_mm_debugfs_init);

diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index 5714a78365ac..8b9e8bbca9b1 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -235,4 +235,4 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
/* drm_framebuffer.c */
void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_framebuffer *fb);
-int drm_framebuffer_debugfs_init(struct drm_minor *minor);
+void drm_framebuffer_debugfs_init(struct drm_minor *minor);
diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index 558baf989f5a..113a767442d3 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -1308,10 +1308,8 @@ static const struct file_operations mipi_dbi_debugfs_command_fops = {
* controller or getting the read command values.
* Drivers can use this as their &drm_driver->debugfs_init callback.
*
- * Returns:
- * Zero on success, negative error code on failure.
*/
-int mipi_dbi_debugfs_init(struct drm_minor *minor)
+void mipi_dbi_debugfs_init(struct drm_minor *minor)
{
struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(minor->dev);
umode_t mode = S_IFREG | S_IWUSR;
@@ -1320,8 +1318,6 @@ int mipi_dbi_debugfs_init(struct drm_minor *minor)
mode |= S_IRUGO;
debugfs_create_file("command", mode, minor->debugfs_root, dbidev,
&mipi_dbi_debugfs_command_fops);
-
- return 0;
}
EXPORT_SYMBOL(mipi_dbi_debugfs_init);

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index a65d30a48a9d..a39735316ca5 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -231,13 +231,11 @@ static struct drm_info_list etnaviv_debugfs_list[] = {
{"ring", show_each_gpu, 0, etnaviv_ring_show},
};

-static int etnaviv_debugfs_init(struct drm_minor *minor)
+static void etnaviv_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(etnaviv_debugfs_list,
ARRAY_SIZE(etnaviv_debugfs_list),
minor->debugfs_root, minor);
-
- return 0;
}
#endif

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c b/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
index 011ab6353dbb..8cae2ca4af6b 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_debugfs.c
@@ -148,12 +148,12 @@ reset_set(void *data, u64 val)
DEFINE_SIMPLE_ATTRIBUTE(reset_fops, NULL, reset_set, "%llx\n");


-int a5xx_debugfs_init(struct msm_gpu *gpu, struct drm_minor *minor)
+void a5xx_debugfs_init(struct msm_gpu *gpu, struct drm_minor *minor)
{
struct drm_device *dev;

if (!minor)
- return 0;
+ return;

dev = minor->dev;

@@ -163,6 +163,4 @@ int a5xx_debugfs_init(struct msm_gpu *gpu, struct drm_minor *minor)

debugfs_create_file("reset", S_IWUGO, minor->debugfs_root, dev,
&reset_fops);
-
- return 0;
}
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.h b/drivers/gpu/drm/msm/adreno/a5xx_gpu.h
index 833468ce6b6d..54868d4e3958 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.h
@@ -41,7 +41,7 @@ struct a5xx_gpu {
#define to_a5xx_gpu(x) container_of(x, struct a5xx_gpu, base)

#ifdef CONFIG_DEBUG_FS
-int a5xx_debugfs_init(struct msm_gpu *gpu, struct drm_minor *minor);
+void a5xx_debugfs_init(struct msm_gpu *gpu, struct drm_minor *minor);
#endif

/*
diff --git a/drivers/gpu/drm/msm/msm_debugfs.c b/drivers/gpu/drm/msm/msm_debugfs.c
index 6378157e1fff..ee2e270f464c 100644
--- a/drivers/gpu/drm/msm/msm_debugfs.c
+++ b/drivers/gpu/drm/msm/msm_debugfs.c
@@ -214,11 +214,10 @@ int msm_debugfs_late_init(struct drm_device *dev)
return ret;
}

-int msm_debugfs_init(struct drm_minor *minor)
+void msm_debugfs_init(struct drm_minor *minor)
{
struct drm_device *dev = minor->dev;
struct msm_drm_private *priv = dev->dev_private;
- int ret;

drm_debugfs_create_files(msm_debugfs_list,
ARRAY_SIZE(msm_debugfs_list),
@@ -227,13 +226,8 @@ int msm_debugfs_init(struct drm_minor *minor)
debugfs_create_file("gpu", S_IRUSR, minor->debugfs_root,
dev, &msm_gpu_fops);

- if (priv->kms && priv->kms->funcs->debugfs_init) {
- ret = priv->kms->funcs->debugfs_init(priv->kms, minor);
- if (ret)
- return ret;
- }
-
- return 0;
+ if (priv->kms && priv->kms->funcs->debugfs_init)
+ priv->kms->funcs->debugfs_init(priv->kms, minor);
}
#endif

diff --git a/drivers/gpu/drm/msm/msm_debugfs.h b/drivers/gpu/drm/msm/msm_debugfs.h
index 2b91f8c178ad..ef58f66abbb3 100644
--- a/drivers/gpu/drm/msm/msm_debugfs.h
+++ b/drivers/gpu/drm/msm/msm_debugfs.h
@@ -8,7 +8,7 @@
#define __MSM_DEBUGFS_H__

#ifdef CONFIG_DEBUG_FS
-int msm_debugfs_init(struct drm_minor *minor);
+void msm_debugfs_init(struct drm_minor *minor);
#endif

#endif /* __MSM_DEBUGFS_H__ */
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index be5bc2e8425c..6ccae4ba905c 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -57,7 +57,7 @@ struct msm_gpu_funcs {
void (*show)(struct msm_gpu *gpu, struct msm_gpu_state *state,
struct drm_printer *p);
/* for generation specific debugfs: */
- int (*debugfs_init)(struct msm_gpu *gpu, struct drm_minor *minor);
+ void (*debugfs_init)(struct msm_gpu *gpu, struct drm_minor *minor);
#endif
unsigned long (*gpu_busy)(struct msm_gpu *gpu);
struct msm_gpu_state *(*gpu_state_get)(struct msm_gpu *gpu);
diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
index 15a3d40edf02..63cb5e432f8a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
@@ -217,7 +217,7 @@ static const struct nouveau_debugfs_files {
{"pstate", &nouveau_pstate_fops},
};

-int
+void
nouveau_drm_debugfs_init(struct drm_minor *minor)
{
struct nouveau_drm *drm = nouveau_drm(minor->dev);
@@ -240,12 +240,10 @@ nouveau_drm_debugfs_init(struct drm_minor *minor)
*/
dentry = debugfs_lookup("vbios.rom", minor->debugfs_root);
if (!dentry)
- return 0;
+ return;

d_inode(dentry)->i_size = drm->vbios.length;
dput(dentry);
-
- return 0;
}

int
diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.h b/drivers/gpu/drm/nouveau/nouveau_debugfs.h
index 8909c010e8ea..77f0323b38ba 100644
--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.h
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.h
@@ -18,15 +18,13 @@ nouveau_debugfs(struct drm_device *dev)
return nouveau_drm(dev)->debugfs;
}

-extern int nouveau_drm_debugfs_init(struct drm_minor *);
+extern void nouveau_drm_debugfs_init(struct drm_minor *);
extern int nouveau_debugfs_init(struct nouveau_drm *);
extern void nouveau_debugfs_fini(struct nouveau_drm *);
#else
-static inline int
+static inline void
nouveau_drm_debugfs_init(struct drm_minor *minor)
-{
- return 0;
-}
+{}

static inline int
nouveau_debugfs_init(struct nouveau_drm *drm)
diff --git a/drivers/gpu/drm/omapdrm/omap_debugfs.c b/drivers/gpu/drm/omapdrm/omap_debugfs.c
index ed63dcced79a..b57fbe8a0ac2 100644
--- a/drivers/gpu/drm/omapdrm/omap_debugfs.c
+++ b/drivers/gpu/drm/omapdrm/omap_debugfs.c
@@ -80,7 +80,7 @@ static struct drm_info_list omap_dmm_debugfs_list[] = {
{"tiler_map", tiler_map_show, 0},
};

-int omap_debugfs_init(struct drm_minor *minor)
+void omap_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(omap_debugfs_list,
ARRAY_SIZE(omap_debugfs_list),
@@ -90,8 +90,6 @@ int omap_debugfs_init(struct drm_minor *minor)
drm_debugfs_create_files(omap_dmm_debugfs_list,
ARRAY_SIZE(omap_dmm_debugfs_list),
minor->debugfs_root, minor);
-
- return 0;
}

#endif
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 7c4b66efcaa7..8a1fac680138 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -82,6 +82,6 @@ struct omap_drm_private {
};


-int omap_debugfs_init(struct drm_minor *minor);
+void omap_debugfs_init(struct drm_minor *minor);

#endif /* __OMAPDRM_DRV_H__ */
diff --git a/drivers/gpu/drm/pl111/pl111_debugfs.c b/drivers/gpu/drm/pl111/pl111_debugfs.c
index 5595b19c91ce..26ca8cdf3e60 100644
--- a/drivers/gpu/drm/pl111/pl111_debugfs.c
+++ b/drivers/gpu/drm/pl111/pl111_debugfs.c
@@ -51,12 +51,10 @@ static const struct drm_info_list pl111_debugfs_list[] = {
{"regs", pl111_debugfs_regs, 0},
};

-int
+void
pl111_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(pl111_debugfs_list,
ARRAY_SIZE(pl111_debugfs_list),
minor->debugfs_root, minor);
-
- return 0;
}
diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h
index 77d2da9a8a7c..ba399bcb792f 100644
--- a/drivers/gpu/drm/pl111/pl111_drm.h
+++ b/drivers/gpu/drm/pl111/pl111_drm.h
@@ -84,6 +84,6 @@ struct pl111_drm_dev_private {

int pl111_display_init(struct drm_device *dev);
irqreturn_t pl111_irq(int irq, void *data);
-int pl111_debugfs_init(struct drm_minor *minor);
+void pl111_debugfs_init(struct drm_minor *minor);

#endif /* _PL111_DRM_H_ */
diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c b/drivers/gpu/drm/qxl/qxl_debugfs.c
index a4f4175bbdbe..88123047fdd4 100644
--- a/drivers/gpu/drm/qxl/qxl_debugfs.c
+++ b/drivers/gpu/drm/qxl/qxl_debugfs.c
@@ -79,36 +79,30 @@ static struct drm_info_list qxl_debugfs_list[] = {
#define QXL_DEBUGFS_ENTRIES ARRAY_SIZE(qxl_debugfs_list)
#endif

-int
+void
qxl_debugfs_init(struct drm_minor *minor)
{
#if defined(CONFIG_DEBUG_FS)
- int r;
struct qxl_device *dev =
(struct qxl_device *) minor->dev->dev_private;

drm_debugfs_create_files(qxl_debugfs_list, QXL_DEBUGFS_ENTRIES,
minor->debugfs_root, minor);

- r = qxl_ttm_debugfs_init(dev);
- if (r) {
- DRM_ERROR("Failed to init TTM debugfs\n");
- return r;
- }
+ qxl_ttm_debugfs_init(dev);
#endif
- return 0;
}

-int qxl_debugfs_add_files(struct qxl_device *qdev,
- struct drm_info_list *files,
- unsigned int nfiles)
+void qxl_debugfs_add_files(struct qxl_device *qdev,
+ struct drm_info_list *files,
+ unsigned int nfiles)
{
unsigned int i;

for (i = 0; i < qdev->debugfs_count; i++) {
if (qdev->debugfs[i].files == files) {
/* Already registered */
- return 0;
+ return;
}
}

@@ -116,7 +110,7 @@ int qxl_debugfs_add_files(struct qxl_device *qdev,
if (i > QXL_DEBUGFS_MAX_COMPONENTS) {
DRM_ERROR("Reached maximum number of debugfs components.\n");
DRM_ERROR("Report so we increase QXL_DEBUGFS_MAX_COMPONENTS.\n");
- return -EINVAL;
+ return;
}
qdev->debugfs[qdev->debugfs_count].files = files;
qdev->debugfs[qdev->debugfs_count].num_files = nfiles;
@@ -126,5 +120,4 @@ int qxl_debugfs_add_files(struct qxl_device *qdev,
qdev->ddev.primary->debugfs_root,
qdev->ddev.primary);
#endif
- return 0;
}
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index 27e45a2d6b52..435126facc9b 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -190,9 +190,6 @@ struct qxl_debugfs {
unsigned int num_files;
};

-int qxl_debugfs_add_files(struct qxl_device *rdev,
- struct drm_info_list *files,
- unsigned int nfiles);
int qxl_debugfs_fence_init(struct qxl_device *rdev);

struct qxl_device;
@@ -442,8 +439,8 @@ int qxl_garbage_collect(struct qxl_device *qdev);

/* debugfs */

-int qxl_debugfs_init(struct drm_minor *minor);
-int qxl_ttm_debugfs_init(struct qxl_device *qdev);
+void qxl_debugfs_init(struct drm_minor *minor);
+void qxl_ttm_debugfs_init(struct qxl_device *qdev);

/* qxl_prime.c */
int qxl_gem_prime_pin(struct drm_gem_object *obj);
@@ -461,9 +458,9 @@ int qxl_gem_prime_mmap(struct drm_gem_object *obj,
int qxl_irq_init(struct qxl_device *qdev);
irqreturn_t qxl_irq_handler(int irq, void *arg);

-int qxl_debugfs_add_files(struct qxl_device *qdev,
- struct drm_info_list *files,
- unsigned int nfiles);
+void qxl_debugfs_add_files(struct qxl_device *qdev,
+ struct drm_info_list *files,
+ unsigned int nfiles);

int qxl_surface_id_alloc(struct qxl_device *qdev,
struct qxl_bo *surf);
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index 62a5e424971b..93a2eb14844b 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -322,7 +322,7 @@ static int qxl_mm_dump_table(struct seq_file *m, void *data)
}
#endif

-int qxl_ttm_debugfs_init(struct qxl_device *qdev)
+void qxl_ttm_debugfs_init(struct qxl_device *qdev)
{
#if defined(CONFIG_DEBUG_FS)
static struct drm_info_list qxl_mem_types_list[QXL_DEBUGFS_MEM_TYPES];
@@ -343,8 +343,6 @@ int qxl_ttm_debugfs_init(struct qxl_device *qdev)
qxl_mem_types_list[i].data = qdev->mman.bdev.man[TTM_PL_PRIV].priv;

}
- return qxl_debugfs_add_files(qdev, qxl_mem_types_list, i);
-#else
- return 0;
+ qxl_debugfs_add_files(qdev, qxl_mem_types_list, i);
#endif
}
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 5ab36f6001fc..3f9db3e3f397 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -92,7 +92,7 @@ static struct drm_info_list sti_drm_dbg_list[] = {
{"fps_get", sti_drm_fps_dbg_show, 0},
};

-static int sti_drm_dbg_init(struct drm_minor *minor)
+static void sti_drm_dbg_init(struct drm_minor *minor)
{
drm_debugfs_create_files(sti_drm_dbg_list,
ARRAY_SIZE(sti_drm_dbg_list),
@@ -102,7 +102,6 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
minor->dev, &sti_drm_fps_fops);

DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
- return 0;
}

static const struct drm_mode_config_funcs sti_mode_config_funcs = {
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 6ec224f3d824..d4f51b5c7ee5 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -839,12 +839,11 @@ static struct drm_info_list tegra_debugfs_list[] = {
{ "iova", tegra_debugfs_iova, 0 },
};

-static int tegra_debugfs_init(struct drm_minor *minor)
+static void tegra_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(tegra_debugfs_list,
ARRAY_SIZE(tegra_debugfs_list),
minor->debugfs_root, minor);
- return 0;
}
#endif

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 3f7071eb9c78..78c1877d13a8 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -478,7 +478,7 @@ static struct drm_info_list tilcdc_debugfs_list[] = {
{ "mm", tilcdc_mm_show, 0 },
};

-static int tilcdc_debugfs_init(struct drm_minor *minor)
+static void tilcdc_debugfs_init(struct drm_minor *minor)
{
struct tilcdc_module *mod;

@@ -489,8 +489,6 @@ static int tilcdc_debugfs_init(struct drm_minor *minor)
list_for_each_entry(mod, &module_list, list)
if (mod->funcs->debugfs_init)
mod->funcs->debugfs_init(mod, minor);
-
- return 0;
}
#endif

diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c b/drivers/gpu/drm/v3d/v3d_debugfs.c
index 57dded6a3957..2b0ea5f8febd 100644
--- a/drivers/gpu/drm/v3d/v3d_debugfs.c
+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
@@ -258,11 +258,10 @@ static const struct drm_info_list v3d_debugfs_list[] = {
{"bo_stats", v3d_debugfs_bo_stats, 0},
};

-int
+void
v3d_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(v3d_debugfs_list,
ARRAY_SIZE(v3d_debugfs_list),
minor->debugfs_root, minor);
- return 0;
}
diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h
index ac2603334587..e0775c884553 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.h
+++ b/drivers/gpu/drm/v3d/v3d_drv.h
@@ -316,7 +316,7 @@ struct drm_gem_object *v3d_prime_import_sg_table(struct drm_device *dev,
struct sg_table *sgt);

/* v3d_debugfs.c */
-int v3d_debugfs_init(struct drm_minor *minor);
+void v3d_debugfs_init(struct drm_minor *minor);

/* v3d_fence.c */
extern const struct dma_fence_ops v3d_fence_ops;
diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c
index 1835f12337ec..4fbbf980a299 100644
--- a/drivers/gpu/drm/vc4/vc4_debugfs.c
+++ b/drivers/gpu/drm/vc4/vc4_debugfs.c
@@ -20,7 +20,7 @@ struct vc4_debugfs_info_entry {
* Called at drm_dev_register() time on each of the minors registered
* by the DRM device, to attach the debugfs files.
*/
-int
+void
vc4_debugfs_init(struct drm_minor *minor)
{
struct vc4_dev *vc4 = to_vc4_dev(minor->dev);
@@ -33,8 +33,6 @@ vc4_debugfs_init(struct drm_minor *minor)
drm_debugfs_create_files(&entry->info, 1,
minor->debugfs_root, minor);
}
-
- return 0;
}

static int vc4_debugfs_regset32(struct seq_file *m, void *unused)
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 139d25a8328e..3b1f02efefbe 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -759,7 +759,7 @@ void vc4_crtc_get_margins(struct drm_crtc_state *state,
unsigned int *top, unsigned int *bottom);

/* vc4_debugfs.c */
-int vc4_debugfs_init(struct drm_minor *minor);
+void vc4_debugfs_init(struct drm_minor *minor);
#ifdef CONFIG_DEBUG_FS
void vc4_debugfs_add_file(struct drm_device *drm,
const char *filename,
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index e27120d512b0..3221520f61f0 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -72,11 +72,10 @@ static struct drm_info_list virtio_gpu_debugfs_list[] = {

#define VIRTIO_GPU_DEBUGFS_ENTRIES ARRAY_SIZE(virtio_gpu_debugfs_list)

-int
+void
virtio_gpu_debugfs_init(struct drm_minor *minor)
{
drm_debugfs_create_files(virtio_gpu_debugfs_list,
VIRTIO_GPU_DEBUGFS_ENTRIES,
minor->debugfs_root, minor);
- return 0;
}
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index c1824bdf2418..824f9f15926c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -379,6 +379,6 @@ struct drm_gem_object *virtgpu_gem_prime_import_sg_table(
struct sg_table *sgt);

/* virgl debugfs */
-int virtio_gpu_debugfs_init(struct drm_minor *minor);
+void virtio_gpu_debugfs_init(struct drm_minor *minor);

#endif
diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h
index 3ed5dee899fd..7402f852d3c4 100644
--- a/include/drm/drm_client.h
+++ b/include/drm/drm_client.h
@@ -188,6 +188,6 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode);
drm_for_each_connector_iter(connector, iter) \
if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)

-int drm_client_debugfs_init(struct drm_minor *minor);
+void drm_client_debugfs_init(struct drm_minor *minor);

#endif
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 97109df5beac..c6ae888c672b 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -323,7 +323,7 @@ struct drm_driver {
*
* Allows drivers to create driver-specific debugfs files.
*/
- int (*debugfs_init)(struct drm_minor *minor);
+ void (*debugfs_init)(struct drm_minor *minor);

/**
* @gem_free_object: deconstructor for drm_gem_objects
diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h
index 0f6e47213d8d..b63bcd1b996d 100644
--- a/include/drm/drm_gem_vram_helper.h
+++ b/include/drm/drm_gem_vram_helper.h
@@ -196,7 +196,7 @@ static inline struct drm_vram_mm *drm_vram_mm_of_bdev(
return container_of(bdev, struct drm_vram_mm, bdev);
}

-int drm_vram_mm_debugfs_init(struct drm_minor *minor);
+void drm_vram_mm_debugfs_init(struct drm_minor *minor);

/*
* Helpers for integration with struct drm_device
diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h
index 33f325f5af2b..30ebdfd8a51f 100644
--- a/include/drm/drm_mipi_dbi.h
+++ b/include/drm/drm_mipi_dbi.h
@@ -192,7 +192,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
})

#ifdef CONFIG_DEBUG_FS
-int mipi_dbi_debugfs_init(struct drm_minor *minor);
+void mipi_dbi_debugfs_init(struct drm_minor *minor);
#else
#define mipi_dbi_debugfs_init NULL
#endif
--
2.25.1

2020-03-10 13:33:17

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 12/17] drm/pl111: make pl111_debugfs_init return 0

Since 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail) drm_debugfs_create_files()
should return void. Therefore, remove its use as the return value in
pl111_debugfs_init(), and have the function return 0 directly.

v2: have pl111_debugfs_init() return 0 instead of void to avoid build
breakage for individual compilation.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/pl111/pl111_debugfs.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/pl111/pl111_debugfs.c b/drivers/gpu/drm/pl111/pl111_debugfs.c
index 3c8e82016854..5595b19c91ce 100644
--- a/drivers/gpu/drm/pl111/pl111_debugfs.c
+++ b/drivers/gpu/drm/pl111/pl111_debugfs.c
@@ -54,7 +54,9 @@ static const struct drm_info_list pl111_debugfs_list[] = {
int
pl111_debugfs_init(struct drm_minor *minor)
{
- return drm_debugfs_create_files(pl111_debugfs_list,
- ARRAY_SIZE(pl111_debugfs_list),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(pl111_debugfs_list,
+ ARRAY_SIZE(pl111_debugfs_list),
+ minor->debugfs_root, minor);
+
+ return 0;
}
--
2.25.1

2020-03-10 13:33:18

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 14/17] drm/i915: have *_debugfs_init() functions return void.

Since commit 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
fails and should return void. Therefore, remove its use as the
return value of debugfs_init() functions and have the functions return
void.

v2: convert intel_display_debugfs_register() stub to return void too.

Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/i915/display/intel_display_debugfs.c | 8 ++++----
drivers/gpu/drm/i915/display/intel_display_debugfs.h | 4 ++--
drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++----
drivers/gpu/drm/i915/i915_debugfs.h | 4 ++--
4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index 1e6eb7f2f72d..424f4e52f783 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -1927,7 +1927,7 @@ static const struct {
{"i915_edp_psr_debug", &i915_edp_psr_debug_fops},
};

-int intel_display_debugfs_register(struct drm_i915_private *i915)
+void intel_display_debugfs_register(struct drm_i915_private *i915)
{
struct drm_minor *minor = i915->drm.primary;
int i;
@@ -1940,9 +1940,9 @@ int intel_display_debugfs_register(struct drm_i915_private *i915)
intel_display_debugfs_files[i].fops);
}

- return drm_debugfs_create_files(intel_display_debugfs_list,
- ARRAY_SIZE(intel_display_debugfs_list),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(intel_display_debugfs_list,
+ ARRAY_SIZE(intel_display_debugfs_list),
+ minor->debugfs_root, minor);
}

static int i915_panel_show(struct seq_file *m, void *data)
diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.h b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
index a3bea1ce04c2..c922c1745bfe 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.h
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
@@ -10,10 +10,10 @@ struct drm_connector;
struct drm_i915_private;

#ifdef CONFIG_DEBUG_FS
-int intel_display_debugfs_register(struct drm_i915_private *i915);
+void intel_display_debugfs_register(struct drm_i915_private *i915);
int intel_connector_debugfs_add(struct drm_connector *connector);
#else
-static inline int intel_display_debugfs_register(struct drm_i915_private *i915) { return 0; }
+static inline void intel_display_debugfs_register(struct drm_i915_private *i915) {}
static inline int intel_connector_debugfs_add(struct drm_connector *connector) { return 0; }
#endif

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 8f2525e4ce0f..de313199c714 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2392,7 +2392,7 @@ static const struct i915_debugfs_files {
{"i915_guc_log_relay", &i915_guc_log_relay_fops},
};

-int i915_debugfs_register(struct drm_i915_private *dev_priv)
+void i915_debugfs_register(struct drm_i915_private *dev_priv)
{
struct drm_minor *minor = dev_priv->drm.primary;
int i;
@@ -2409,7 +2409,7 @@ int i915_debugfs_register(struct drm_i915_private *dev_priv)
i915_debugfs_files[i].fops);
}

- return drm_debugfs_create_files(i915_debugfs_list,
- I915_DEBUGFS_ENTRIES,
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(i915_debugfs_list,
+ I915_DEBUGFS_ENTRIES,
+ minor->debugfs_root, minor);
}
diff --git a/drivers/gpu/drm/i915/i915_debugfs.h b/drivers/gpu/drm/i915/i915_debugfs.h
index 6da39c76ab5e..1de2736f1248 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.h
+++ b/drivers/gpu/drm/i915/i915_debugfs.h
@@ -12,10 +12,10 @@ struct drm_i915_private;
struct seq_file;

#ifdef CONFIG_DEBUG_FS
-int i915_debugfs_register(struct drm_i915_private *dev_priv);
+void i915_debugfs_register(struct drm_i915_private *dev_priv);
void i915_debugfs_describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj);
#else
-static inline int i915_debugfs_register(struct drm_i915_private *dev_priv) { return 0; }
+static inline void i915_debugfs_register(struct drm_i915_private *dev_priv) {}
static inline void i915_debugfs_describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) {}
#endif

--
2.25.1

2020-03-10 13:33:21

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 09/17] drm/sti: remove use of drm_debugfs functions as return values

Since commit 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
fails, and should return void. This change therefore removes it uses as
a return value in various functions across drm/sti.

With these changes, the affected functions have been changed to use a void
return value.

v2: convert sti_mixer_debugfs_init() and sti_compositor_debugfs_init()
to return void too. Also have sti_drm_dbg_init() to return 0 to avoid
build issues.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/sti/sti_compositor.c | 6 ++----
drivers/gpu/drm/sti/sti_compositor.h | 4 ++--
drivers/gpu/drm/sti/sti_crtc.c | 2 +-
drivers/gpu/drm/sti/sti_cursor.c | 14 ++++++++------
drivers/gpu/drm/sti/sti_drv.c | 13 +++----------
drivers/gpu/drm/sti/sti_dvo.c | 13 +++++--------
drivers/gpu/drm/sti/sti_gdp.c | 7 ++++---
drivers/gpu/drm/sti/sti_hda.c | 13 +++++--------
drivers/gpu/drm/sti/sti_hdmi.c | 13 +++++--------
drivers/gpu/drm/sti/sti_hqvdp.c | 12 +++++++-----
drivers/gpu/drm/sti/sti_mixer.c | 10 +++++-----
drivers/gpu/drm/sti/sti_mixer.h | 2 +-
drivers/gpu/drm/sti/sti_tvout.c | 13 +++++--------
drivers/gpu/drm/sti/sti_vid.c | 8 ++++----
drivers/gpu/drm/sti/sti_vid.h | 2 +-
15 files changed, 58 insertions(+), 74 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c
index c7652584255d..319962a2c17b 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -42,8 +42,8 @@ static const struct sti_compositor_data stih407_compositor_data = {
},
};

-int sti_compositor_debugfs_init(struct sti_compositor *compo,
- struct drm_minor *minor)
+void sti_compositor_debugfs_init(struct sti_compositor *compo,
+ struct drm_minor *minor)
{
unsigned int i;

@@ -54,8 +54,6 @@ int sti_compositor_debugfs_init(struct sti_compositor *compo,
for (i = 0; i < STI_MAX_MIXER; i++)
if (compo->mixer[i])
sti_mixer_debugfs_init(compo->mixer[i], minor);
-
- return 0;
}

static int sti_compositor_bind(struct device *dev,
diff --git a/drivers/gpu/drm/sti/sti_compositor.h b/drivers/gpu/drm/sti/sti_compositor.h
index ac4bb3834810..25bb01bdd013 100644
--- a/drivers/gpu/drm/sti/sti_compositor.h
+++ b/drivers/gpu/drm/sti/sti_compositor.h
@@ -79,7 +79,7 @@ struct sti_compositor {
struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
};

-int sti_compositor_debugfs_init(struct sti_compositor *compo,
- struct drm_minor *minor);
+void sti_compositor_debugfs_init(struct sti_compositor *compo,
+ struct drm_minor *minor);

#endif
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index 49e6cb8f5836..6f37c104c46f 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -319,7 +319,7 @@ static int sti_crtc_late_register(struct drm_crtc *crtc)
struct sti_compositor *compo = dev_get_drvdata(mixer->dev);

if (drm_crtc_index(crtc) == 0)
- return sti_compositor_debugfs_init(compo, crtc->dev->primary);
+ sti_compositor_debugfs_init(compo, crtc->dev->primary);

return 0;
}
diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index ea64c1dcaf63..a98057431023 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -131,17 +131,17 @@ static struct drm_info_list cursor_debugfs_files[] = {
{ "cursor", cursor_dbg_show, 0, NULL },
};

-static int cursor_debugfs_init(struct sti_cursor *cursor,
- struct drm_minor *minor)
+static void cursor_debugfs_init(struct sti_cursor *cursor,
+ struct drm_minor *minor)
{
unsigned int i;

for (i = 0; i < ARRAY_SIZE(cursor_debugfs_files); i++)
cursor_debugfs_files[i].data = cursor;

- return drm_debugfs_create_files(cursor_debugfs_files,
- ARRAY_SIZE(cursor_debugfs_files),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(cursor_debugfs_files,
+ ARRAY_SIZE(cursor_debugfs_files),
+ minor->debugfs_root, minor);
}

static void sti_cursor_argb8888_to_clut8(struct sti_cursor *cursor, u32 *src)
@@ -342,7 +342,9 @@ static int sti_cursor_late_register(struct drm_plane *drm_plane)
struct sti_plane *plane = to_sti_plane(drm_plane);
struct sti_cursor *cursor = to_sti_cursor(plane);

- return cursor_debugfs_init(cursor, drm_plane->dev->primary);
+ cursor_debugfs_init(cursor, drm_plane->dev->primary);
+
+ return 0;
}

static const struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 50870d8cbb76..5ab36f6001fc 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -94,22 +94,15 @@ static struct drm_info_list sti_drm_dbg_list[] = {

static int sti_drm_dbg_init(struct drm_minor *minor)
{
- int ret;
-
- ret = drm_debugfs_create_files(sti_drm_dbg_list,
- ARRAY_SIZE(sti_drm_dbg_list),
- minor->debugfs_root, minor);
- if (ret)
- goto err;
+ drm_debugfs_create_files(sti_drm_dbg_list,
+ ARRAY_SIZE(sti_drm_dbg_list),
+ minor->debugfs_root, minor);

debugfs_create_file("fps_show", S_IRUGO | S_IWUSR, minor->debugfs_root,
minor->dev, &sti_drm_fps_fops);

DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
return 0;
-err:
- DRM_ERROR("%s: cannot install debugfs\n", DRIVER_NAME);
- return ret;
}

static const struct drm_mode_config_funcs sti_mode_config_funcs = {
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index a0709647f678..0032e1830bc5 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -197,16 +197,16 @@ static struct drm_info_list dvo_debugfs_files[] = {
{ "dvo", dvo_dbg_show, 0, NULL },
};

-static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
+static void dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
{
unsigned int i;

for (i = 0; i < ARRAY_SIZE(dvo_debugfs_files); i++)
dvo_debugfs_files[i].data = dvo;

- return drm_debugfs_create_files(dvo_debugfs_files,
- ARRAY_SIZE(dvo_debugfs_files),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(dvo_debugfs_files,
+ ARRAY_SIZE(dvo_debugfs_files),
+ minor->debugfs_root, minor);
}

static void sti_dvo_disable(struct drm_bridge *bridge)
@@ -406,10 +406,7 @@ static int sti_dvo_late_register(struct drm_connector *connector)
= to_sti_dvo_connector(connector);
struct sti_dvo *dvo = dvo_connector->dvo;

- if (dvo_debugfs_init(dvo, dvo->drm_dev->primary)) {
- DRM_ERROR("DVO debugfs setup failed\n");
- return -EINVAL;
- }
+ dvo_debugfs_init(dvo, dvo->drm_dev->primary);

return 0;
}
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 11595c748844..2d5a2b5b78b8 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -343,9 +343,10 @@ static int gdp_debugfs_init(struct sti_gdp *gdp, struct drm_minor *minor)
for (i = 0; i < nb_files; i++)
gdp_debugfs_files[i].data = gdp;

- return drm_debugfs_create_files(gdp_debugfs_files,
- nb_files,
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(gdp_debugfs_files,
+ nb_files,
+ minor->debugfs_root, minor);
+ return 0;
}

static int sti_gdp_fourcc2format(int fourcc)
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index f3f28d79b0e4..a1ec891eaf3a 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -367,16 +367,16 @@ static struct drm_info_list hda_debugfs_files[] = {
{ "hda", hda_dbg_show, 0, NULL },
};

-static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor)
+static void hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor)
{
unsigned int i;

for (i = 0; i < ARRAY_SIZE(hda_debugfs_files); i++)
hda_debugfs_files[i].data = hda;

- return drm_debugfs_create_files(hda_debugfs_files,
- ARRAY_SIZE(hda_debugfs_files),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(hda_debugfs_files,
+ ARRAY_SIZE(hda_debugfs_files),
+ minor->debugfs_root, minor);
}

/**
@@ -643,10 +643,7 @@ static int sti_hda_late_register(struct drm_connector *connector)
= to_sti_hda_connector(connector);
struct sti_hda *hda = hda_connector->hda;

- if (hda_debugfs_init(hda, hda->drm_dev->primary)) {
- DRM_ERROR("HDA debugfs setup failed\n");
- return -EINVAL;
- }
+ hda_debugfs_init(hda, hda->drm_dev->primary);

return 0;
}
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 18eaf786ffa4..5b15c4974e6b 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -727,16 +727,16 @@ static struct drm_info_list hdmi_debugfs_files[] = {
{ "hdmi", hdmi_dbg_show, 0, NULL },
};

-static int hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor)
+static void hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor)
{
unsigned int i;

for (i = 0; i < ARRAY_SIZE(hdmi_debugfs_files); i++)
hdmi_debugfs_files[i].data = hdmi;

- return drm_debugfs_create_files(hdmi_debugfs_files,
- ARRAY_SIZE(hdmi_debugfs_files),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(hdmi_debugfs_files,
+ ARRAY_SIZE(hdmi_debugfs_files),
+ minor->debugfs_root, minor);
}

static void sti_hdmi_disable(struct drm_bridge *bridge)
@@ -1113,10 +1113,7 @@ static int sti_hdmi_late_register(struct drm_connector *connector)
= to_sti_hdmi_connector(connector);
struct sti_hdmi *hdmi = hdmi_connector->hdmi;

- if (hdmi_debugfs_init(hdmi, hdmi->drm_dev->primary)) {
- DRM_ERROR("HDMI debugfs setup failed\n");
- return -EINVAL;
- }
+ hdmi_debugfs_init(hdmi, hdmi->drm_dev->primary);

return 0;
}
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index 1015abe0ce08..5a4e12194a77 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -639,16 +639,16 @@ static struct drm_info_list hqvdp_debugfs_files[] = {
{ "hqvdp", hqvdp_dbg_show, 0, NULL },
};

-static int hqvdp_debugfs_init(struct sti_hqvdp *hqvdp, struct drm_minor *minor)
+static void hqvdp_debugfs_init(struct sti_hqvdp *hqvdp, struct drm_minor *minor)
{
unsigned int i;

for (i = 0; i < ARRAY_SIZE(hqvdp_debugfs_files); i++)
hqvdp_debugfs_files[i].data = hqvdp;

- return drm_debugfs_create_files(hqvdp_debugfs_files,
- ARRAY_SIZE(hqvdp_debugfs_files),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(hqvdp_debugfs_files,
+ ARRAY_SIZE(hqvdp_debugfs_files),
+ minor->debugfs_root, minor);
}

/**
@@ -1274,7 +1274,9 @@ static int sti_hqvdp_late_register(struct drm_plane *drm_plane)
struct sti_plane *plane = to_sti_plane(drm_plane);
struct sti_hqvdp *hqvdp = to_sti_hqvdp(plane);

- return hqvdp_debugfs_init(hqvdp, drm_plane->dev->primary);
+ hqvdp_debugfs_init(hqvdp, drm_plane->dev->primary);
+
+ return 0;
}

static const struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = {
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index c3a3e1e5fc8a..7e5f14646625 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -178,7 +178,7 @@ static struct drm_info_list mixer1_debugfs_files[] = {
{ "mixer_aux", mixer_dbg_show, 0, NULL },
};

-int sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor)
+void sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor)
{
unsigned int i;
struct drm_info_list *mixer_debugfs_files;
@@ -194,15 +194,15 @@ int sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor)
nb_files = ARRAY_SIZE(mixer1_debugfs_files);
break;
default:
- return -EINVAL;
+ return;
}

for (i = 0; i < nb_files; i++)
mixer_debugfs_files[i].data = mixer;

- return drm_debugfs_create_files(mixer_debugfs_files,
- nb_files,
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(mixer_debugfs_files,
+ nb_files,
+ minor->debugfs_root, minor);
}

void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable)
diff --git a/drivers/gpu/drm/sti/sti_mixer.h b/drivers/gpu/drm/sti/sti_mixer.h
index d9544246913a..ab06beb7b258 100644
--- a/drivers/gpu/drm/sti/sti_mixer.h
+++ b/drivers/gpu/drm/sti/sti_mixer.h
@@ -58,7 +58,7 @@ int sti_mixer_active_video_area(struct sti_mixer *mixer,

void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable);

-int sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor);
+void sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor);

/* depth in Cross-bar control = z order */
#define GAM_MIXER_NB_DEPTH_LEVEL 6
diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index c36a8da373cb..df3817f0fd30 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -570,16 +570,16 @@ static struct drm_info_list tvout_debugfs_files[] = {
{ "tvout", tvout_dbg_show, 0, NULL },
};

-static int tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor)
+static void tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor)
{
unsigned int i;

for (i = 0; i < ARRAY_SIZE(tvout_debugfs_files); i++)
tvout_debugfs_files[i].data = tvout;

- return drm_debugfs_create_files(tvout_debugfs_files,
- ARRAY_SIZE(tvout_debugfs_files),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(tvout_debugfs_files,
+ ARRAY_SIZE(tvout_debugfs_files),
+ minor->debugfs_root, minor);
}

static void sti_tvout_encoder_dpms(struct drm_encoder *encoder, int mode)
@@ -603,14 +603,11 @@ static void sti_tvout_encoder_destroy(struct drm_encoder *encoder)
static int sti_tvout_late_register(struct drm_encoder *encoder)
{
struct sti_tvout *tvout = to_sti_tvout(encoder);
- int ret;

if (tvout->debugfs_registered)
return 0;

- ret = tvout_debugfs_init(tvout, encoder->dev->primary);
- if (ret)
- return ret;
+ tvout_debugfs_init(tvout, encoder->dev->primary);

tvout->debugfs_registered = true;
return 0;
diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
index 2d4230410464..2d818397918d 100644
--- a/drivers/gpu/drm/sti/sti_vid.c
+++ b/drivers/gpu/drm/sti/sti_vid.c
@@ -124,16 +124,16 @@ static struct drm_info_list vid_debugfs_files[] = {
{ "vid", vid_dbg_show, 0, NULL },
};

-int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor)
+void vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor)
{
unsigned int i;

for (i = 0; i < ARRAY_SIZE(vid_debugfs_files); i++)
vid_debugfs_files[i].data = vid;

- return drm_debugfs_create_files(vid_debugfs_files,
- ARRAY_SIZE(vid_debugfs_files),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(vid_debugfs_files,
+ ARRAY_SIZE(vid_debugfs_files),
+ minor->debugfs_root, minor);
}

void sti_vid_commit(struct sti_vid *vid,
diff --git a/drivers/gpu/drm/sti/sti_vid.h b/drivers/gpu/drm/sti/sti_vid.h
index 9dbd78461de1..991849ba50b5 100644
--- a/drivers/gpu/drm/sti/sti_vid.h
+++ b/drivers/gpu/drm/sti/sti_vid.h
@@ -26,6 +26,6 @@ void sti_vid_disable(struct sti_vid *vid);
struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev,
int id, void __iomem *baseaddr);

-int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor);
+void vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor);

#endif
--
2.25.1

2020-03-10 13:33:23

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 04/17] drm/vc4: remove check of return value of drm_debugfs functions

Since 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
fails and should return void. Therefore, remove unnecessary check and
error handling for the return value of drm_debugfs_create_files()
in vc4_debugfs_init().

v2: remove conversion of vc4_debugfs_init() to void to enable individual
compilation and avoid build issues and breakage.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/vc4/vc4_debugfs.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_debugfs.c b/drivers/gpu/drm/vc4/vc4_debugfs.c
index b61b2d3407b5..1835f12337ec 100644
--- a/drivers/gpu/drm/vc4/vc4_debugfs.c
+++ b/drivers/gpu/drm/vc4/vc4_debugfs.c
@@ -30,11 +30,8 @@ vc4_debugfs_init(struct drm_minor *minor)
minor->debugfs_root, &vc4->load_tracker_enabled);

list_for_each_entry(entry, &vc4->debugfs_list, link) {
- int ret = drm_debugfs_create_files(&entry->info, 1,
- minor->debugfs_root, minor);
-
- if (ret)
- return ret;
+ drm_debugfs_create_files(&entry->info, 1,
+ minor->debugfs_root, minor);
}

return 0;
--
2.25.1

2020-03-10 13:33:27

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 05/17] drm/arc: make arcgpu_debugfs_init() return 0.

Since commit 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
fails and should return void. Therefore, remove its use as the
return value of arcpgu_debugfs_init() and have the latter function return
0 directly.

v2: convert the function to return 0 instead of void to avoid breaking
the build and ensure that this individual patch compiles properly.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/arc/arcpgu_drv.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index d6a6692db0ac..660b25f9588e 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -139,8 +139,10 @@ static struct drm_info_list arcpgu_debugfs_list[] = {

static int arcpgu_debugfs_init(struct drm_minor *minor)
{
- return drm_debugfs_create_files(arcpgu_debugfs_list,
- ARRAY_SIZE(arcpgu_debugfs_list), minor->debugfs_root, minor);
+ drm_debugfs_create_files(arcpgu_debugfs_list,
+ ARRAY_SIZE(arcpgu_debugfs_list),
+ minor->debugfs_root, minor);
+ return 0;
}
#endif

--
2.25.1

2020-03-10 13:33:30

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 13/17] drm/omap: remove checks for return value of drm_debugfs functions

Since 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), there is no need to ever check
the return value for drm_debugfs_create_files(). Therefore remove the
checks for the return value and subsequent error handling in
omap_debugfs_init().

These changes also enables the changing of omap_debugfs_init() to return
0 directly.

v2: convert omap_debugfs_init() to return 0 instead of void to avoid
introduction of build issues and enable individual driver compilation.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/omapdrm/omap_debugfs.c | 27 +++++++-------------------
1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_debugfs.c b/drivers/gpu/drm/omapdrm/omap_debugfs.c
index 34dfb33145b4..ed63dcced79a 100644
--- a/drivers/gpu/drm/omapdrm/omap_debugfs.c
+++ b/drivers/gpu/drm/omapdrm/omap_debugfs.c
@@ -82,29 +82,16 @@ static struct drm_info_list omap_dmm_debugfs_list[] = {

int omap_debugfs_init(struct drm_minor *minor)
{
- struct drm_device *dev = minor->dev;
- int ret;
-
- ret = drm_debugfs_create_files(omap_debugfs_list,
- ARRAY_SIZE(omap_debugfs_list),
- minor->debugfs_root, minor);
-
- if (ret) {
- dev_err(dev->dev, "could not install omap_debugfs_list\n");
- return ret;
- }
+ drm_debugfs_create_files(omap_debugfs_list,
+ ARRAY_SIZE(omap_debugfs_list),
+ minor->debugfs_root, minor);

if (dmm_is_available())
- ret = drm_debugfs_create_files(omap_dmm_debugfs_list,
- ARRAY_SIZE(omap_dmm_debugfs_list),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(omap_dmm_debugfs_list,
+ ARRAY_SIZE(omap_dmm_debugfs_list),
+ minor->debugfs_root, minor);

- if (ret) {
- dev_err(dev->dev, "could not install omap_dmm_debugfs_list\n");
- return ret;
- }
-
- return ret;
+ return 0;
}

#endif
--
2.25.1

2020-03-10 13:33:39

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 01/17] drm/tegra: remove checks for debugfs functions return value

Since 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail) there is no need to check the
return value of drm_debugfs_create_files(). Therefore, remove the
return checks and error handling of the drm_debugfs_create_files()
function from various debugfs init functions in drm/tegra and have
them return 0 directly.

v2: remove conversion of tegra_debugfs_init() to void to avoid build
breakage.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/tegra/dc.c | 11 +----------
drivers/gpu/drm/tegra/drm.c | 7 ++++---
drivers/gpu/drm/tegra/dsi.c | 11 +----------
drivers/gpu/drm/tegra/hdmi.c | 11 +----------
drivers/gpu/drm/tegra/sor.c | 11 +----------
5 files changed, 8 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 7c70fd31a4c2..e70d58b21964 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -1496,7 +1496,6 @@ static int tegra_dc_late_register(struct drm_crtc *crtc)
struct drm_minor *minor = crtc->dev->primary;
struct dentry *root;
struct tegra_dc *dc = to_tegra_dc(crtc);
- int err;

#ifdef CONFIG_DEBUG_FS
root = crtc->debugfs_entry;
@@ -1512,17 +1511,9 @@ static int tegra_dc_late_register(struct drm_crtc *crtc)
for (i = 0; i < count; i++)
dc->debugfs_files[i].data = dc;

- err = drm_debugfs_create_files(dc->debugfs_files, count, root, minor);
- if (err < 0)
- goto free;
+ drm_debugfs_create_files(dc->debugfs_files, count, root, minor);

return 0;
-
-free:
- kfree(dc->debugfs_files);
- dc->debugfs_files = NULL;
-
- return err;
}

static void tegra_dc_early_unregister(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index bd268028fb3d..6ec224f3d824 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -841,9 +841,10 @@ static struct drm_info_list tegra_debugfs_list[] = {

static int tegra_debugfs_init(struct drm_minor *minor)
{
- return drm_debugfs_create_files(tegra_debugfs_list,
- ARRAY_SIZE(tegra_debugfs_list),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(tegra_debugfs_list,
+ ARRAY_SIZE(tegra_debugfs_list),
+ minor->debugfs_root, minor);
+ return 0;
}
#endif

diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 88b9d64c77bf..30626fcf61eb 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -234,7 +234,6 @@ static int tegra_dsi_late_register(struct drm_connector *connector)
struct drm_minor *minor = connector->dev->primary;
struct dentry *root = connector->debugfs_entry;
struct tegra_dsi *dsi = to_dsi(output);
- int err;

dsi->debugfs_files = kmemdup(debugfs_files, sizeof(debugfs_files),
GFP_KERNEL);
@@ -244,17 +243,9 @@ static int tegra_dsi_late_register(struct drm_connector *connector)
for (i = 0; i < count; i++)
dsi->debugfs_files[i].data = dsi;

- err = drm_debugfs_create_files(dsi->debugfs_files, count, root, minor);
- if (err < 0)
- goto free;
+ drm_debugfs_create_files(dsi->debugfs_files, count, root, minor);

return 0;
-
-free:
- kfree(dsi->debugfs_files);
- dsi->debugfs_files = NULL;
-
- return err;
}

static void tegra_dsi_early_unregister(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index 6f117628f257..d7799d13d8ad 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1064,7 +1064,6 @@ static int tegra_hdmi_late_register(struct drm_connector *connector)
struct drm_minor *minor = connector->dev->primary;
struct dentry *root = connector->debugfs_entry;
struct tegra_hdmi *hdmi = to_hdmi(output);
- int err;

hdmi->debugfs_files = kmemdup(debugfs_files, sizeof(debugfs_files),
GFP_KERNEL);
@@ -1074,17 +1073,9 @@ static int tegra_hdmi_late_register(struct drm_connector *connector)
for (i = 0; i < count; i++)
hdmi->debugfs_files[i].data = hdmi;

- err = drm_debugfs_create_files(hdmi->debugfs_files, count, root, minor);
- if (err < 0)
- goto free;
+ drm_debugfs_create_files(hdmi->debugfs_files, count, root, minor);

return 0;
-
-free:
- kfree(hdmi->debugfs_files);
- hdmi->debugfs_files = NULL;
-
- return err;
}

static void tegra_hdmi_early_unregister(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 81226a4953c1..47c1d133069a 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -1687,7 +1687,6 @@ static int tegra_sor_late_register(struct drm_connector *connector)
struct drm_minor *minor = connector->dev->primary;
struct dentry *root = connector->debugfs_entry;
struct tegra_sor *sor = to_sor(output);
- int err;

sor->debugfs_files = kmemdup(debugfs_files, sizeof(debugfs_files),
GFP_KERNEL);
@@ -1697,17 +1696,9 @@ static int tegra_sor_late_register(struct drm_connector *connector)
for (i = 0; i < count; i++)
sor->debugfs_files[i].data = sor;

- err = drm_debugfs_create_files(sor->debugfs_files, count, root, minor);
- if (err < 0)
- goto free;
+ drm_debugfs_create_files(sor->debugfs_files, count, root, minor);

return 0;
-
-free:
- kfree(sor->debugfs_files);
- sor->debugfs_files = NULL;
-
- return err;
}

static void tegra_sor_early_unregister(struct drm_connector *connector)
--
2.25.1

2020-03-10 13:33:43

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 15/17] drm: make various debugfs_init() functions return 0

Since commit 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
fails and should return void. Therefore, remove its use as the
return value of various debugfs_init() functions in drm, and have these
functions return 0 directly.

v2: convert debugfs_init() functions to return 0 instead of void to
avoid build breakage.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/drm_atomic.c | 7 ++++---
drivers/gpu/drm/drm_client.c | 8 +++++---
drivers/gpu/drm/drm_framebuffer.c | 8 +++++---
3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 9ccfbf213d72..c0056d9cc139 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1643,8 +1643,9 @@ static const struct drm_info_list drm_atomic_debugfs_list[] = {

int drm_atomic_debugfs_init(struct drm_minor *minor)
{
- return drm_debugfs_create_files(drm_atomic_debugfs_list,
- ARRAY_SIZE(drm_atomic_debugfs_list),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(drm_atomic_debugfs_list,
+ ARRAY_SIZE(drm_atomic_debugfs_list),
+ minor->debugfs_root, minor);
+ return 0;
}
#endif
diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index 6b0c6ef8b9b3..82fbdee407b2 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -459,8 +459,10 @@ static const struct drm_info_list drm_client_debugfs_list[] = {

int drm_client_debugfs_init(struct drm_minor *minor)
{
- return drm_debugfs_create_files(drm_client_debugfs_list,
- ARRAY_SIZE(drm_client_debugfs_list),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(drm_client_debugfs_list,
+ ARRAY_SIZE(drm_client_debugfs_list),
+ minor->debugfs_root, minor);
+
+ return 0;
}
#endif
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 57ac94ce9b9e..46be88271fe5 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -1209,8 +1209,10 @@ static const struct drm_info_list drm_framebuffer_debugfs_list[] = {

int drm_framebuffer_debugfs_init(struct drm_minor *minor)
{
- return drm_debugfs_create_files(drm_framebuffer_debugfs_list,
- ARRAY_SIZE(drm_framebuffer_debugfs_list),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(drm_framebuffer_debugfs_list,
+ ARRAY_SIZE(drm_framebuffer_debugfs_list),
+ minor->debugfs_root, minor);
+
+ return 0;
}
#endif
--
2.25.1

2020-03-10 13:34:28

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 02/17] drm/tilcdc: remove check for return value of debugfs functions.

Since 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
fails. Therefore, remove the check and error handling of the return
value of drm_debugfs_create_files() as it is not needed in
tilcdc_debugfs_init().

Also remove local variables that are not used after the changes.

v2: remove conversion of tilcdc_debugfs_init() to void to avoid build
breakage and enable individual compilation.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 0791a0200cc3..3f7071eb9c78 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -480,24 +480,17 @@ static struct drm_info_list tilcdc_debugfs_list[] = {

static int tilcdc_debugfs_init(struct drm_minor *minor)
{
- struct drm_device *dev = minor->dev;
struct tilcdc_module *mod;
- int ret;

- ret = drm_debugfs_create_files(tilcdc_debugfs_list,
- ARRAY_SIZE(tilcdc_debugfs_list),
- minor->debugfs_root, minor);
+ drm_debugfs_create_files(tilcdc_debugfs_list,
+ ARRAY_SIZE(tilcdc_debugfs_list),
+ minor->debugfs_root, minor);

list_for_each_entry(mod, &module_list, list)
if (mod->funcs->debugfs_init)
mod->funcs->debugfs_init(mod, minor);

- if (ret) {
- dev_err(dev->dev, "could not install tilcdc_debugfs_list\n");
- return ret;
- }
-
- return ret;
+ return 0;
}
#endif

--
2.25.1

2020-03-10 13:34:28

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH v2 11/17] drm/nouveau: make nouveau_drm_debugfs_init() return 0

Since 987d65d01356 (drm: debugfs: make
drm_debugfs_create_files() never fail), there is no need to ever check
for the the return value of debugfs_create_file() and
drm_debugfs_create_files(). Therefore, remove unnecessary checks and
error handling in nouveau_drm_debugfs_init() and have the function
return 0 directly.

v2: have nouveau_drm_debugfs_init() return 0 instead of void so as not
to introduce any build warnings to enable individual patch compilation.

References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/nouveau/nouveau_debugfs.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
index 7dfbbbc1beea..15a3d40edf02 100644
--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
@@ -222,22 +222,18 @@ nouveau_drm_debugfs_init(struct drm_minor *minor)
{
struct nouveau_drm *drm = nouveau_drm(minor->dev);
struct dentry *dentry;
- int i, ret;
+ int i;

for (i = 0; i < ARRAY_SIZE(nouveau_debugfs_files); i++) {
- dentry = debugfs_create_file(nouveau_debugfs_files[i].name,
- S_IRUGO | S_IWUSR,
- minor->debugfs_root, minor->dev,
- nouveau_debugfs_files[i].fops);
- if (!dentry)
- return -ENOMEM;
+ debugfs_create_file(nouveau_debugfs_files[i].name,
+ S_IRUGO | S_IWUSR,
+ minor->debugfs_root, minor->dev,
+ nouveau_debugfs_files[i].fops);
}

- ret = drm_debugfs_create_files(nouveau_debugfs_list,
- NOUVEAU_DEBUGFS_ENTRIES,
- minor->debugfs_root, minor);
- if (ret)
- return ret;
+ drm_debugfs_create_files(nouveau_debugfs_list,
+ NOUVEAU_DEBUGFS_ENTRIES,
+ minor->debugfs_root, minor);

/* Set the size of the vbios since we know it, and it's confusing to
* userspace if it wants to seek() but the file has a length of 0
--
2.25.1

2020-03-10 14:33:47

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 00/17] drm: subsytem-wide debugfs functions refactor

On Tue, Mar 10, 2020 at 04:31:04PM +0300, Wambui Karuga wrote:
> This series includes work on various debugfs functions both in drm/core
> and across various drivers in the subsystem.
> Since commit 987d65d01356 (drm: debugfs: make drm_debugfs_create_files()
> never fail), drm_debugfs_create_files() does not fail and only returns
> zero. This series therefore removes the left over error handling and
> checks for its return value across drm drivers.
>
> As a result of these changes, most drm_debugfs functions are converted
> to return void in this series. This also enables the
> drm_driver, debugfs_init() hook to be changed to return void.
>
> v2: individual driver patches have been converted to have debugfs
> functions return 0 instead of void to prevent breaking individual driver
> builds.
> The last patch then converts the .debugfs_hook() and its users across
> all drivers to return void.

This looks much better to me, nice job:

Reviewed-by: Greg Kroah-Hartman <[email protected]>

2020-03-10 15:44:20

by Liviu Dudau

[permalink] [raw]
Subject: Re: [PATCH v2 06/17] drm/arm: make hdlcd_debugfs_init() return 0

On Tue, Mar 10, 2020 at 04:31:10PM +0300, Wambui Karuga wrote:
> Since commit 987d65d01356 (drm: debugfs: make
> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
> fails and should return void. Therefore, remove its use as the
> return value of hdlcd_debugfs_init() and have the latter function return
> 0 directly.
>
> v2: make hdlcd_debugfs_init() return 0 instead of void to ensure that
> each patch compiles individually.
>
> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
> Signed-off-by: Wambui Karuga <[email protected]>

Acked-by: Liviu Dudau <[email protected]>

Best regards,
Liviu

> ---
> drivers/gpu/drm/arm/hdlcd_drv.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index 2e053815b54a..bd0ad6f46a97 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -226,8 +226,10 @@ static struct drm_info_list hdlcd_debugfs_list[] = {
>
> static int hdlcd_debugfs_init(struct drm_minor *minor)
> {
> - return drm_debugfs_create_files(hdlcd_debugfs_list,
> - ARRAY_SIZE(hdlcd_debugfs_list), minor->debugfs_root, minor);
> + drm_debugfs_create_files(hdlcd_debugfs_list,
> + ARRAY_SIZE(hdlcd_debugfs_list),
> + minor->debugfs_root, minor);
> + return 0;
> }
> #endif
>
> --
> 2.25.1
>

--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯

2020-03-11 08:17:38

by Jani Nikula

[permalink] [raw]
Subject: Re: [PATCH v2 14/17] drm/i915: have *_debugfs_init() functions return void.

On Tue, 10 Mar 2020, Wambui Karuga <[email protected]> wrote:
> Since commit 987d65d01356 (drm: debugfs: make
> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
> fails and should return void. Therefore, remove its use as the
> return value of debugfs_init() functions and have the functions return
> void.
>
> v2: convert intel_display_debugfs_register() stub to return void too.
>
> Signed-off-by: Wambui Karuga <[email protected]>

Reviewed-by: Jani Nikula <[email protected]>


> ---
> drivers/gpu/drm/i915/display/intel_display_debugfs.c | 8 ++++----
> drivers/gpu/drm/i915/display/intel_display_debugfs.h | 4 ++--
> drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++----
> drivers/gpu/drm/i915/i915_debugfs.h | 4 ++--
> 4 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> index 1e6eb7f2f72d..424f4e52f783 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> @@ -1927,7 +1927,7 @@ static const struct {
> {"i915_edp_psr_debug", &i915_edp_psr_debug_fops},
> };
>
> -int intel_display_debugfs_register(struct drm_i915_private *i915)
> +void intel_display_debugfs_register(struct drm_i915_private *i915)
> {
> struct drm_minor *minor = i915->drm.primary;
> int i;
> @@ -1940,9 +1940,9 @@ int intel_display_debugfs_register(struct drm_i915_private *i915)
> intel_display_debugfs_files[i].fops);
> }
>
> - return drm_debugfs_create_files(intel_display_debugfs_list,
> - ARRAY_SIZE(intel_display_debugfs_list),
> - minor->debugfs_root, minor);
> + drm_debugfs_create_files(intel_display_debugfs_list,
> + ARRAY_SIZE(intel_display_debugfs_list),
> + minor->debugfs_root, minor);
> }
>
> static int i915_panel_show(struct seq_file *m, void *data)
> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.h b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
> index a3bea1ce04c2..c922c1745bfe 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.h
> @@ -10,10 +10,10 @@ struct drm_connector;
> struct drm_i915_private;
>
> #ifdef CONFIG_DEBUG_FS
> -int intel_display_debugfs_register(struct drm_i915_private *i915);
> +void intel_display_debugfs_register(struct drm_i915_private *i915);
> int intel_connector_debugfs_add(struct drm_connector *connector);
> #else
> -static inline int intel_display_debugfs_register(struct drm_i915_private *i915) { return 0; }
> +static inline void intel_display_debugfs_register(struct drm_i915_private *i915) {}
> static inline int intel_connector_debugfs_add(struct drm_connector *connector) { return 0; }
> #endif
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 8f2525e4ce0f..de313199c714 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2392,7 +2392,7 @@ static const struct i915_debugfs_files {
> {"i915_guc_log_relay", &i915_guc_log_relay_fops},
> };
>
> -int i915_debugfs_register(struct drm_i915_private *dev_priv)
> +void i915_debugfs_register(struct drm_i915_private *dev_priv)
> {
> struct drm_minor *minor = dev_priv->drm.primary;
> int i;
> @@ -2409,7 +2409,7 @@ int i915_debugfs_register(struct drm_i915_private *dev_priv)
> i915_debugfs_files[i].fops);
> }
>
> - return drm_debugfs_create_files(i915_debugfs_list,
> - I915_DEBUGFS_ENTRIES,
> - minor->debugfs_root, minor);
> + drm_debugfs_create_files(i915_debugfs_list,
> + I915_DEBUGFS_ENTRIES,
> + minor->debugfs_root, minor);
> }
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.h b/drivers/gpu/drm/i915/i915_debugfs.h
> index 6da39c76ab5e..1de2736f1248 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.h
> +++ b/drivers/gpu/drm/i915/i915_debugfs.h
> @@ -12,10 +12,10 @@ struct drm_i915_private;
> struct seq_file;
>
> #ifdef CONFIG_DEBUG_FS
> -int i915_debugfs_register(struct drm_i915_private *dev_priv);
> +void i915_debugfs_register(struct drm_i915_private *dev_priv);
> void i915_debugfs_describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj);
> #else
> -static inline int i915_debugfs_register(struct drm_i915_private *dev_priv) { return 0; }
> +static inline void i915_debugfs_register(struct drm_i915_private *dev_priv) {}
> static inline void i915_debugfs_describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) {}
> #endif

--
Jani Nikula, Intel Open Source Graphics Center

2020-03-11 16:45:18

by Lucas Stach

[permalink] [raw]
Subject: Re: [PATCH v2 07/17] drm/etnaviv: remove check for return value of drm_debugfs_create_files()

On Di, 2020-03-10 at 16:31 +0300, Wambui Karuga wrote:
> Since commit 987d65d01356 (drm: debugfs: make
> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
> fails and only returns 0. Therefore, remove the unnecessary check of its
> return value and error handling in etnaviv_debugfs_init() and have the
> function return 0 directly.
>
> v2: have etnaviv_debugfs_init() return 0 instead of void to ensure
> individual compilation and avoid build breakage.
>
> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
> Signed-off-by: Wambui Karuga <[email protected]>

Acked-by: Lucas Stach <[email protected]>

> ---
> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 6b43c1c94e8f..a65d30a48a9d 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -233,19 +233,11 @@ static struct drm_info_list etnaviv_debugfs_list[] = {
>
> static int etnaviv_debugfs_init(struct drm_minor *minor)
> {
> - struct drm_device *dev = minor->dev;
> - int ret;
> -
> - ret = drm_debugfs_create_files(etnaviv_debugfs_list,
> - ARRAY_SIZE(etnaviv_debugfs_list),
> - minor->debugfs_root, minor);
> + drm_debugfs_create_files(etnaviv_debugfs_list,
> + ARRAY_SIZE(etnaviv_debugfs_list),
> + minor->debugfs_root, minor);
>
> - if (ret) {
> - dev_err(dev->dev, "could not install etnaviv_debugfs_list\n");
> - return ret;
> - }
> -
> - return ret;
> + return 0;
> }
> #endif
>

2020-03-12 07:56:48

by Alexey Brodkin

[permalink] [raw]
Subject: RE: [PATCH v2 05/17] drm/arc: make arcgpu_debugfs_init() return 0.

Hi Wambui,

> -----Original Message-----
> From: Wambui Karuga <[email protected]>
> Sent: Tuesday, March 10, 2020 8:31 PM
> To: [email protected]; [email protected]; Alexey Brodkin <[email protected]>
> Cc: [email protected]; [email protected]; [email protected]
> Subject: [PATCH v2 05/17] drm/arc: make arcgpu_debugfs_init() return 0.
>
> Since commit 987d65d01356 (drm: debugfs: make
> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
> fails and should return void. Therefore, remove its use as the
> return value of arcpgu_debugfs_init() and have the latter function return
> 0 directly.
>
> v2: convert the function to return 0 instead of void to avoid breaking
> the build and ensure that this individual patch compiles properly.
>
> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
> Signed-off-by: Wambui Karuga <[email protected]>

Thanks for the patch!

Acked-by: Alexey Brodkin <[email protected]>

2020-03-18 15:28:21

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH v2 10/17] drm/vram-helper: make drm_vram_mm_debugfs_init() return 0

On Tue, Mar 10, 2020 at 04:31:14PM +0300, Wambui Karuga wrote:
> Since 987d65d01356 (drm: debugfs: make
> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
> fails and should return void. Therefore, remove its use as the
> return value of drm_vram_mm_debugfs_init(), and have the function
> return 0 directly.
>
> v2: have drm_vram_mm_debugfs_init() return 0 instead of void to avoid
> introducing build issues and build breakage.
>
> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
> Signed-off-by: Wambui Karuga <[email protected]>
> Acked-by: Thomas Zimmermann <[email protected]>
> ---
> drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> index 92a11bb42365..c8bcc8609650 100644
> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> @@ -1048,14 +1048,12 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = {
> */
> int drm_vram_mm_debugfs_init(struct drm_minor *minor)
> {
> - int ret = 0;
> -
> #if defined(CONFIG_DEBUG_FS)

Just noticed that this #if here is not needed, we already have a dummy
function for that case. Care to write a quick patch to remove it? On top
of this patch series here ofc, I'm in the processing of merging the entire
pile.

Thanks, Daniel
> - ret = drm_debugfs_create_files(drm_vram_mm_debugfs_list,
> - ARRAY_SIZE(drm_vram_mm_debugfs_list),
> - minor->debugfs_root, minor);
> + drm_debugfs_create_files(drm_vram_mm_debugfs_list,
> + ARRAY_SIZE(drm_vram_mm_debugfs_list),
> + minor->debugfs_root, minor);
> #endif
> - return ret;
> + return 0;
> }
> EXPORT_SYMBOL(drm_vram_mm_debugfs_init);
>
> --
> 2.25.1
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2020-03-18 16:04:15

by Wambui Karuga

[permalink] [raw]
Subject: Re: [PATCH v2 10/17] drm/vram-helper: make drm_vram_mm_debugfs_init() return 0



On Wed, 18 Mar 2020, Daniel Vetter wrote:

> On Tue, Mar 10, 2020 at 04:31:14PM +0300, Wambui Karuga wrote:
>> Since 987d65d01356 (drm: debugfs: make
>> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
>> fails and should return void. Therefore, remove its use as the
>> return value of drm_vram_mm_debugfs_init(), and have the function
>> return 0 directly.
>>
>> v2: have drm_vram_mm_debugfs_init() return 0 instead of void to avoid
>> introducing build issues and build breakage.
>>
>> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
>> Signed-off-by: Wambui Karuga <[email protected]>
>> Acked-by: Thomas Zimmermann <[email protected]>
>> ---
>> drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++------
>> 1 file changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
>> index 92a11bb42365..c8bcc8609650 100644
>> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
>> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
>> @@ -1048,14 +1048,12 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = {
>> */
>> int drm_vram_mm_debugfs_init(struct drm_minor *minor)
>> {
>> - int ret = 0;
>> -
>> #if defined(CONFIG_DEBUG_FS)
>
> Just noticed that this #if here is not needed, we already have a dummy
> function for that case. Care to write a quick patch to remove it? On top
> of this patch series here ofc, I'm in the processing of merging the entire
> pile.
>
> Thanks, Daniel
Hi Daniel,
Without this check here, and compiling without CONFIG_DEBUG_FS, this
function is run and the drm_debugfs_create_files() does not have access to
the parameters also protected by an #if above this function. So the change
throws an error for me. Is that correct?

Thanks,
wambui karuga

>> - ret = drm_debugfs_create_files(drm_vram_mm_debugfs_list,
>> - ARRAY_SIZE(drm_vram_mm_debugfs_list),
>> - minor->debugfs_root, minor);
>> + drm_debugfs_create_files(drm_vram_mm_debugfs_list,
>> + ARRAY_SIZE(drm_vram_mm_debugfs_list),
>> + minor->debugfs_root, minor);
>> #endif
>> - return ret;
>> + return 0;
>> }
>> EXPORT_SYMBOL(drm_vram_mm_debugfs_init);
>>
>> --
>> 2.25.1
>>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
>

2020-03-18 16:32:42

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH v2 10/17] drm/vram-helper: make drm_vram_mm_debugfs_init() return 0

On Wed, Mar 18, 2020 at 5:03 PM Wambui Karuga <[email protected]> wrote:
>
>
>
> On Wed, 18 Mar 2020, Daniel Vetter wrote:
>
> > On Tue, Mar 10, 2020 at 04:31:14PM +0300, Wambui Karuga wrote:
> >> Since 987d65d01356 (drm: debugfs: make
> >> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
> >> fails and should return void. Therefore, remove its use as the
> >> return value of drm_vram_mm_debugfs_init(), and have the function
> >> return 0 directly.
> >>
> >> v2: have drm_vram_mm_debugfs_init() return 0 instead of void to avoid
> >> introducing build issues and build breakage.
> >>
> >> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
> >> Signed-off-by: Wambui Karuga <[email protected]>
> >> Acked-by: Thomas Zimmermann <[email protected]>
> >> ---
> >> drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++------
> >> 1 file changed, 4 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> >> index 92a11bb42365..c8bcc8609650 100644
> >> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> >> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> >> @@ -1048,14 +1048,12 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = {
> >> */
> >> int drm_vram_mm_debugfs_init(struct drm_minor *minor)
> >> {
> >> - int ret = 0;
> >> -
> >> #if defined(CONFIG_DEBUG_FS)
> >
> > Just noticed that this #if here is not needed, we already have a dummy
> > function for that case. Care to write a quick patch to remove it? On top
> > of this patch series here ofc, I'm in the processing of merging the entire
> > pile.
> >
> > Thanks, Daniel
> Hi Daniel,
> Without this check here, and compiling without CONFIG_DEBUG_FS, this
> function is run and the drm_debugfs_create_files() does not have access to
> the parameters also protected by an #if above this function. So the change
> throws an error for me. Is that correct?

Hm right. Other drivers don't #ifdef out their debugfs file functions
... kinda a bit disappointing that we can't do this in the neatest way
possible.

Greg, has anyone ever suggested to convert the debugfs_create_file
function (and similar things) to macros that don't use any of the
arguments, and then also annotating all the static functions/tables as
__maybe_unused and let the compiler garbage collect everything?
Instead of explicit #ifdef in all the drivers ...
-Daniel

>
> Thanks,
> wambui karuga
>
> >> - ret = drm_debugfs_create_files(drm_vram_mm_debugfs_list,
> >> - ARRAY_SIZE(drm_vram_mm_debugfs_list),
> >> - minor->debugfs_root, minor);
> >> + drm_debugfs_create_files(drm_vram_mm_debugfs_list,
> >> + ARRAY_SIZE(drm_vram_mm_debugfs_list),
> >> + minor->debugfs_root, minor);
> >> #endif
> >> - return ret;
> >> + return 0;
> >> }
> >> EXPORT_SYMBOL(drm_vram_mm_debugfs_init);
> >>
> >> --
> >> 2.25.1
> >>
> >
> > --
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> >



--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

2020-03-18 16:55:53

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH v2 00/17] drm: subsytem-wide debugfs functions refactor

On Tue, Mar 10, 2020 at 03:33:07PM +0100, Greg KH wrote:
> On Tue, Mar 10, 2020 at 04:31:04PM +0300, Wambui Karuga wrote:
> > This series includes work on various debugfs functions both in drm/core
> > and across various drivers in the subsystem.
> > Since commit 987d65d01356 (drm: debugfs: make drm_debugfs_create_files()
> > never fail), drm_debugfs_create_files() does not fail and only returns
> > zero. This series therefore removes the left over error handling and
> > checks for its return value across drm drivers.
> >
> > As a result of these changes, most drm_debugfs functions are converted
> > to return void in this series. This also enables the
> > drm_driver, debugfs_init() hook to be changed to return void.
> >
> > v2: individual driver patches have been converted to have debugfs
> > functions return 0 instead of void to prevent breaking individual driver
> > builds.
> > The last patch then converts the .debugfs_hook() and its users across
> > all drivers to return void.
>
> This looks much better to me, nice job:

Yup, really nice all!

> Reviewed-by: Greg Kroah-Hartman <[email protected]>

Thanks for the patches (and the review), everything queued up in
drm-misc-next. But missed the 5.7 feature freeze in drm unfortunately, so
heading for 5.8. Apologies for being a bit too distracted past week and
not merging this a bit more timely.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2020-03-18 17:00:27

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 10/17] drm/vram-helper: make drm_vram_mm_debugfs_init() return 0

On Wed, Mar 18, 2020 at 05:31:47PM +0100, Daniel Vetter wrote:
> On Wed, Mar 18, 2020 at 5:03 PM Wambui Karuga <[email protected]> wrote:
> >
> >
> >
> > On Wed, 18 Mar 2020, Daniel Vetter wrote:
> >
> > > On Tue, Mar 10, 2020 at 04:31:14PM +0300, Wambui Karuga wrote:
> > >> Since 987d65d01356 (drm: debugfs: make
> > >> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
> > >> fails and should return void. Therefore, remove its use as the
> > >> return value of drm_vram_mm_debugfs_init(), and have the function
> > >> return 0 directly.
> > >>
> > >> v2: have drm_vram_mm_debugfs_init() return 0 instead of void to avoid
> > >> introducing build issues and build breakage.
> > >>
> > >> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
> > >> Signed-off-by: Wambui Karuga <[email protected]>
> > >> Acked-by: Thomas Zimmermann <[email protected]>
> > >> ---
> > >> drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++------
> > >> 1 file changed, 4 insertions(+), 6 deletions(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> > >> index 92a11bb42365..c8bcc8609650 100644
> > >> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> > >> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> > >> @@ -1048,14 +1048,12 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = {
> > >> */
> > >> int drm_vram_mm_debugfs_init(struct drm_minor *minor)
> > >> {
> > >> - int ret = 0;
> > >> -
> > >> #if defined(CONFIG_DEBUG_FS)
> > >
> > > Just noticed that this #if here is not needed, we already have a dummy
> > > function for that case. Care to write a quick patch to remove it? On top
> > > of this patch series here ofc, I'm in the processing of merging the entire
> > > pile.
> > >
> > > Thanks, Daniel
> > Hi Daniel,
> > Without this check here, and compiling without CONFIG_DEBUG_FS, this
> > function is run and the drm_debugfs_create_files() does not have access to
> > the parameters also protected by an #if above this function. So the change
> > throws an error for me. Is that correct?
>
> Hm right. Other drivers don't #ifdef out their debugfs file functions
> ... kinda a bit disappointing that we can't do this in the neatest way
> possible.
>
> Greg, has anyone ever suggested to convert the debugfs_create_file
> function (and similar things) to macros that don't use any of the
> arguments, and then also annotating all the static functions/tables as
> __maybe_unused and let the compiler garbage collect everything?
> Instead of explicit #ifdef in all the drivers ...

No, no one has suggested that, having the functions be static inline
should make it all "just work" properly if debugfs is not enabled. The
variables will not be used, so the compiler should just optimize them
away properly.

No checks for CONFIG_DEBUG_FS should be needed anywhere in .c code.

thanks,

greg k-h

2020-03-18 19:12:26

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH v2 10/17] drm/vram-helper: make drm_vram_mm_debugfs_init() return 0

On Wed, Mar 18, 2020 at 5:58 PM Greg KH <[email protected]> wrote:
>
> On Wed, Mar 18, 2020 at 05:31:47PM +0100, Daniel Vetter wrote:
> > On Wed, Mar 18, 2020 at 5:03 PM Wambui Karuga <[email protected]> wrote:
> > >
> > >
> > >
> > > On Wed, 18 Mar 2020, Daniel Vetter wrote:
> > >
> > > > On Tue, Mar 10, 2020 at 04:31:14PM +0300, Wambui Karuga wrote:
> > > >> Since 987d65d01356 (drm: debugfs: make
> > > >> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
> > > >> fails and should return void. Therefore, remove its use as the
> > > >> return value of drm_vram_mm_debugfs_init(), and have the function
> > > >> return 0 directly.
> > > >>
> > > >> v2: have drm_vram_mm_debugfs_init() return 0 instead of void to avoid
> > > >> introducing build issues and build breakage.
> > > >>
> > > >> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
> > > >> Signed-off-by: Wambui Karuga <[email protected]>
> > > >> Acked-by: Thomas Zimmermann <[email protected]>
> > > >> ---
> > > >> drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++------
> > > >> 1 file changed, 4 insertions(+), 6 deletions(-)
> > > >>
> > > >> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> > > >> index 92a11bb42365..c8bcc8609650 100644
> > > >> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> > > >> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> > > >> @@ -1048,14 +1048,12 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = {
> > > >> */
> > > >> int drm_vram_mm_debugfs_init(struct drm_minor *minor)
> > > >> {
> > > >> - int ret = 0;
> > > >> -
> > > >> #if defined(CONFIG_DEBUG_FS)
> > > >
> > > > Just noticed that this #if here is not needed, we already have a dummy
> > > > function for that case. Care to write a quick patch to remove it? On top
> > > > of this patch series here ofc, I'm in the processing of merging the entire
> > > > pile.
> > > >
> > > > Thanks, Daniel
> > > Hi Daniel,
> > > Without this check here, and compiling without CONFIG_DEBUG_FS, this
> > > function is run and the drm_debugfs_create_files() does not have access to
> > > the parameters also protected by an #if above this function. So the change
> > > throws an error for me. Is that correct?
> >
> > Hm right. Other drivers don't #ifdef out their debugfs file functions
> > ... kinda a bit disappointing that we can't do this in the neatest way
> > possible.
> >
> > Greg, has anyone ever suggested to convert the debugfs_create_file
> > function (and similar things) to macros that don't use any of the
> > arguments, and then also annotating all the static functions/tables as
> > __maybe_unused and let the compiler garbage collect everything?
> > Instead of explicit #ifdef in all the drivers ...
>
> No, no one has suggested that, having the functions be static inline
> should make it all "just work" properly if debugfs is not enabled. The
> variables will not be used, so the compiler should just optimize them
> away properly.
>
> No checks for CONFIG_DEBUG_FS should be needed anywhere in .c code.

So the trouble with this one is that the static inline functions for
the debugfs file are wrapped in a #if too, and hence if we drop the
#if around the function call stuff won't compile. Should we drop all
the #if in the .c file and assume the compiler will remove all the
dead code and dead functions?
-Daniel (who has no idea how this all works really)
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

2020-03-19 07:57:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 10/17] drm/vram-helper: make drm_vram_mm_debugfs_init() return 0

On Wed, Mar 18, 2020 at 08:10:43PM +0100, Daniel Vetter wrote:
> On Wed, Mar 18, 2020 at 5:58 PM Greg KH <[email protected]> wrote:
> >
> > On Wed, Mar 18, 2020 at 05:31:47PM +0100, Daniel Vetter wrote:
> > > On Wed, Mar 18, 2020 at 5:03 PM Wambui Karuga <[email protected]> wrote:
> > > >
> > > >
> > > >
> > > > On Wed, 18 Mar 2020, Daniel Vetter wrote:
> > > >
> > > > > On Tue, Mar 10, 2020 at 04:31:14PM +0300, Wambui Karuga wrote:
> > > > >> Since 987d65d01356 (drm: debugfs: make
> > > > >> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
> > > > >> fails and should return void. Therefore, remove its use as the
> > > > >> return value of drm_vram_mm_debugfs_init(), and have the function
> > > > >> return 0 directly.
> > > > >>
> > > > >> v2: have drm_vram_mm_debugfs_init() return 0 instead of void to avoid
> > > > >> introducing build issues and build breakage.
> > > > >>
> > > > >> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
> > > > >> Signed-off-by: Wambui Karuga <[email protected]>
> > > > >> Acked-by: Thomas Zimmermann <[email protected]>
> > > > >> ---
> > > > >> drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++------
> > > > >> 1 file changed, 4 insertions(+), 6 deletions(-)
> > > > >>
> > > > >> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> > > > >> index 92a11bb42365..c8bcc8609650 100644
> > > > >> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> > > > >> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> > > > >> @@ -1048,14 +1048,12 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = {
> > > > >> */
> > > > >> int drm_vram_mm_debugfs_init(struct drm_minor *minor)
> > > > >> {
> > > > >> - int ret = 0;
> > > > >> -
> > > > >> #if defined(CONFIG_DEBUG_FS)
> > > > >
> > > > > Just noticed that this #if here is not needed, we already have a dummy
> > > > > function for that case. Care to write a quick patch to remove it? On top
> > > > > of this patch series here ofc, I'm in the processing of merging the entire
> > > > > pile.
> > > > >
> > > > > Thanks, Daniel
> > > > Hi Daniel,
> > > > Without this check here, and compiling without CONFIG_DEBUG_FS, this
> > > > function is run and the drm_debugfs_create_files() does not have access to
> > > > the parameters also protected by an #if above this function. So the change
> > > > throws an error for me. Is that correct?
> > >
> > > Hm right. Other drivers don't #ifdef out their debugfs file functions
> > > ... kinda a bit disappointing that we can't do this in the neatest way
> > > possible.
> > >
> > > Greg, has anyone ever suggested to convert the debugfs_create_file
> > > function (and similar things) to macros that don't use any of the
> > > arguments, and then also annotating all the static functions/tables as
> > > __maybe_unused and let the compiler garbage collect everything?
> > > Instead of explicit #ifdef in all the drivers ...
> >
> > No, no one has suggested that, having the functions be static inline
> > should make it all "just work" properly if debugfs is not enabled. The
> > variables will not be used, so the compiler should just optimize them
> > away properly.
> >
> > No checks for CONFIG_DEBUG_FS should be needed anywhere in .c code.
>
> So the trouble with this one is that the static inline functions for
> the debugfs file are wrapped in a #if too, and hence if we drop the
> #if around the function call stuff won't compile. Should we drop all
> the #if in the .c file and assume the compiler will remove all the
> dead code and dead functions?

Yes you should :)

there should not be any need for #if in a .c file for debugfs stuff.

thanks,

greg k-h

2020-03-19 10:20:04

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH v2 10/17] drm/vram-helper: make drm_vram_mm_debugfs_init() return 0

On Thu, Mar 19, 2020 at 08:55:24AM +0100, Greg KH wrote:
> On Wed, Mar 18, 2020 at 08:10:43PM +0100, Daniel Vetter wrote:
> > On Wed, Mar 18, 2020 at 5:58 PM Greg KH <[email protected]> wrote:
> > >
> > > On Wed, Mar 18, 2020 at 05:31:47PM +0100, Daniel Vetter wrote:
> > > > On Wed, Mar 18, 2020 at 5:03 PM Wambui Karuga <[email protected]> wrote:
> > > > >
> > > > >
> > > > >
> > > > > On Wed, 18 Mar 2020, Daniel Vetter wrote:
> > > > >
> > > > > > On Tue, Mar 10, 2020 at 04:31:14PM +0300, Wambui Karuga wrote:
> > > > > >> Since 987d65d01356 (drm: debugfs: make
> > > > > >> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
> > > > > >> fails and should return void. Therefore, remove its use as the
> > > > > >> return value of drm_vram_mm_debugfs_init(), and have the function
> > > > > >> return 0 directly.
> > > > > >>
> > > > > >> v2: have drm_vram_mm_debugfs_init() return 0 instead of void to avoid
> > > > > >> introducing build issues and build breakage.
> > > > > >>
> > > > > >> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
> > > > > >> Signed-off-by: Wambui Karuga <[email protected]>
> > > > > >> Acked-by: Thomas Zimmermann <[email protected]>
> > > > > >> ---
> > > > > >> drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++------
> > > > > >> 1 file changed, 4 insertions(+), 6 deletions(-)
> > > > > >>
> > > > > >> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> > > > > >> index 92a11bb42365..c8bcc8609650 100644
> > > > > >> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> > > > > >> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> > > > > >> @@ -1048,14 +1048,12 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = {
> > > > > >> */
> > > > > >> int drm_vram_mm_debugfs_init(struct drm_minor *minor)
> > > > > >> {
> > > > > >> - int ret = 0;
> > > > > >> -
> > > > > >> #if defined(CONFIG_DEBUG_FS)
> > > > > >
> > > > > > Just noticed that this #if here is not needed, we already have a dummy
> > > > > > function for that case. Care to write a quick patch to remove it? On top
> > > > > > of this patch series here ofc, I'm in the processing of merging the entire
> > > > > > pile.
> > > > > >
> > > > > > Thanks, Daniel
> > > > > Hi Daniel,
> > > > > Without this check here, and compiling without CONFIG_DEBUG_FS, this
> > > > > function is run and the drm_debugfs_create_files() does not have access to
> > > > > the parameters also protected by an #if above this function. So the change
> > > > > throws an error for me. Is that correct?
> > > >
> > > > Hm right. Other drivers don't #ifdef out their debugfs file functions
> > > > ... kinda a bit disappointing that we can't do this in the neatest way
> > > > possible.
> > > >
> > > > Greg, has anyone ever suggested to convert the debugfs_create_file
> > > > function (and similar things) to macros that don't use any of the
> > > > arguments, and then also annotating all the static functions/tables as
> > > > __maybe_unused and let the compiler garbage collect everything?
> > > > Instead of explicit #ifdef in all the drivers ...
> > >
> > > No, no one has suggested that, having the functions be static inline
> > > should make it all "just work" properly if debugfs is not enabled. The
> > > variables will not be used, so the compiler should just optimize them
> > > away properly.
> > >
> > > No checks for CONFIG_DEBUG_FS should be needed anywhere in .c code.
> >
> > So the trouble with this one is that the static inline functions for
> > the debugfs file are wrapped in a #if too, and hence if we drop the
> > #if around the function call stuff won't compile. Should we drop all
> > the #if in the .c file and assume the compiler will remove all the
> > dead code and dead functions?
>
> Yes you should :)
>
> there should not be any need for #if in a .c file for debugfs stuff.

Wambui, can you pls try that out? I.e. removing all the #if for
CONFIG_DEBUG_FS from that file.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2020-03-19 12:28:38

by Wambui Karuga

[permalink] [raw]
Subject: Re: [PATCH v2 10/17] drm/vram-helper: make drm_vram_mm_debugfs_init() return 0



On Thu, 19 Mar 2020, Daniel Vetter wrote:

> On Thu, Mar 19, 2020 at 08:55:24AM +0100, Greg KH wrote:
>> On Wed, Mar 18, 2020 at 08:10:43PM +0100, Daniel Vetter wrote:
>>> On Wed, Mar 18, 2020 at 5:58 PM Greg KH <[email protected]> wrote:
>>>>
>>>> On Wed, Mar 18, 2020 at 05:31:47PM +0100, Daniel Vetter wrote:
>>>>> On Wed, Mar 18, 2020 at 5:03 PM Wambui Karuga <[email protected]> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wed, 18 Mar 2020, Daniel Vetter wrote:
>>>>>>
>>>>>>> On Tue, Mar 10, 2020 at 04:31:14PM +0300, Wambui Karuga wrote:
>>>>>>>> Since 987d65d01356 (drm: debugfs: make
>>>>>>>> drm_debugfs_create_files() never fail), drm_debugfs_create_files() never
>>>>>>>> fails and should return void. Therefore, remove its use as the
>>>>>>>> return value of drm_vram_mm_debugfs_init(), and have the function
>>>>>>>> return 0 directly.
>>>>>>>>
>>>>>>>> v2: have drm_vram_mm_debugfs_init() return 0 instead of void to avoid
>>>>>>>> introducing build issues and build breakage.
>>>>>>>>
>>>>>>>> References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
>>>>>>>> Signed-off-by: Wambui Karuga <[email protected]>
>>>>>>>> Acked-by: Thomas Zimmermann <[email protected]>
>>>>>>>> ---
>>>>>>>> drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++------
>>>>>>>> 1 file changed, 4 insertions(+), 6 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
>>>>>>>> index 92a11bb42365..c8bcc8609650 100644
>>>>>>>> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
>>>>>>>> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
>>>>>>>> @@ -1048,14 +1048,12 @@ static const struct drm_info_list drm_vram_mm_debugfs_list[] = {
>>>>>>>> */
>>>>>>>> int drm_vram_mm_debugfs_init(struct drm_minor *minor)
>>>>>>>> {
>>>>>>>> - int ret = 0;
>>>>>>>> -
>>>>>>>> #if defined(CONFIG_DEBUG_FS)
>>>>>>>
>>>>>>> Just noticed that this #if here is not needed, we already have a dummy
>>>>>>> function for that case. Care to write a quick patch to remove it? On top
>>>>>>> of this patch series here ofc, I'm in the processing of merging the entire
>>>>>>> pile.
>>>>>>>
>>>>>>> Thanks, Daniel
>>>>>> Hi Daniel,
>>>>>> Without this check here, and compiling without CONFIG_DEBUG_FS, this
>>>>>> function is run and the drm_debugfs_create_files() does not have access to
>>>>>> the parameters also protected by an #if above this function. So the change
>>>>>> throws an error for me. Is that correct?
>>>>>
>>>>> Hm right. Other drivers don't #ifdef out their debugfs file functions
>>>>> ... kinda a bit disappointing that we can't do this in the neatest way
>>>>> possible.
>>>>>
>>>>> Greg, has anyone ever suggested to convert the debugfs_create_file
>>>>> function (and similar things) to macros that don't use any of the
>>>>> arguments, and then also annotating all the static functions/tables as
>>>>> __maybe_unused and let the compiler garbage collect everything?
>>>>> Instead of explicit #ifdef in all the drivers ...
>>>>
>>>> No, no one has suggested that, having the functions be static inline
>>>> should make it all "just work" properly if debugfs is not enabled. The
>>>> variables will not be used, so the compiler should just optimize them
>>>> away properly.
>>>>
>>>> No checks for CONFIG_DEBUG_FS should be needed anywhere in .c code.
>>>
>>> So the trouble with this one is that the static inline functions for
>>> the debugfs file are wrapped in a #if too, and hence if we drop the
>>> #if around the function call stuff won't compile. Should we drop all
>>> the #if in the .c file and assume the compiler will remove all the
>>> dead code and dead functions?
>>
>> Yes you should :)
>>
>> there should not be any need for #if in a .c file for debugfs stuff.
>
> Wambui, can you pls try that out? I.e. removing all the #if for
> CONFIG_DEBUG_FS from that file.

Removing them works with CONFIG_DEBUG_FS enabled or disabled.
I can send a patch for that.

wambui karuga
> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
>

2020-04-07 06:37:48

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH v2 10/17] drm/vram-helper: make drm_vram_mm_debugfs_init() return 0

Hi

Am 19.03.20 um 13:27 schrieb Wambui Karuga:
>
>
> On Thu, 19 Mar 2020, Daniel Vetter wrote:
>
>> On Thu, Mar 19, 2020 at 08:55:24AM +0100, Greg KH wrote:
>>> On Wed, Mar 18, 2020 at 08:10:43PM +0100, Daniel Vetter wrote:
>>>> On Wed, Mar 18, 2020 at 5:58 PM Greg KH <[email protected]>
>>>> wrote:
>>>>>
>>>>> On Wed, Mar 18, 2020 at 05:31:47PM +0100, Daniel Vetter wrote:
>>>>>> On Wed, Mar 18, 2020 at 5:03 PM Wambui Karuga
>>>>>> <[email protected]> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, 18 Mar 2020, Daniel Vetter wrote:
>>>>>>>
>>>>>>>> On Tue, Mar 10, 2020 at 04:31:14PM +0300, Wambui Karuga wrote:
>>>>>>>>> Since 987d65d01356 (drm: debugfs: make
>>>>>>>>> drm_debugfs_create_files() never fail),
>>>>>>>>> drm_debugfs_create_files() never
>>>>>>>>> fails and should return void. Therefore, remove its use as the
>>>>>>>>> return value of drm_vram_mm_debugfs_init(), and have the function
>>>>>>>>> return 0 directly.
>>>>>>>>>
>>>>>>>>> v2: have drm_vram_mm_debugfs_init() return 0 instead of void to
>>>>>>>>> avoid
>>>>>>>>> introducing build issues and build breakage.
>>>>>>>>>
>>>>>>>>> References:
>>>>>>>>> https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html
>>>>>>>>>
>>>>>>>>> Signed-off-by: Wambui Karuga <[email protected]>
>>>>>>>>> Acked-by: Thomas Zimmermann <[email protected]>
>>>>>>>>> ---
>>>>>>>>>  drivers/gpu/drm/drm_gem_vram_helper.c | 10 ++++------
>>>>>>>>>  1 file changed, 4 insertions(+), 6 deletions(-)
>>>>>>>>>
>>>>>>>>> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c
>>>>>>>>> b/drivers/gpu/drm/drm_gem_vram_helper.c
>>>>>>>>> index 92a11bb42365..c8bcc8609650 100644
>>>>>>>>> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
>>>>>>>>> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
>>>>>>>>> @@ -1048,14 +1048,12 @@ static const struct drm_info_list
>>>>>>>>> drm_vram_mm_debugfs_list[] = {
>>>>>>>>>   */
>>>>>>>>>  int drm_vram_mm_debugfs_init(struct drm_minor *minor)
>>>>>>>>>  {
>>>>>>>>> -    int ret = 0;
>>>>>>>>> -
>>>>>>>>>  #if defined(CONFIG_DEBUG_FS)
>>>>>>>>
>>>>>>>> Just noticed that this #if here is not needed, we already have a
>>>>>>>> dummy
>>>>>>>> function for that case. Care to write a quick patch to remove
>>>>>>>> it? On top
>>>>>>>> of this patch series here ofc, I'm in the processing of merging
>>>>>>>> the entire
>>>>>>>> pile.
>>>>>>>>
>>>>>>>> Thanks, Daniel
>>>>>>> Hi Daniel,
>>>>>>> Without this check here, and compiling without CONFIG_DEBUG_FS, this
>>>>>>> function is run and the drm_debugfs_create_files() does not have
>>>>>>> access to
>>>>>>> the parameters also protected by an #if above this function. So
>>>>>>> the change
>>>>>>> throws an error for me. Is that correct?
>>>>>>
>>>>>> Hm right. Other drivers don't #ifdef out their debugfs file functions
>>>>>> ... kinda a bit disappointing that we can't do this in the neatest
>>>>>> way
>>>>>> possible.
>>>>>>
>>>>>> Greg, has anyone ever suggested to convert the debugfs_create_file
>>>>>> function (and similar things) to macros that don't use any of the
>>>>>> arguments, and then also annotating all the static
>>>>>> functions/tables as
>>>>>> __maybe_unused and let the compiler garbage collect everything?
>>>>>> Instead of explicit #ifdef in all the drivers ...
>>>>>
>>>>> No, no one has suggested that, having the functions be static inline
>>>>> should make it all "just work" properly if debugfs is not enabled. 
>>>>> The
>>>>> variables will not be used, so the compiler should just optimize them
>>>>> away properly.
>>>>>
>>>>> No checks for CONFIG_DEBUG_FS should be needed anywhere in .c code.
>>>>
>>>> So the trouble with this one is that the static inline functions for
>>>> the debugfs file are wrapped in a #if too, and hence if we drop the
>>>> #if around the function call stuff won't compile. Should we drop all
>>>> the #if in the .c file and assume the compiler will remove all the
>>>> dead code and dead functions?
>>>
>>> Yes you should :)
>>>
>>> there should not be any need for #if in a .c file for debugfs stuff.
>>
>> Wambui, can you pls try that out? I.e. removing all the #if for
>> CONFIG_DEBUG_FS from that file.
>
> Removing them works with CONFIG_DEBUG_FS enabled or disabled.
> I can send a patch for that.

Please do. Removing explicit checks for CONFIG_ is usually a good thing.

Best regards
Thomas

>
> wambui karuga
>> -Daniel
>> -- 
>> Daniel Vetter
>> Software Engineer, Intel Corporation
>> http://blog.ffwll.ch
>>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


Attachments:
signature.asc (499.00 B)
OpenPGP digital signature