aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorYisheng Xie <[email protected]>2018-07-24 19:11:26 +0200
committerBartlomiej Zolnierkiewicz <[email protected]>2018-07-24 19:11:26 +0200
commit10ac86884b4d7642a235f9da61367c3f8d2ab2ff (patch)
treec75db9b97819001783ef27854b74e3920d66d2ed /include/linux
parent4a1208c5b46a711d7d8bb2b327ae5c2b144a8e72 (diff)
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 <[email protected]> Signed-off-by: Yisheng Xie <[email protected]> Acked-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Cc: Kees Cook <[email protected]> Cc: David Lechner <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
Diffstat (limited to 'include/linux')
-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)