fb: add hooks to handle KDB enter/exit
[sfrench/cifs-2.6.git] / include / linux / fb.h
index 8e5a9dfb76bf6425934a09427b8f16df82e937be..0c5659c41b01c502160ca089bd758a36963f7918 100644 (file)
@@ -3,6 +3,9 @@
 
 #include <linux/types.h>
 #include <linux/i2c.h>
+#ifdef __KERNEL__
+#include <linux/kgdb.h>
+#endif /* __KERNEL__ */
 
 /* Definitions of frame buffers                                                */
 
@@ -607,6 +610,12 @@ struct fb_deferred_io {
  * LOCKING NOTE: those functions must _ALL_ be called with the console
  * semaphore held, this is the only suitable locking mechanism we have
  * in 2.6. Some may be called at interrupt time at this point though.
+ *
+ * The exception to this is the debug related hooks.  Putting the fb
+ * into a debug state (e.g. flipping to the kernel console) and restoring
+ * it must be done in a lock-free manner, so low level drivers should
+ * keep track of the initial console (if applicable) and may need to
+ * perform direct, unlocked hardware writes in these hooks.
  */
 
 struct fb_ops {
@@ -676,6 +685,10 @@ struct fb_ops {
 
        /* teardown any resources to do with this framebuffer */
        void (*fb_destroy)(struct fb_info *info);
+
+       /* called at KDB enter and leave time to prepare the console */
+       int (*fb_debug_enter)(struct fb_info *info);
+       int (*fb_debug_leave)(struct fb_info *info);
 };
 
 #ifdef CONFIG_FB_TILEBLITTING
@@ -873,6 +886,8 @@ struct fb_info {
 static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
        struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct)
                        + max_num * sizeof(struct aperture), GFP_KERNEL);
+       if (!a)
+               return NULL;
        a->count = max_num;
        return a;
 }