.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2012 Red Hat |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * Copyright (C) 2009 Roberto De Ioris <roberto@unbit.it> |
---|
6 | 7 | * Copyright (C) 2009 Jaya Kumar <jayakumar.lkml@gmail.com> |
---|
7 | 8 | * 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. |
---|
12 | 9 | */ |
---|
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 | + |
---|
15 | 15 | #include "udl_drv.h" |
---|
16 | 16 | |
---|
17 | 17 | /* -BULK_SIZE as per usb-skeleton. Can we get full page and avoid overhead? */ |
---|
.. | .. |
---|
140 | 140 | urb->status == -ESHUTDOWN)) { |
---|
141 | 141 | DRM_ERROR("%s - nonzero write bulk status received: %d\n", |
---|
142 | 142 | __func__, urb->status); |
---|
143 | | - atomic_set(&udl->lost_pixels, 1); |
---|
144 | 143 | } |
---|
145 | 144 | } |
---|
146 | 145 | |
---|
.. | .. |
---|
271 | 270 | /* Wait for an in-flight buffer to complete and get re-queued */ |
---|
272 | 271 | ret = down_timeout(&udl->urbs.limit_sem, GET_URB_TIMEOUT); |
---|
273 | 272 | if (ret) { |
---|
274 | | - atomic_set(&udl->lost_pixels, 1); |
---|
275 | 273 | DRM_INFO("wait for urb interrupted: %x available: %d\n", |
---|
276 | 274 | ret, udl->urbs.available); |
---|
277 | 275 | goto error; |
---|
.. | .. |
---|
304 | 302 | ret = usb_submit_urb(urb, GFP_ATOMIC); |
---|
305 | 303 | if (ret) { |
---|
306 | 304 | udl_urb_completion(urb); /* because no one else will */ |
---|
307 | | - atomic_set(&udl->lost_pixels, 1); |
---|
308 | 305 | DRM_ERROR("usb_submit_urb error %x\n", ret); |
---|
309 | 306 | } |
---|
310 | 307 | return ret; |
---|
.. | .. |
---|
316 | 313 | int ret = -ENOMEM; |
---|
317 | 314 | |
---|
318 | 315 | 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 */ |
---|
319 | 320 | |
---|
320 | 321 | mutex_init(&udl->gem_lock); |
---|
321 | 322 | |
---|
.. | .. |
---|
338 | 339 | if (ret) |
---|
339 | 340 | goto err; |
---|
340 | 341 | |
---|
341 | | - ret = udl_fbdev_init(dev); |
---|
342 | | - if (ret) |
---|
343 | | - goto err; |
---|
344 | | - |
---|
345 | 342 | drm_kms_helper_poll_init(dev); |
---|
346 | 343 | |
---|
347 | 344 | return 0; |
---|
.. | .. |
---|
349 | 346 | err: |
---|
350 | 347 | if (udl->urbs.count) |
---|
351 | 348 | udl_free_urb_list(dev); |
---|
| 349 | + put_device(udl->dmadev); |
---|
352 | 350 | DRM_ERROR("%d\n", ret); |
---|
353 | 351 | return ret; |
---|
354 | 352 | } |
---|
355 | 353 | |
---|
356 | 354 | int udl_drop_usb(struct drm_device *dev) |
---|
357 | 355 | { |
---|
358 | | - udl_free_urb_list(dev); |
---|
359 | | - return 0; |
---|
360 | | -} |
---|
361 | | - |
---|
362 | | -void udl_fini(struct drm_device *dev) |
---|
363 | | -{ |
---|
364 | 356 | struct udl_device *udl = to_udl(dev); |
---|
365 | 357 | |
---|
366 | | - drm_kms_helper_poll_fini(dev); |
---|
| 358 | + udl_free_urb_list(dev); |
---|
| 359 | + put_device(udl->dmadev); |
---|
| 360 | + udl->dmadev = NULL; |
---|
367 | 361 | |
---|
368 | | - if (udl->urbs.count) |
---|
369 | | - udl_free_urb_list(dev); |
---|
370 | | - |
---|
371 | | - udl_fbdev_cleanup(dev); |
---|
| 362 | + return 0; |
---|
372 | 363 | } |
---|