diff options
author | Bernie Thompson | 2010-09-06 01:35:19 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2010-09-06 01:50:18 +0200 |
commit | 33077b8d3042e01da61924973e372abe589ba297 (patch) | |
tree | 9269cdd17d93253e33620317a8fff5226d5f8ebf /drivers/staging/udlfb/udlfb.h | |
parent | staging: udlfb: remove metrics_misc sysfs attribute (diff) | |
download | kernel-qcow2-linux-33077b8d3042e01da61924973e372abe589ba297.tar.gz kernel-qcow2-linux-33077b8d3042e01da61924973e372abe589ba297.tar.xz kernel-qcow2-linux-33077b8d3042e01da61924973e372abe589ba297.zip |
staging: udlfb: revamp reference handling to insure successful shutdown
Revamp reference handling and synchronization for unload/shutdown
Udlfb is a "virtual" framebuffer device that really exists on
two separate stacks: at the bottom of the framebuffer interface,
and on top of USB. During unload, there's no guarantee which
one will tear down first. So reference counting must be solid
to handle all possibilities and not access anything once its gone.
Signed-off-by: Bernie Thompson <bernie@plugable.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/udlfb/udlfb.h')
-rw-r--r-- | drivers/staging/udlfb/udlfb.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/staging/udlfb/udlfb.h b/drivers/staging/udlfb/udlfb.h index f32a220993d1..7c46477af2a2 100644 --- a/drivers/staging/udlfb/udlfb.h +++ b/drivers/staging/udlfb/udlfb.h @@ -38,9 +38,9 @@ struct dlfb_data { struct urb_list urbs; struct kref kref; char *backing_buffer; - struct delayed_work deferred_work; - struct mutex fb_open_lock; int fb_count; + bool virtualized; /* true when physical usb device not present */ + struct delayed_work free_framebuffer_work; atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */ atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */ atomic_t use_defio; /* 0 = rely on ioctls and blit/copy/fill rects */ @@ -89,12 +89,20 @@ struct dlfb_data { /* remove once this gets added to sysfs.h */ #define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store) +/* + * udlfb is both a usb device, and a framebuffer device. + * They may exist at the same time, but during various stages + * inactivity, teardown, or "virtual" operation, only one or the + * other will exist (one will outlive the other). So we can't + * call the dev_*() macros, because we don't have a stable dev object. + */ #define dl_err(format, arg...) \ - dev_err(dev->gdev, "dlfb: " format, ## arg) + pr_err("udlfb: " format, ## arg) #define dl_warn(format, arg...) \ - dev_warn(dev->gdev, "dlfb: " format, ## arg) + pr_warning("udlfb: " format, ## arg) #define dl_notice(format, arg...) \ - dev_notice(dev->gdev, "dlfb: " format, ## arg) + pr_notice("udlfb: " format, ## arg) #define dl_info(format, arg...) \ - dev_info(dev->gdev, "dlfb: " format, ## arg) + pr_info("udlfb: " format, ## arg) + #endif |