• Mikulas Patocka's avatar
    udlfb: handle unplug properly · 68a958a9
    Mikulas Patocka authored
    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: 's avatarMikulas 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: 's avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
    68a958a9
Name
Last commit
Last update
..
atmel_lcdc.h Loading commit data...
aty128.h Loading commit data...
broadsheetfb.h Loading commit data...
cirrus.h Loading commit data...
cvisionppc.h Loading commit data...
da8xx-fb.h Loading commit data...
display_timing.h Loading commit data...
edid.h Loading commit data...
gbe.h Loading commit data...
hecubafb.h Loading commit data...
ili9320.h Loading commit data...
imx-ipu-image-convert.h Loading commit data...
imx-ipu-v3.h Loading commit data...
kyro.h Loading commit data...
mach64.h Loading commit data...
maxinefb.h Loading commit data...
mbxfb.h Loading commit data...
metronomefb.h Loading commit data...
mipi_display.h Loading commit data...
mmp_disp.h Loading commit data...
neomagic.h Loading commit data...
newport.h Loading commit data...
of_display_timing.h Loading commit data...
of_videomode.h Loading commit data...
omap-panel-data.h Loading commit data...
omapfb_dss.h Loading commit data...
omapvrfb.h Loading commit data...
permedia2.h Loading commit data...
platform_lcd.h Loading commit data...
pm3fb.h Loading commit data...
pmag-ba-fb.h Loading commit data...
pmagb-b-fb.h Loading commit data...
pxa168fb.h Loading commit data...
radeon.h Loading commit data...
s1d13xxxfb.h Loading commit data...
sa1100fb.h Loading commit data...
samsung_fimd.h Loading commit data...
sh_mobile_lcdc.h Loading commit data...
sisfb.h Loading commit data...
sstfb.h Loading commit data...
tdfx.h Loading commit data...
tgafb.h Loading commit data...
trident.h Loading commit data...
udlfb.h Loading commit data...
uvesafb.h Loading commit data...
vga.h Loading commit data...
videomode.h Loading commit data...
w100fb.h Loading commit data...