drm/tegra: fix non-debugfs builds

Message ID 20171218134519.3042726-1-arnd@arndb.de
State Accepted
Headers show
Series
  • drm/tegra: fix non-debugfs builds
Related show

Commit Message

Arnd Bergmann Dec. 18, 2017, 1:44 p.m.
The new debugfs registration fails to build when CONFIG_DEBUGFS is
disabled, because the drm_crtc structure is lacking a member in that
configuration:

drivers/gpu/drm/tegra/dc.c: In function 'tegra_dc_late_register':
drivers/gpu/drm/tegra/dc.c:1204:28: error: 'struct drm_crtc' has no member named 'debugfs_entry'

Without CONFIG_DEBUGFS, the rest of the function already degrades
into nothing, so we just avoid the one assignment.

Fixes: b95800eeef09 ("drm/tegra: dc: Register debugfs in ->late_register()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/tegra/dc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Thierry Reding Dec. 20, 2017, 6:59 p.m. | #1
On Mon, Dec 18, 2017 at 02:44:46PM +0100, Arnd Bergmann wrote:
> The new debugfs registration fails to build when CONFIG_DEBUGFS is
> disabled, because the drm_crtc structure is lacking a member in that
> configuration:
> 
> drivers/gpu/drm/tegra/dc.c: In function 'tegra_dc_late_register':
> drivers/gpu/drm/tegra/dc.c:1204:28: error: 'struct drm_crtc' has no member named 'debugfs_entry'
> 
> Without CONFIG_DEBUGFS, the rest of the function already degrades
> into nothing, so we just avoid the one assignment.
> 
> Fixes: b95800eeef09 ("drm/tegra: dc: Register debugfs in ->late_register()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/tegra/dc.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

I don't think I replied, but I had applied this yesterday, so this
should be fixed in linux-next today.

Thierry

Patch

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index e963e40d8a25..e8a0cad5899c 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -1201,10 +1201,16 @@  static int tegra_dc_late_register(struct drm_crtc *crtc)
 {
 	unsigned int i, count = ARRAY_SIZE(debugfs_files);
 	struct drm_minor *minor = crtc->dev->primary;
-	struct dentry *root = crtc->debugfs_entry;
+	struct dentry *root;
 	struct tegra_dc *dc = to_tegra_dc(crtc);
 	int err;
 
+#ifdef CONFIG_DEBUG_FS
+	root = crtc->debugfs_entry;
+#else
+	root = NULL;
+#endif
+
 	dc->debugfs_files = kmemdup(debugfs_files, sizeof(debugfs_files),
 				    GFP_KERNEL);
 	if (!dc->debugfs_files)