Skip to contentSkip to conversation

drm/vkms: A couple of trivial cleanups

PATCH Applied Javier Martinez Canillas 4 participants 9 messages Apr 6, 2023 – Apr 7, 2023

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

cover drm/vkms: A couple of trivial cleanups

Hello,

This series contains two trivial cleanups for the vkms driver.

Patch #1 just gets rid of a wrapper helper that wasn't really adding that much value and patch #2 drops the <drm/drm_simple_kms_helper.h> header that was only used to call the drm_simple_encoder_init() function helper.

Best regards,
Javier

Javier Martinez Canillas (2):
drm/vkms: Drop vkms_connector_destroy() wrapper drm/vkms: Remove <drm/drm_simple_kms_helper.h> include

 drivers/gpu/drm/vkms/vkms_output.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

base-commit: 77d08a2de6a43521f5a02848f11185b6f46af21c

Signature · 1 line
2.40.0
#1 lore raw

PATCH 1/2 drm/vkms: Drop vkms_connector_destroy() wrapper

This helper is just a wrapper that calls drm_connector_cleanup(), there's no need to have another level of indirection.

---

 drivers/gpu/drm/vkms/vkms_output.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/vkms/vkms_output.c +1 -6
index 991857125bb4..4de6f8ae38be 100644
@@ -6,14 +6,9 @@
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
 
-static void vkms_connector_destroy(struct drm_connector *connector)
-{
-	drm_connector_cleanup(connector);
-}
-
 static const struct drm_connector_funcs vkms_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
-	.destroy = vkms_connector_destroy,
+	.destroy = drm_connector_cleanup,
 	.reset = drm_atomic_helper_connector_reset,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.40.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] drm/vkms: Drop vkms_connector_destroy() wrapper

Quoted 4 lines · Javier Martinez Canillas

This helper is just a wrapper that calls drm_connector_cleanup(), there's no need to have another level of indirection.

On both patches:

Aside, would be a nice cleanup to move vkms output stuff (crtc and connector) over to the drmm_ stuff. The plane already does that.

That should also simplify the multi-output work.
-Daniel

Quoted 28 lines

---

 drivers/gpu/drm/vkms/vkms_output.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/vkms/vkms_output.c +1 -6
index 991857125bb4..4de6f8ae38be 100644
@@ -6,14 +6,9 @@
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
 
-static void vkms_connector_destroy(struct drm_connector *connector)
-{
-	drm_connector_cleanup(connector);
-}
-
 static const struct drm_connector_funcs vkms_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
-	.destroy = vkms_connector_destroy,
+	.destroy = drm_connector_cleanup,
 	.reset = drm_atomic_helper_connector_reset,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.40.0
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#3 lore raw

Re: [PATCH 1/2] drm/vkms: Drop vkms_connector_destroy() wrapper

Quoted 4 lines · Daniel Vetter
Quoted 3 lines · Javier Martinez Canillas

This helper is just a wrapper that calls drm_connector_cleanup(), there's no need to have another level of indirection.

Quoted 8 lines
Quoted 1 line

On both patches:

Aside, would be a nice cleanup to move vkms output stuff (crtc and connector) over to the drmm_ stuff. The plane already does that.

I sent a patch [1] a while ago moving the CRTC to the drmm_ functions. If you could take a look at it, it would be great.

[1] https://lore.kernel.org/dri-devel/[email protected]/T/

Best Regards,
- Maíra Canal

Quoted 33 lines

That should also simplify the multi-output work.
-Daniel

Quoted 28 lines

---

  drivers/gpu/drm/vkms/vkms_output.c | 7 +------
  1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/vkms/vkms_output.c +1 -6
index 991857125bb4..4de6f8ae38be 100644
@@ -6,14 +6,9 @@
  #include <drm/drm_probe_helper.h>
  #include <drm/drm_simple_kms_helper.h>
 
