drm/virtio: Open-code drm_simple_encoder_init()
Subsystems (4)
cover drm/virtio: Open-code drm_simple_encoder_init()
Replace drm_simple_encoder_init() in the virtio GPU driver with drm_encoder_init() and propagate initialization errors to the caller.
Sebastian von Arx (2):
drm/virtio: Open-code drm_simple_encoder_init()
drm/virtio: Propagate drm_encoder_init() errors
drivers/gpu/drm/virtio/virtgpu_display.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
base-commit: 5dd1818b15d98d4a20806cd00b1b40320b06004f
Signature · 1 line
2.55.0
PATCH 1/2 drm/virtio: Open-code drm_simple_encoder_init()
drm_simple_encoder_init() only wraps drm_encoder_init() with a cleanup callback. Open-code the helper in preparation for removing drm_simple_encoder_init().
--- drivers/gpu/drm/virtio/virtgpu_display.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_display.c +5 -1
@@ -271,6 +271,10 @@ static const struct drm_connector_funcs virtio_gpu_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; +static const struct drm_encoder_funcs virtio_gpu_encoder_funcs = { + .destroy = drm_encoder_cleanup, +}; +static int vgdev_output_init (struct virtio_gpu_device *vgdev,int index) {struct drm_device *dev = vgdev->ddev;
@@ -306,7 +310,7 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)if (vgdev->has_edid)drm_connector_attach_edid_property (connector); -drm_simple_encoder_init (dev, encoder,DRM_MODE_ENCODER_VIRTUAL ); +drm_encoder_init (dev, encoder, &virtio_gpu_encoder_funcs,DRM_MODE_ENCODER_VIRTUAL ,NULL );drm_encoder_helper_add (encoder, &virtio_gpu_enc_helper_funcs); encoder->possible_crtcs =1 << index;
Signature · 1 line
2.55.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 lines
drm_simple_encoder_init()only wrapsdrm_encoder_init()with a cleanup callback. Open-code the helper in preparation for removingdrm_simple_encoder_init().Assisted-by LLMSigned-off-by Sebastian von Arx <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH 2/2 drm/virtio: Propagate drm_encoder_init() errors
In reply to Sebastian von Arxvgdev_output_init() ignores errors from drm_encoder_init(), so output setup continues even when encoder initialization fails, for example because of an allocation failure.
Check the return value and propagate the error to the caller.
--- drivers/gpu/drm/virtio/virtgpu_display.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_display.c +5 -1
@@ -310,7 +310,11 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)if (vgdev->has_edid)drm_connector_attach_edid_property (connector); -drm_encoder_init (dev, encoder, &virtio_gpu_encoder_funcs,DRM_MODE_ENCODER_VIRTUAL ,NULL ); + ret =drm_encoder_init (dev, encoder, &virtio_gpu_encoder_funcs, +DRM_MODE_ENCODER_VIRTUAL ,NULL ); +if (ret) +return ret; +drm_encoder_helper_add (encoder, &virtio_gpu_enc_helper_funcs); encoder->possible_crtcs =1 << index;
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 2/2] drm/virtio: Propagate drm_encoder_init() errors
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines
vgdev_output_init()ignores errors fromdrm_encoder_init(), so output setup continues even when encoder initialization fails, for example because of an allocation failure.Check the return value and propagate the error to the caller.
Assisted-by LLMSigned-off-by Sebastian von Arx <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2