Skip to contentSkip to conversation

Turn display finalizers into static functions

PATCH In review Gustavo Sousa 3 participants 4 messages Sep 8, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Turn display finalizers into static functions

Finalizer counterparts of display initializers are registered with drmm_add_action_or_reset(). Since there are no other explicit users of them outside of xe_display.c, let's turn them into static functions.

Gustavo Sousa (1):
fixup! drm/xe/display: Implement display support

 drivers/gpu/drm/xe/xe_display.c |  6 +++---
 drivers/gpu/drm/xe/xe_display.h | 15 +--------------
 2 files changed, 4 insertions(+), 17 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/1 fixup! drm/xe/display: Implement display support

Finalizer counterparts of display initializers are registered with drmm_add_action_or_reset(). Since there are no other explicit users of them outside of xe_display.c, let's turn them into static functions.

---
 drivers/gpu/drm/xe/xe_display.c |  6 +++---
 drivers/gpu/drm/xe/xe_display.h | 15 +--------------
 2 files changed, 4 insertions(+), 17 deletions(-)
drivers/gpu/drm/xe/xe_display.c +3 -3
index a453946ad108..3d15d3ac431f 100644
@@ -132,7 +132,7 @@ int xe_display_create(struct xe_device *xe)
 	return 0;
 }
 
-void xe_display_fini_nommio(struct drm_device *dev, void *dummy)
+static void xe_display_fini_nommio(struct drm_device *dev, void *dummy)
 {
 	struct xe_device *xe = to_xe_device(dev);
 
@@ -164,7 +164,7 @@ int xe_display_init_nommio(struct xe_device *xe)
 	return drmm_add_action_or_reset(&xe->drm, xe_display_fini_nommio, xe);
 }
 
-void xe_display_fini_noirq(struct drm_device *dev, void *dummy)
+static void xe_display_fini_noirq(struct drm_device *dev, void *dummy)
 {
 	struct xe_device *xe = to_xe_device(dev);
 
@@ -204,7 +204,7 @@ int xe_display_init_noirq(struct xe_device *xe)
 	return drmm_add_action_or_reset(&xe->drm, xe_display_fini_noirq, NULL);
 }
 
-void xe_display_fini_noaccel(struct drm_device *dev, void *dummy)
+static void xe_display_fini_noaccel(struct drm_device *dev, void *dummy)
 {
 	struct xe_device *xe = to_xe_device(dev);
 
drivers/gpu/drm/xe/xe_display.h +1 -14
index 9e29de012df7..71e0bd27f1eb 100644
@@ -20,13 +20,8 @@ int xe_display_create(struct xe_device *xe);
 void xe_display_info_init(struct xe_device *xe);
 
 int xe_display_init_nommio(struct xe_device *xe);
-void xe_display_fini_nommio(struct drm_device *dev, void *dummy);
-
 int xe_display_init_noirq(struct xe_device *xe);
-void xe_display_fini_noirq(struct drm_device *dev, void *dummy);
-
 int xe_display_init_noaccel(struct xe_device *xe);
-void xe_display_fini_noaccel(struct drm_device *dev, void *dummy);
 
 int xe_display_init(struct xe_device *xe);
 void xe_display_unlink(struct xe_device *xe);
@@ -60,17 +55,9 @@ static inline void xe_display_info_init(struct xe_device *xe) { }
 static inline int
 xe_display_enable(struct pci_dev *pdev, struct drm_driver *driver) { return 0; }
 
-static inline int
-xe_display_init_nommio(struct xe_device *xe) { return 0; }
-static inline void xe_display_fini_nommio(struct drm_device *dev, void *dummy) {}
-
+static inline int xe_display_init_nommio(struct xe_device *xe) { return 0; }
 static inline int xe_display_init_noirq(struct xe_device *xe) { return 0; }
-
-static inline void
-xe_display_fini_noirq(struct drm_device *dev, void *dummy) {}
-
 static inline int xe_display_init_noaccel(struct xe_device *xe) { return 0; }
-static inline void xe_display_fini_noaccel(struct drm_device *dev, void *dummy) {}
 
 static inline int xe_display_init(struct xe_device *xe) { return 0; }
 static inline void xe_display_unlink(struct xe_device *xe) {}
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#2 lore raw

Re: [Intel-xe] [PATCH 1/1] fixup! drm/xe/display: Implement display support

Quoted 5 lines · Gustavo Sousa

Finalizer counterparts of display initializers are registered with drmm_add_action_or_reset(). Since there are no other explicit users of them outside of xe_display.c, let's turn them into static functions.

since this is a fixup patch, what about squeezing a few more renames and cleanups?

1) xe_display_modset_driver_remove()... there was a typo s/modset/modeset/ but I think just using xe_display_driver would be better
2) Group functions by namespace
3) Remove unused inline function
4) s/unlink/shutdown/ to follow naming nearby

Lucas De Marchi

drivers/gpu/drm/xe/xe_device.c +4 -4
index b3ecbbd6d020b..0141fd53a41cf 100644
@@ -344,12 +344,12 @@ int xe_device_probe(struct xe_device *xe)
 	return 0;
 
 err_fini_display:
-	xe_display_modset_driver_remove(xe);
+	xe_display_driver_remove(xe);
 
 err_irq_shutdown:
 	xe_irq_shutdown(xe);
 err:
-	xe_display_unlink(xe);
+	xe_display_shutdown(xe);
 	return err;
 }
 
@@ -358,14 +358,14 @@ static void xe_device_remove_display(struct xe_device *xe)
 	xe_display_unregister(xe);
 
 	drm_dev_unplug(&xe->drm);
-	xe_display_modset_driver_remove(xe);
+	xe_display_driver_remove(xe);
 }
 
 void xe_device_remove(struct xe_device *xe)
 {
 	xe_device_remove_display(xe);
 
-	xe_display_unlink(xe);
+	xe_display_shutdown(xe);
 
 	xe_irq_shutdown(xe);
 }
drivers/gpu/drm/xe/xe_display.c +2 -2
index 3d15d3ac431f9..32b703af44931 100644
@@ -236,7 +236,7 @@ int xe_display_init(struct xe_device *xe)
 	return intel_display_driver_probe(xe);
 }
 
-void xe_display_unlink(struct xe_device *xe)
+void xe_display_shutdown(struct xe_device *xe)
 {
 	if (!xe->info.enable_display)
 		return;
@@ -269,7 +269,7 @@ void xe_display_unregister(struct xe_device *xe)
 	intel_display_driver_unregister(xe);
 }
 
-void xe_display_modset_driver_remove(struct xe_device *xe)
+void xe_display_driver_remove(struct xe_device *xe)
 {
 	if (!xe->info.enable_display)
 		return;
drivers/gpu/drm/xe/xe_display.h +5 -13
index 71e0bd27f1ebe..7e05b4737b0e8 100644
@@ -14,6 +14,7 @@ struct drm_driver;
 
 int xe_display_driver_probe_defer(struct pci_dev *pdev);
 void xe_display_driver_set_hooks(struct drm_driver *driver);
+void xe_display_driver_remove(struct xe_device *xe);
 
 int xe_display_create(struct xe_device *xe);
 
@@ -22,17 +23,14 @@ void xe_display_info_init(struct xe_device *xe);
 int xe_display_init_nommio(struct xe_device *xe);
 int xe_display_init_noirq(struct xe_device *xe);
 int xe_display_init_noaccel(struct xe_device *xe);
-
 int xe_display_init(struct xe_device *xe);
-void xe_display_unlink(struct xe_device *xe);
+void xe_display_shutdown(struct xe_device *xe);
 
 void xe_display_register(struct xe_device *xe);
 void xe_display_unregister(struct xe_device *xe);
-void xe_display_modset_driver_remove(struct xe_device *xe);
 
 void xe_display_irq_handler(struct xe_device *xe, u32 master_ctl);
 void xe_display_irq_enable(struct xe_device *xe, u32 gu_misc_iir);
-
 void xe_display_irq_reset(struct xe_device *xe);
 void xe_display_irq_postinstall(struct xe_device *xe, struct xe_gt *gt);
 
@@ -44,27 +42,21 @@ void xe_display_pm_resume(struct xe_device *xe);
 #else
 
 static inline int xe_display_driver_probe_defer(struct pci_dev *pdev) { return 0; }
-
 static inline void xe_display_driver_set_hooks(struct drm_driver *driver) { }
+static inline void xe_display_driver_remove(struct xe_device *xe) {}
 
-static inline int
-xe_display_create(struct xe_device *xe) { return 0; }
+static inline int xe_display_create(struct xe_device *xe) { return 0; }
 
 static inline void xe_display_info_init(struct xe_device *xe) { }
 
-static inline int
-xe_display_enable(struct pci_dev *pdev, struct drm_driver *driver) { return 0; }
-
 static inline int xe_display_init_nommio(struct xe_device *xe) { return 0; }
 static inline int xe_display_init_noirq(struct xe_device *xe) { return 0; }
 static inline int xe_display_init_noaccel(struct xe_device *xe) { return 0; }
-
 static inline int xe_display_init(struct xe_device *xe) { return 0; }
-static inline void xe_display_unlink(struct xe_device *xe) {}
+static inline void xe_display_shutdown(struct xe_device *xe) {}
 
 static inline void xe_display_register(struct xe_device *xe) {}
 static inline void xe_display_unregister(struct xe_device *xe) {}
-static inline void xe_display_modset_driver_remove(struct xe_device *xe) {}
 
 static inline void xe_display_irq_handler(struct xe_device *xe, u32 master_ctl) {}
 static inline void xe_display_irq_enable(struct xe_device *xe, u32 gu_misc_iir) {}
Quoted 76 lines

---
drivers/gpu/drm/xe/xe_display.c | 6 +++--- drivers/gpu/drm/xe/xe_display.h | 15 +--------------

2 files changed, 4 insertions(+), 17 deletions(-)
drivers/gpu/drm/xe/xe_display.c +3 -3
index a453946ad108..3d15d3ac431f 100644
@@ -132,7 +132,7 @@ int xe_display_create(struct xe_device *xe)
 	return 0;
 }
 
