hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/gpu/drm/udl/udl_main.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2012 Red Hat
34 *
....@@ -5,13 +6,12 @@
56 * Copyright (C) 2009 Roberto De Ioris <roberto@unbit.it>
67 * Copyright (C) 2009 Jaya Kumar <jayakumar.lkml@gmail.com>
78 * Copyright (C) 2009 Bernie Thompson <bernie@plugable.com>
8
- *
9
- * This file is subject to the terms and conditions of the GNU General Public
10
- * License v2. See the file COPYING in the main directory of this archive for
11
- * more details.
129 */
13
-#include <drm/drmP.h>
14
-#include <drm/drm_crtc_helper.h>
10
+
11
+#include <drm/drm.h>
12
+#include <drm/drm_print.h>
13
+#include <drm/drm_probe_helper.h>
14
+
1515 #include "udl_drv.h"
1616
1717 /* -BULK_SIZE as per usb-skeleton. Can we get full page and avoid overhead? */
....@@ -140,7 +140,6 @@
140140 urb->status == -ESHUTDOWN)) {
141141 DRM_ERROR("%s - nonzero write bulk status received: %d\n",
142142 __func__, urb->status);
143
- atomic_set(&udl->lost_pixels, 1);
144143 }
145144 }
146145
....@@ -271,7 +270,6 @@
271270 /* Wait for an in-flight buffer to complete and get re-queued */
272271 ret = down_timeout(&udl->urbs.limit_sem, GET_URB_TIMEOUT);
273272 if (ret) {
274
- atomic_set(&udl->lost_pixels, 1);
275273 DRM_INFO("wait for urb interrupted: %x available: %d\n",
276274 ret, udl->urbs.available);
277275 goto error;
....@@ -304,7 +302,6 @@
304302 ret = usb_submit_urb(urb, GFP_ATOMIC);
305303 if (ret) {
306304 udl_urb_completion(urb); /* because no one else will */
307
- atomic_set(&udl->lost_pixels, 1);
308305 DRM_ERROR("usb_submit_urb error %x\n", ret);
309306 }
310307 return ret;
....@@ -316,6 +313,10 @@
316313 int ret = -ENOMEM;
317314
318315 DRM_DEBUG("\n");
316
+
317
+ udl->dmadev = usb_intf_get_dma_device(to_usb_interface(dev->dev));
318
+ if (!udl->dmadev)
319
+ drm_warn(dev, "buffer sharing not supported"); /* not an error */
319320
320321 mutex_init(&udl->gem_lock);
321322
....@@ -338,10 +339,6 @@
338339 if (ret)
339340 goto err;
340341
341
- ret = udl_fbdev_init(dev);
342
- if (ret)
343
- goto err;
344
-
345342 drm_kms_helper_poll_init(dev);
346343
347344 return 0;
....@@ -349,24 +346,18 @@
349346 err:
350347 if (udl->urbs.count)
351348 udl_free_urb_list(dev);
349
+ put_device(udl->dmadev);
352350 DRM_ERROR("%d\n", ret);
353351 return ret;
354352 }
355353
356354 int udl_drop_usb(struct drm_device *dev)
357355 {
358
- udl_free_urb_list(dev);
359
- return 0;
360
-}
361
-
362
-void udl_fini(struct drm_device *dev)
363
-{
364356 struct udl_device *udl = to_udl(dev);
365357
366
- drm_kms_helper_poll_fini(dev);
358
+ udl_free_urb_list(dev);
359
+ put_device(udl->dmadev);
360
+ udl->dmadev = NULL;
367361
368
- if (udl->urbs.count)
369
- udl_free_urb_list(dev);
370
-
371
- udl_fbdev_cleanup(dev);
362
+ return 0;
372363 }