drm/udl: Fix USB disconnect
Subsystems (5)
Thomas Zimmermann
maintainercover drm/udl: Fix USB disconnect
The udl drivers prints warnings about dropped URBs from its disconnect handler. This is because the poll helper doesn't yet know that the USB device is gone. Fix the disconnect clean-up logic and use managed cleanup for poll helpers.
Thomas Zimmermann (3):
drm/udl: Unregister device before cleaning up on disconnect drm/udl: Switch poll helpers to managed cleanup drm/probe-helper: Do not fail from drmm_kms_helper_poll_init()
drivers/gpu/drm/ast/ast_mode.c | 5 +---- drivers/gpu/drm/drm_probe_helper.c | 11 ++++++----- drivers/gpu/drm/udl/udl_drv.c | 3 +-- drivers/gpu/drm/udl/udl_main.c | 2 -- drivers/gpu/drm/udl/udl_modeset.c | 1 + include/drm/drm_probe_helper.h | 2 +- 6 files changed, 10 insertions(+), 14 deletions(-)
Signature · 1 line
2.48.1
Thomas Zimmermann
maintainerPATCH 1/3 drm/udl: Unregister device before cleaning up on disconnect
Disconnecting a DisplayLink device results in the following kernel error messages
[ 93.041748] [drm:udl_urb_completion [udl]] *ERROR* udl_urb_completion - nonzero write bulk status received: -115 [ 93.055299] [drm:udl_submit_urb [udl]] *ERROR* usb_submit_urb error fffffffe [ 93.065363] [drm:udl_urb_completion [udl]] *ERROR* udl_urb_completion - nonzero write bulk status received: -115 [ 93.078207] [drm:udl_submit_urb [udl]] *ERROR* usb_submit_urb error fffffffe
coming from KMS poll helpers. Shutting down poll helpers runs them one final time when the USB device is already gone.
Run drm_dev_unplug() first in udl's USB disconnect handler. Udl's polling code already handles disconnects gracefully if the device has been marked as unplugged.
--- drivers/gpu/drm/udl/udl_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/udl/udl_drv.c +1 -1
@@ -127,9 +127,9 @@ static void udl_usb_disconnect(struct usb_interface *interface) {struct drm_device *dev =usb_get_intfdata (interface); +drm_dev_unplug (dev);drm_kms_helper_poll_fini (dev);udl_drop_usb (dev); -drm_dev_unplug (dev); }/*
Signature · 1 line
2.48.1
Re: [PATCH 1/3] drm/udl: Unregister device before cleaning up on disconnect
Quoted 12 lines · Thomas Zimmermann
Disconnecting a DisplayLink device results in the following kernel error messages
[ 93.041748] [drm:udl_urb_completion [udl]] *ERROR* udl_urb_completion - nonzero write bulk status received: -115 [ 93.055299] [drm:udl_submit_urb [udl]] *ERROR* usb_submit_urb error fffffffe [ 93.065363] [drm:udl_urb_completion [udl]] *ERROR* udl_urb_completion - nonzero write bulk status received: -115 [ 93.078207] [drm:udl_submit_urb [udl]] *ERROR* usb_submit_urb error fffffffecoming from KMS poll helpers. Shutting down poll helpers runs them one final time when the USB device is already gone.
Quoted 8 lines
Run
drm_dev_unplug()first in udl's USB disconnect handler. Udl's polling code already handles disconnects gracefully if the device has been marked as unplugged.Signed-off-by Thomas Zimmermann <[email protected]>Fixes b1a981bd5576 ("drm/udl: drop drm_driver.release hook")Cc <[email protected]> # v5.8+
Hi Thomas,
Looks good.
Quoted 22 lines
--- drivers/gpu/drm/udl/udl_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/udl/udl_drv.c +1
-2@@ -127,9 +127,9 @@ static void udl_usb_disconnect(struct usb_interface *interface) {struct drm_device *dev =usb_get_intfdata (interface); +drm_dev_unplug (dev);drm_kms_helper_poll_fini (dev);udl_drop_usb (dev); -drm_dev_unplug (dev); }/* -- 2.48.1
Thomas Zimmermann
maintainerPATCH 2/3 drm/udl: Switch poll helpers to managed cleanup
In reply to Thomas ZimmermannCall drmm_kms_helper_poll_init() to set up managed cleanup for connector polling.
--- drivers/gpu/drm/udl/udl_drv.c | 1 - drivers/gpu/drm/udl/udl_main.c | 2 -- drivers/gpu/drm/udl/udl_modeset.c | 1 + 3 files changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/udl/udl_drv.c +0 -1
@@ -128,7 +128,6 @@ static void udl_usb_disconnect(struct usb_interface *interface)struct drm_device *dev =usb_get_intfdata (interface);drm_dev_unplug (dev); -drm_kms_helper_poll_fini (dev);udl_drop_usb (dev); }
drivers/gpu/drm/udl/udl_main.c +0 -2
@@ -336,8 +336,6 @@ int udl_init(struct udl_device *udl)if (ret) goto err; -drm_kms_helper_poll_init (dev); -return 0 ; err:
drivers/gpu/drm/udl/udl_modeset.c +1 -0
@@ -535,6 +535,7 @@ int udl_modeset_init(struct drm_device *dev)return ret;drm_mode_config_reset (dev); +drmm_kms_helper_poll_init (dev);return 0 ; }
Signature · 1 line
2.48.1
Re: [PATCH 2/3] drm/udl: Switch poll helpers to managed cleanup
Quoted 5 lines · Thomas Zimmermann
Call
drmm_kms_helper_poll_init()to set up managed cleanup for connector polling.Signed-off-by Thomas Zimmermann <[email protected]>
Quoted 46 lines
--- drivers/gpu/drm/udl/udl_drv.c | 1 - drivers/gpu/drm/udl/udl_main.c | 2 -- drivers/gpu/drm/udl/udl_modeset.c | 1 + 3 files changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/udl/udl_drv.c +0
-1@@ -128,7 +128,6 @@ static void udl_usb_disconnect(struct usb_interface *interface)struct drm_device *dev =usb_get_intfdata (interface);drm_dev_unplug (dev); -drm_kms_helper_poll_fini (dev);udl_drop_usb (dev); }drivers/gpu/drm/udl/udl_main.c +0
-2@@ -336,8 +336,6 @@ int udl_init(struct udl_device *udl)if (ret) goto err; -drm_kms_helper_poll_init (dev); -return 0 ; err:drivers/gpu/drm/udl/udl_modeset.c +1
-1@@ -535,6 +535,7 @@ int udl_modeset_init(struct drm_device *dev)return ret;drm_mode_config_reset (dev); +drmm_kms_helper_poll_init (dev);return 0 ; } --2.48.1
Thomas Zimmermann
maintainerPATCH 3/3 drm/probe-helper: Do not fail from drmm_kms_helper_poll_init()
In reply to Thomas ZimmermannFailing to set up connector polling is not significant enough to fail device probing. Print a warning and return nothing from the init helper.
This only affects the managed init function. The unmanaged init already never fails with an error.
--- drivers/gpu/drm/ast/ast_mode.c | 5 +---- drivers/gpu/drm/drm_probe_helper.c | 11 ++++++----- include/drm/drm_probe_helper.h | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +1 -4
@@ -1018,10 +1018,7 @@ int ast_mode_config_init(struct ast_device *ast)return ret;drm_mode_config_reset (dev); - - ret =drmm_kms_helper_poll_init (dev); -if (ret) -return ret; +drmm_kms_helper_poll_init (dev);return 0 ; }
drivers/gpu/drm/drm_probe_helper.c +6 -5
@@ -958,15 +958,16 @@ static void drm_kms_helper_poll_init_release(struct drm_device *dev, void *res)* cleaned up when the DRM device goes away. * * See drm_kms_helper_poll_init() for more information. -* -* Returns: -* 0 on success, or a negative errno code otherwise. */ -int drmm_kms_helper_poll_init (struct drm_device *dev) +void drmm_kms_helper_poll_init (struct drm_device *dev) { +int ret; +drm_kms_helper_poll_init (dev); -return drmm_add_action_or_reset (dev, drm_kms_helper_poll_init_release, dev); + ret =drmm_add_action_or_reset (dev, drm_kms_helper_poll_init_release, dev); +if (ret) +drm_warn (dev,"Connector status will not be updated, error %d\n" , ret); }EXPORT_SYMBOL (drmm_kms_helper_poll_init);
include/drm/drm_probe_helper.h +1 -1
@@ -17,7 +17,7 @@ int drm_helper_probe_detect(struct drm_connector *connector,struct drm_modeset_acquire_ctx *ctx, bool force); -int drmm_kms_helper_poll_init (struct drm_device *dev); +void drmm_kms_helper_poll_init (struct drm_device *dev);void drm_kms_helper_poll_init (struct drm_device *dev);void drm_kms_helper_poll_fini (struct drm_device *dev);bool drm_helper_hpd_irq_event (struct drm_device *dev);
Signature · 1 line
2.48.1
Re: [PATCH 3/3] drm/probe-helper: Do not fail from drmm_kms_helper_poll_init()
Quoted 9 lines · Thomas Zimmermann
Failing to set up connector polling is not significant enough to fail device probing. Print a warning and return nothing from the init helper.
This only affects the managed init function. The unmanaged init already never fails with an error.
Signed-off-by Thomas Zimmermann <[email protected]>
Quoted 64 lines
--- drivers/gpu/drm/ast/ast_mode.c | 5 +---- drivers/gpu/drm/drm_probe_helper.c | 11 ++++++----- include/drm/drm_probe_helper.h | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-)drivers/gpu/drm/ast/ast_mode.c +1
-4@@ -1018,10 +1018,7 @@ int ast_mode_config_init(struct ast_device *ast)return ret;drm_mode_config_reset (dev); - - ret =drmm_kms_helper_poll_init (dev); -if (ret) -return ret; +drmm_kms_helper_poll_init (dev);return 0 ; }drivers/gpu/drm/drm_probe_helper.c +6
-5@@ -958,15 +958,16 @@ static void drm_kms_helper_poll_init_release(struct drm_device *dev, void *res)* cleaned up when the DRM device goes away. * * See drm_kms_helper_poll_init() for more information. -* -* Returns: -* 0 on success, or a negative errno code otherwise. */ -int drmm_kms_helper_poll_init (struct drm_device *dev) +void drmm_kms_helper_poll_init (struct drm_device *dev) { +int ret; +drm_kms_helper_poll_init (dev); -return drmm_add_action_or_reset (dev, drm_kms_helper_poll_init_release, dev); + ret =drmm_add_action_or_reset (dev, drm_kms_helper_poll_init_release, dev); +if (ret) +drm_warn (dev,"Connector status will not be updated, error %d\n" , ret); }EXPORT_SYMBOL (drmm_kms_helper_poll_init);include/drm/drm_probe_helper.h +1
-2@@ -17,7 +17,7 @@ int drm_helper_probe_detect(struct drm_connector *connector,struct drm_modeset_acquire_ctx *ctx, bool force); -int drmm_kms_helper_poll_init (struct drm_device *dev); +void drmm_kms_helper_poll_init (struct drm_device *dev);void drm_kms_helper_poll_init (struct drm_device *dev);void drm_kms_helper_poll_fini (struct drm_device *dev);bool drm_helper_hpd_irq_event (struct drm_device *dev); --2.48.1