Skip to contentSkip to conversation

drm/panic: Add missing static inline to drm_panic_is_enabled()

PATCH In review Jocelyn Falempe 2 participants 5 messages Jul 19, 2024

Subsystems (3)
lore
Share & tools
lore

Jocelyn Falempe

author maintainer
#0 lore raw

PATCH v2 1/1 drm/panic: Add missing static inline to drm_panic_is_enabled()

This breaks build if DRM_PANIC is not enabled.
Also add the missing include drm_crtc_internal.h in drm_panic.c

Fixes 9f774c42a908 ("drm/panic: Add drm_panic_is_enabled()")
---
 drivers/gpu/drm/drm_crtc_internal.h | 2 +-
 drivers/gpu/drm/drm_panic.c         | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_crtc_internal.h +1 -1
index c10de39cbe83..bbac5350774e 100644
@@ -321,7 +321,7 @@ drm_edid_load_firmware(struct drm_connector *connector)
 #ifdef CONFIG_DRM_PANIC
 bool drm_panic_is_enabled(struct drm_device *dev);
 #else
-bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
+static inline bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
 #endif
 
 #endif /* __DRM_CRTC_INTERNAL_H__ */
drivers/gpu/drm/drm_panic.c +2 -0
index 9f1a3568e62d..072752b658f0 100644
@@ -27,6 +27,8 @@
 #include <drm/drm_plane.h>
 #include <drm/drm_print.h>
 
+#include "drm_crtc_internal.h"
+
 MODULE_AUTHOR("Jocelyn Falempe");
 MODULE_DESCRIPTION("DRM panic handler");
 MODULE_LICENSE("GPL");
Signature · 1 line
2.45.2
#1 lore raw
Quoted 15 lines · Jocelyn Falempe

This breaks build if DRM_PANIC is not enabled.
Also add the missing include drm_crtc_internal.h in drm_panic.c

Fixes 9f774c42a908 ("drm/panic: Add drm_panic_is_enabled()")
---
 drivers/gpu/drm/drm_crtc_internal.h | 2 +-
 drivers/gpu/drm/drm_panic.c         | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_crtc_internal.h +0 -0
index c10de39cbe83..bbac5350774e 100644

drivers/gpu/drm/drm_crtc_internal.h drm_edid_load_firmware(struct drm_connector *connector) · line 325

Quoted 6 lines
drivers/gpu/drm/drm_crtc_internal.h +1 -1
@@ -321,7 +321,7 @@ drm_edid_load_firmware(struct drm_connector *connector)
 #ifdef CONFIG_DRM_PANIC
 bool drm_panic_is_enabled(struct drm_device *dev);
 #else
-bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
+static inline bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
 #endif

shouldn't this whole chunk be part of <drm/drm_panic.h> ? other exported drm_panic functions have forward declarations there

drivers/gpu/drm/drm_panic.c line 30

Quoted 11 lines
drivers/gpu/drm/drm_crtc_internal.h +0 -0
 #endif /* __DRM_CRTC_INTERNAL_H__ */
drivers/gpu/drm/drm_panic.c +1 -0
index 9f1a3568e62d..072752b658f0 100644
@@ -27,6 +27,8 @@
 #include <drm/drm_plane.h>
 #include <drm/drm_print.h>
 
+#include "drm_crtc_internal.h"

then you will not need this include here

Quoted 4 lines
drivers/gpu/drm/drm_panic.c +1 -0
+
 MODULE_AUTHOR("Jocelyn Falempe");
 MODULE_DESCRIPTION("DRM panic handler");
 MODULE_LICENSE("GPL");
author maintainer
#2 lore raw
Quoted 13 lines · Michal Wajdeczko
Quoted 10 lines · Jocelyn Falempe

This breaks build if DRM_PANIC is not enabled.
Also add the missing include drm_crtc_internal.h in drm_panic.c

