All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: airlied@redhat.com, sean@poorly.run, tiwai@suse.com,
	patrik.r.jakobsson@gmail.com, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, airlied@gmail.com, simona@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, sashiko-reviews@lists.linux.dev,
	Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 01/11] drm/udl: Release URB in udl_put_urb()
Date: Thu, 19 Nov 2026 15:02:13 +0100	[thread overview]
Message-ID: <20261119142114.152052-2-tzimmermann@suse.de> (raw)
In-Reply-To: <20261119142114.152052-1-tzimmermann@suse.de>

Move URB cleanup from udl_urb_completion() to udl_put_urb().
udl_put_urb() is the inverse of udl_get_urb(). The new helper will
allow for further fixes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/udl/udl_drv.h  |  1 +
 drivers/gpu/drm/udl/udl_main.c | 29 +++++++++++++++++------------
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h
index 145bb95ccc48..9535e9c59950 100644
--- a/drivers/gpu/drm/udl/udl_drv.h
+++ b/drivers/gpu/drm/udl/udl_drv.h
@@ -73,6 +73,7 @@ int udl_modeset_init(struct udl_device *udl);
 struct drm_connector *udl_connector_init(struct drm_device *dev);
 
 struct urb *udl_get_urb(struct udl_device *udl);
+void udl_put_urb(struct urb *urb);
 
 int udl_submit_urb(struct udl_device *udl, struct urb *urb, size_t len);
 void udl_sync_pending_urbs(struct udl_device *udl);
diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c
index 17950fe3a0ec..936fb6565bdb 100644
--- a/drivers/gpu/drm/udl/udl_main.c
+++ b/drivers/gpu/drm/udl/udl_main.c
@@ -149,10 +149,6 @@ int udl_select_std_channel(struct udl_device *udl)
 
 void udl_urb_completion(struct urb *urb)
 {
-	struct urb_node *unode = urb->context;
-	struct udl_device *udl = unode->dev;
-	unsigned long flags;
-
 	/* sync/async unlink faults aren't errors */
 	if (urb->status) {
 		if (!(urb->status == -ENOENT ||
@@ -164,14 +160,7 @@ void udl_urb_completion(struct urb *urb)
 		}
 	}
 
-	urb->transfer_buffer_length = udl->urbs.size; /* reset to actual */
-
-	spin_lock_irqsave(&udl->urbs.lock, flags);
-	list_add_tail(&unode->entry, &udl->urbs.list);
-	udl->urbs.available++;
-	spin_unlock_irqrestore(&udl->urbs.lock, flags);
-
-	wake_up(&udl->urbs.sleep);
+	udl_put_urb(urb);
 }
 
 static void udl_free_urb_list(struct udl_device *udl)
@@ -295,6 +284,22 @@ struct urb *udl_get_urb(struct udl_device *udl)
 	return urb;
 }
 
+void udl_put_urb(struct urb *urb)
+{
+	struct urb_node *unode = urb->context;
+	struct udl_device *udl = unode->dev;
+	unsigned long flags;
+
+	urb->transfer_buffer_length = udl->urbs.size; /* reset to actual */
+
+	spin_lock_irqsave(&udl->urbs.lock, flags);
+	list_add_tail(&unode->entry, &udl->urbs.list);
+	udl->urbs.available++;
+	spin_unlock_irqrestore(&udl->urbs.lock, flags);
+
+	wake_up(&udl->urbs.sleep);
+}
+
 int udl_submit_urb(struct udl_device *udl, struct urb *urb, size_t len)
 {
 	int ret;
-- 
2.56.0


  reply	other threads:[~2026-11-19 14:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 14:02 [PATCH 00/11] drm/udl: Rework URB allocation Thomas Zimmermann
2026-11-19 14:02 ` Thomas Zimmermann [this message]
2026-11-19 17:03   ` [PATCH 01/11] drm/udl: Release URB in udl_put_urb() Jie Feng
2026-11-19 14:02 ` [PATCH 02/11] drm/udl: Do not use URB completion handler for error cleanup Thomas Zimmermann
2026-11-19 14:02 ` [PATCH 03/11] drm/udl: Store per-URB allocation length in struct urb_node Thomas Zimmermann
2026-11-19 14:02 ` [PATCH 04/11] drm/udl: Allocate bulk URBs in helper functions Thomas Zimmermann
2026-11-19 16:38   ` Jie Feng
2026-11-20 12:49     ` Thomas Zimmermann
2026-11-20 16:15       ` Jie Feng
2026-11-19 14:02 ` [PATCH 05/11] drm/udl: Free " Thomas Zimmermann
2026-11-19 14:02 ` [PATCH 06/11] drm/udl: Rework the error handling in udl_submit_urb() Thomas Zimmermann
2026-11-19 14:02 ` [PATCH 07/11] drm/udl: Managed cleanup of URB cache Thomas Zimmermann
2026-11-19 14:02 ` [PATCH 08/11] drm/udl: Track number of URBs in flight Thomas Zimmermann
2026-11-19 14:02 ` [PATCH 09/11] drm/udl: Synchronize pending URBs on each frame Thomas Zimmermann
2026-11-20  6:50   ` Jie Feng
2026-11-20 12:52     ` Thomas Zimmermann
2026-11-19 14:02 ` [PATCH 10/11] drm/udl: Allocate URBs on demand Thomas Zimmermann
2026-11-19 14:47   ` sashiko-bot
2026-11-19 18:05     ` Thomas Zimmermann
2026-11-20  6:54   ` Jie Feng
2026-11-20 13:01     ` Thomas Zimmermann
2026-11-19 14:02 ` [PATCH 11/11] drm/udl: Implement URB cache as LIFO stack Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119142114.152052-2-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=patrik.r.jakobsson@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.