-static void vkms_connector_destroy(struct drm_connector *connector)
-{
-	drm_connector_cleanup(connector);
-}
-
  static const struct drm_connector_funcs vkms_connector_funcs = {
  	.fill_modes = drm_helper_probe_single_connector_modes,
-	.destroy = vkms_connector_destroy,
+	.destroy = drm_connector_cleanup,
  	.reset = drm_atomic_helper_connector_reset,
  	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
  	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
Signature · 1 line
2.40.0
#4 lore raw

Re: [PATCH 1/2] drm/vkms: Drop vkms_connector_destroy() wrapper

Maíra Canal <[email protected]> writes:

Hello Maíra,

Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Javier Martinez Canillas
Quoted 4 lines

This helper is just a wrapper that calls drm_connector_cleanup(), there's no need to have another level of indirection.

On both patches:

Quoted 8 lines
Quoted 2 lines

Aside, would be a nice cleanup to move vkms output stuff (crtc and connector) over to the drmm_ stuff. The plane already does that.

I sent a patch [1] a while ago moving the CRTC to the drmm_ functions. If you could take a look at it, it would be great.

[1] https://lore.kernel.org/dri-devel/[email protected]/T/

I've now reviewed both patches from your series and they look good to me.

Quoted 3 lines

Best Regards,
- Maíra Canal

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat
#5 lore raw

PATCH 2/2 drm/vkms: Remove <drm/drm_simple_kms_helper.h> include

In reply to Javier Martinez Canillas

The driver doesn't use simple-KMS helpers to set a simple display pipeline but it only uses the drm_simple_encoder_init() helper from simple-KMS that initializes and encoder.

That helper is just a wrapper of drm_encoder_init(), but passing a struct drm_encoder_funcs that sets the .destroy handler to drm_encoder_cleanup().

Since the <drm/drm_simple_kms_helper.h> header is only included for this helper and because the connector is initialized with drm_connector_init() as well, do the same for the encoder and drop the header include.

---

 drivers/gpu/drm/vkms/vkms_output.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/vkms/vkms_output.c +6 -2
index 4de6f8ae38be..5ce70dd946aa 100644
@@ -4,7 +4,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_probe_helper.h>
-#include <drm/drm_simple_kms_helper.h>
 
 static const struct drm_connector_funcs vkms_connector_funcs = {
 	.fill_modes = drm_helper_probe_single_connector_modes,
@@ -14,6 +13,10 @@ static const struct drm_connector_funcs vkms_connector_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
+static const struct drm_encoder_funcs vkms_encoder_funcs = {
+	.destroy = drm_encoder_cleanup,
+};
+
 static int vkms_conn_get_modes(struct drm_connector *connector)
 {
 	int count;
@@ -86,7 +89,8 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
 
 	drm_connector_helper_add(connector, &vkms_conn_helper_funcs);
 
-	ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
+	ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs,
+			       DRM_MODE_ENCODER_VIRTUAL, NULL);
 	if (ret) {
 		DRM_ERROR("Failed to init encoder\n");
 		goto err_encoder;
Signature · 1 line
2.40.0
maintainer Reviewed-by on the v1 series
#6 lore raw
In reply to Javier Martinez Canillas

Hi

for the series.

Best regards
Thomas

Am 06.04.23 um 13:02 schrieb Javier Martinez Canillas:

Quoted 21 lines

Hello,

This series contains two trivial cleanups for the vkms driver.

Patch #1 just gets rid of a wrapper helper that wasn't really adding that much value and patch #2 drops the <drm/drm_simple_kms_helper.h> header that was only used to call the drm_simple_encoder_init() function helper.

Best regards,
Javier

Javier Martinez Canillas (2):
drm/vkms: Drop vkms_connector_destroy() wrapper drm/vkms: Remove <drm/drm_simple_kms_helper.h> include

  drivers/gpu/drm/vkms/vkms_output.c | 15 +++++++--------
  1 file changed, 7 insertions(+), 8 deletions(-)

base-commit: 77d08a2de6a43521f5a02848f11185b6f46af21c

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Reviewed-by on the v1 series
#7 lore raw
In reply to Javier Martinez Canillas

Hi,

for the series.

Thanks for helping to cleanup vkms!

Best Regards,
- Maíra Canal

Quoted 21 lines · Javier Martinez Canillas

Hello,

This series contains two trivial cleanups for the vkms driver.

Patch #1 just gets rid of a wrapper helper that wasn't really adding that much value and patch #2 drops the <drm/drm_simple_kms_helper.h> header that was only used to call the drm_simple_encoder_init() function helper.

Best regards,
Javier

Javier Martinez Canillas (2):
drm/vkms: Drop vkms_connector_destroy() wrapper drm/vkms: Remove <drm/drm_simple_kms_helper.h> include

  drivers/gpu/drm/vkms/vkms_output.c | 15 +++++++--------
  1 file changed, 7 insertions(+), 8 deletions(-)

base-commit: 77d08a2de6a43521f5a02848f11185b6f46af21c

#8 lore raw
In reply to Javier Martinez Canillas
Quoted 8 lines · Javier Martinez Canillas

Hello,

This series contains two trivial cleanups for the vkms driver.

Patch #1 just gets rid of a wrapper helper that wasn't really adding that much value and patch #2 drops the <drm/drm_simple_kms_helper.h> header that was only used to call the drm_simple_encoder_init() function helper.

Quoted 8 lines

Best regards,
Javier

Javier Martinez Canillas (2):
drm/vkms: Drop vkms_connector_destroy() wrapper drm/vkms: Remove <drm/drm_simple_kms_helper.h> include

Pushed to drm-misc (drm-misc-next). Thanks!

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat