linux/include/video
Mikulas Patocka 68a958a915 udlfb: handle unplug properly
The udlfb driver maintained an open count and cleaned up itself when the
count reached zero. But the console is also counted in the reference count
- so, if the user unplugged the device, the open count would not drop to
zero and the driver stayed loaded with console attached. If the user
re-plugged the adapter, it would create a device /dev/fb1, show green
screen and the access to the console would be lost.

The framebuffer subsystem has reference counting on its own - in order to
fix the unplug bug, we rely the framebuffer reference counting. When the
user unplugs the adapter, we call unregister_framebuffer unconditionally.
unregister_framebuffer will unbind the console, wait until all users stop
using the framebuffer and then call the fb_destroy method. The fb_destroy
cleans up the USB driver.

This patch makes the following changes:
* Drop dlfb->kref and rely on implicit framebuffer reference counting
  instead.
* dlfb_usb_disconnect calls unregister_framebuffer, the rest of driver
  cleanup is done in the function dlfb_ops_destroy. dlfb_ops_destroy will
  be called by the framebuffer subsystem when no processes have the
  framebuffer open or mapped.
* We don't use workqueue during initialization, but initialize directly
  from dlfb_usb_probe. The workqueue could race with dlfb_usb_disconnect
  and this racing would produce various kinds of memory corruption.
* We use usb_get_dev and usb_put_dev to make sure that the USB subsystem
  doesn't free the device under us.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
cc: Dave Airlie <airlied@redhat.com>
Cc: Bernie Thompson <bernie@plugable.com>,
Cc: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
2018-10-08 12:57:34 +02:00
..
atmel_lcdc.h video: atmel_lcdfb: pass the pdata as params 2013-09-27 09:26:20 +03:00
aty128.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
broadsheetfb.h
cirrus.h
cvisionppc.h
da8xx-fb.h video: da8xx-fb: improve readability of code 2013-08-09 14:02:42 +03:00
display_timing.h video: display_timing: Add flags to select the edge when the sync is driven 2016-11-02 10:48:18 +02:00
edid.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gbe.h
hecubafb.h
ili9320.h
imx-ipu-image-convert.h gpu: ipu-v3: Add queued image conversion support 2016-09-19 08:30:27 +02:00
imx-ipu-v3.h gpu: ipu-v3: prg: add modifier support 2017-12-19 12:49:11 +01:00
kyro.h drivers/video/fbdev/kyrofb: Use arch_phys_wc_add() and pci_ioremap_wc_bar() 2015-08-25 09:59:44 +02:00
mach64.h
maxinefb.h
mbxfb.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
metronomefb.h
mipi_display.h drm: Add support for pps and compression mode command packet 2018-07-25 07:51:05 -04:00
mmp_disp.h video: mmp: add pitch info in mmp_win structure 2013-09-20 12:52:33 +03:00
neomagic.h video: fbdev: neofb: use arch_phys_wc_add() and ioremap_wc() 2015-06-03 12:41:49 +03:00
newport.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
of_display_timing.h video: of: display_timing: Remove of_display_timings_exist() function 2018-03-12 17:06:54 +01:00
of_videomode.h video: add of helper for display timings/videomode 2013-01-24 09:03:48 +01:00
omap-panel-data.h omapdss: omap-panel-data.h: Remove connector_type from atv pdata 2016-06-03 16:06:32 +03:00
omapfb_dss.h media: include/video/omapfb_dss.h: use IS_ENABLED() 2018-05-05 11:45:51 -04:00
omapvrfb.h OMAPDSS: VRFB: add omap_vrfb_supported() 2012-10-17 12:17:18 +03:00
permedia2.h
platform_lcd.h drivers/video/backlight/platform_lcd.c: introduce probe callback 2013-04-29 18:28:18 -07:00
pm3fb.h
pmag-ba-fb.h
pmagb-b-fb.h
pxa168fb.h video: pxa168fb: Cleanup pxa168fb.h file 2014-01-17 10:57:43 +02:00
radeon.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
s1d13xxxfb.h
sa1100fb.h FB: sa1100: remove global sa1100fb_.*_power function pointers 2012-02-21 11:56:19 +00:00
samsung_fimd.h drm/exynos: add macro to get the address of START_S reg 2015-08-31 00:27:37 +09:00
sh_mobile_lcdc.h video: fbdev: sh_mobile_lcdcfb: remove unused MERAM support 2018-05-14 15:47:30 +02:00
sisfb.h UAPI: (Scripted) Disintegrate include/video 2012-12-20 17:14:26 +00:00
sstfb.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tdfx.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tgafb.h
trident.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
udlfb.h udlfb: handle unplug properly 2018-10-08 12:57:34 +02:00
uvesafb.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vga.h arch, drivers: don't include <asm/io.h> directly, use <linux/io.h> instead 2015-08-10 23:07:05 -04:00
videomode.h videomode: videomode_from_timing work 2013-03-21 14:34:33 +02:00
w100fb.h