summaryrefslogtreecommitdiff
path: root/include/linux/fb.h
diff options
context:
space:
mode:
authorYisheng Xie <ysxie@foxmail.com>2018-07-24 20:11:26 +0300
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2018-07-24 20:11:26 +0300
commit10ac86884b4d7642a235f9da61367c3f8d2ab2ff (patch)
treec75db9b97819001783ef27854b74e3920d66d2ed /include/linux/fb.h
parent4a1208c5b46a711d7d8bb2b327ae5c2b144a8e72 (diff)
downloadlinux-10ac86884b4d7642a235f9da61367c3f8d2ab2ff.tar.xz
fbcon: introduce for_each_registered_fb() helper
Following pattern is often used: for (i = 0; i < FB_MAX; i++) { if (registered_fb[i]) { ... } } Therefore, as Andy's suggestion, for_each_registered_fb() helper can be introduced to make the code easier to read and write by reducing indentation level. It also saves few lines of code in each occurrence. This patch convert all part here at the same time. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Yisheng Xie <ysxie@foxmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Kees Cook <keescook@chromium.org> Cc: David Lechner <david@lechnology.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Diffstat (limited to 'include/linux/fb.h')
-rw-r--r--include/linux/fb.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/fb.h b/include/linux/fb.h
index aa74a228bb92..fd31e6f24b8d 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -650,6 +650,10 @@ extern struct fb_info *registered_fb[FB_MAX];
extern int num_registered_fb;
extern struct class *fb_class;
+#define for_each_registered_fb(i) \
+ for (i = 0; i < FB_MAX; i++) \
+ if (!registered_fb[i]) {} else
+
extern int lock_fb_info(struct fb_info *info);
static inline void unlock_fb_info(struct fb_info *info)