-void xe_display_fini_nommio(struct drm_device *dev, void *dummy)
+static void xe_display_fini_nommio(struct drm_device *dev, void *dummy)
 {
 	struct xe_device *xe = to_xe_device(dev);
 
@@ -164,7 +164,7 @@ int xe_display_init_nommio(struct xe_device *xe)
 	return drmm_add_action_or_reset(&xe->drm, xe_display_fini_nommio, xe);
 }
 
-void xe_display_fini_noirq(struct drm_device *dev, void *dummy)
+static void xe_display_fini_noirq(struct drm_device *dev, void *dummy)
 {
 	struct xe_device *xe = to_xe_device(dev);
 
@@ -204,7 +204,7 @@ int xe_display_init_noirq(struct xe_device *xe)
 	return drmm_add_action_or_reset(&xe->drm, xe_display_fini_noirq, NULL);
 }
 
-void xe_display_fini_noaccel(struct drm_device *dev, void *dummy)
+static void xe_display_fini_noaccel(struct drm_device *dev, void *dummy)
 {
 	struct xe_device *xe = to_xe_device(dev);
 
drivers/gpu/drm/xe/xe_display.h +0 -5
index 9e29de012df7..71e0bd27f1eb 100644
@@ -20,13 +20,8 @@ int xe_display_create(struct xe_device *xe);
 void xe_display_info_init(struct xe_device *xe);
 
 int xe_display_init_nommio(struct xe_device *xe);
-void xe_display_fini_nommio(struct drm_device *dev, void *dummy);
-
 int xe_display_init_noirq(struct xe_device *xe);
-void xe_display_fini_noirq(struct drm_device *dev, void *dummy);
-
 int xe_display_init_noaccel(struct xe_device *xe);
-void xe_display_fini_noaccel(struct drm_device *dev, void *dummy);
 
 int xe_display_init(struct xe_device *xe);
 void xe_display_unlink(struct xe_device *xe);
@@ -60,17 +55,9 @@ static inline void xe_display_info_init(struct xe_device *xe) { }

static inline int
xe_display_enable(struct pci_dev *pdev, struct drm_driver *driver) { return 0; }

drivers/gpu/drm/xe/xe_display.h +1 -4
-static inline int
-xe_display_init_nommio(struct xe_device *xe) { return 0; }
-static inline void xe_display_fini_nommio(struct drm_device *dev, void *dummy) {}
-
+static inline int xe_display_init_nommio(struct xe_device *xe) { return 0; }

static inline int xe_display_init_noirq(struct xe_device *xe) { return 0; }

drivers/gpu/drm/xe/xe_display.h +0 -4
-
-static inline void
-xe_display_fini_noirq(struct drm_device *dev, void *dummy) {}
-

static inline int xe_display_init_noaccel(struct xe_device *xe) { return 0; } -static inline void xe_display_fini_noaccel(struct drm_device *dev, void *dummy) {}

static inline int xe_display_init(struct xe_device *xe) { return 0; } static inline void xe_display_unlink(struct xe_device *xe) {}

Signature · 1 line
2.41.0
#3 lore raw

[Intel-xe] ✗ CI.Patch_applied: failure for Turn display finalizers into static functions (rev2)

In reply to Gustavo Sousa
== Series Details ==

== Series Details ==

Series: Turn display finalizers into static functions (rev2)
URL : https://patchwork.freedesktop.org/series/123443/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 92bbb0596 drm/xe/uapi: Remove useless max_page_size === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_device.c:344
error: drivers/gpu/drm/xe/xe_device.c: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_display.c:236
error: drivers/gpu/drm/xe/xe_display.c: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_display.h:14
error: drivers/gpu/drm/xe/xe_display.h: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: fixup! drm/xe/display: Implement display support Patch failed at 0001 fixup! drm/xe/display: Implement display support When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".