Fixes 9f774c42a908 ("drm/panic: Add drm_panic_is_enabled()")
---
  drivers/gpu/drm/drm_crtc_internal.h | 2 +-
  drivers/gpu/drm/drm_panic.c         | 2 ++
  2 files changed, 3 insertions(+), 1 deletion(-)
Quoted 15 lines

drivers/gpu/drm/drm_crtc_internal.h drm_edid_load_firmware(struct drm_connector *connector) · line 325

Quoted 11 lines
drivers/gpu/drm/drm_crtc_internal.h +1 -1
index c10de39cbe83..bbac5350774e 100644
@@ -321,7 +321,7 @@ drm_edid_load_firmware(struct drm_connector *connector)
  #ifdef CONFIG_DRM_PANIC
  bool drm_panic_is_enabled(struct drm_device *dev);
  #else
-bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
+static inline bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
  #endif

shouldn't this whole chunk be part of <drm/drm_panic.h> ? other exported drm_panic functions have forward declarations there

drm/drm_panic.h is for GPU drivers implementing drm_panic. And they don't need this function.

This function is only for drm internal (it's called from drm_fb_helper.c).

Sima suggested this change in my previous series:
https://lists.freedesktop.org/archives/dri-devel/2024-July/462375.html

I will move drm_panic_[un]register() prototypes there for the same reason in follow-up patch.

Signature · 1 line
Jocelyn
Quoted 19 lines

drivers/gpu/drm/drm_panic.c line 30

Quoted 11 lines
drivers/gpu/drm/drm_crtc_internal.h +0 -0
  #endif /* __DRM_CRTC_INTERNAL_H__ */
drivers/gpu/drm/drm_panic.c +1 -0
index 9f1a3568e62d..072752b658f0 100644
@@ -27,6 +27,8 @@
  #include <drm/drm_plane.h>
  #include <drm/drm_print.h>
 
+#include "drm_crtc_internal.h"

then you will not need this include here

Quoted 4 lines
drivers/gpu/drm/drm_panic.c +1 -0
+
  MODULE_AUTHOR("Jocelyn Falempe");
  MODULE_DESCRIPTION("DRM panic handler");
  MODULE_LICENSE("GPL");
Reviewed-by
#3 lore raw
Quoted 16 lines · Jocelyn Falempe
Quoted 13 lines · Michal Wajdeczko
Quoted 10 lines · Jocelyn Falempe

This breaks build if DRM_PANIC is not enabled.
Also add the missing include drm_crtc_internal.h in drm_panic.c

Fixes 9f774c42a908 ("drm/panic: Add drm_panic_is_enabled()")

---
  drivers/gpu/drm/drm_crtc_internal.h | 2 +-
  drivers/gpu/drm/drm_panic.c         | 2 ++

  2 files changed, 3 insertions(+), 1 deletion(-)
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/drm_crtc_internal.h +0 -0
index c10de39cbe83..bbac5350774e 100644
Quoted 8 lines

drivers/gpu/drm/drm_crtc_internal.h drm_edid_load_firmware(struct drm_connector · line 326

Quoted 8 lines
drivers/gpu/drm/drm_crtc_internal.h +1 -1
@@ -321,7 +321,7 @@ drm_edid_load_firmware(struct drm_connector
 *connector)
   #ifdef CONFIG_DRM_PANIC
   bool drm_panic_is_enabled(struct drm_device *dev);
   #else
-bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
+static inline bool drm_panic_is_enabled(struct drm_device *dev)
 {return false; }

btw, missing space after opening {

did you run checkpatch.pl ?

Quoted 8 lines
Quoted 5 lines

drivers/gpu/drm/drm_crtc_internal.h drm_edid_load_firmware(struct drm_connector · line 327

Quoted 1 line
drivers/gpu/drm/drm_crtc_internal.h +0 -0
   #endif

shouldn't this whole chunk be part of <drm/drm_panic.h> ? other exported drm_panic functions have forward declarations there

drm/drm_panic.h is for GPU drivers implementing drm_panic. And they don't need this function.

Quoted 8 lines

This function is only for drm internal (it's called from drm_fb_helper.c).

Sima suggested this change in my previous series:
https://lists.freedesktop.org/archives/dri-devel/2024-July/462375.html

I will move drm_panic_[un]register() prototypes there for the same reason in follow-up patch.

hmm, but then IMO there is a little (?) problem with the layering, as drm_panic.h no longer matches drm_panic.c and forward decls for functions from drm_panic.c are in some random internal header

but that's probably topic for another discussion, and now we need to fix the drm-tip ASAP, so with above nit fixed:

author maintainer
#4 lore raw
Quoted 35 lines · Michal Wajdeczko
Quoted 16 lines · Jocelyn Falempe
Quoted 13 lines · Michal Wajdeczko
Quoted 10 lines · Jocelyn Falempe

This breaks build if DRM_PANIC is not enabled.
Also add the missing include drm_crtc_internal.h in drm_panic.c

Fixes 9f774c42a908 ("drm/panic: Add drm_panic_is_enabled()")
---
   drivers/gpu/drm/drm_crtc_internal.h | 2 +-
   drivers/gpu/drm/drm_panic.c         | 2 ++
   2 files changed, 3 insertions(+), 1 deletion(-)
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/drm_crtc_internal.h +0 -0
index c10de39cbe83..bbac5350774e 100644
Quoted 8 lines

drivers/gpu/drm/drm_crtc_internal.h drm_edid_load_firmware(struct drm_connector · line 326

Quoted 8 lines
drivers/gpu/drm/drm_crtc_internal.h +1 -1
@@ -321,7 +321,7 @@ drm_edid_load_firmware(struct drm_connector
 *connector)
   #ifdef CONFIG_DRM_PANIC
   bool drm_panic_is_enabled(struct drm_device *dev);
   #else
-bool drm_panic_is_enabled(struct drm_device *dev) {return false; }
+static inline bool drm_panic_is_enabled(struct drm_device *dev)
 {return false; }

btw, missing space after opening {

Quoted 1 line

did you run checkpatch.pl ?

Yes, but it looks like he doesn't check this case. I got the same:
./scripts/checkpatch.pl -g HEAD
total: 0 errors, 0 warnings, 16 lines checked

with or without space here.

Quoted 14 lines
Quoted 14 lines
Quoted 6 lines

drivers/gpu/drm/drm_crtc_internal.h drm_edid_load_firmware(struct drm_connector · line 327

Quoted 2 lines
drivers/gpu/drm/drm_crtc_internal.h +0 -0
   #endif

shouldn't this whole chunk be part of <drm/drm_panic.h> ? other exported drm_panic functions have forward declarations there

drm/drm_panic.h is for GPU drivers implementing drm_panic. And they don't need this function.

This function is only for drm internal (it's called from drm_fb_helper.c).

Sima suggested this change in my previous series:
https://lists.freedesktop.org/archives/dri-devel/2024-July/462375.html

Quoted 8 lines
Quoted 3 lines

I will move drm_panic_[un]register() prototypes there for the same reason in follow-up patch.

hmm, but then IMO there is a little (?) problem with the layering, as drm_panic.h no longer matches drm_panic.c and forward decls for functions from drm_panic.c are in some random internal header

The problem it want to solve is to avoid external kernel modules to rely on internal functions. Maybe for something cleaner, I could create a drm_panic_internal.h, but I find it a bit too much.

I will submit the patch to move drm_panic_[un]register() next week, and we will discuss that here.

Quoted 5 lines

but that's probably topic for another discussion, and now we need to fix the drm-tip ASAP, so with above nit fixed:

Thanks a lot, I will push it asap to unblock the build.

Best regards,

Signature · 1 line
Jocelyn