Re: [PATCH] fbcon: introduce for_each_registered_fb() helper

2018-07-02 Thread Andy Shevchenko
On Mon, 2018-07-02 at 09:36 +0200, Bernd Petrovitsch wrote: > > +#define for_each_registered_fb(i) \ > > + for (i = 0; i < FB_MAX; i++)\ > > + if (registered_fb[i]) > > + > > That leaves the possibility of a dangling-else. > snip > #define

Re: [PATCH] fbcon: introduce for_each_registered_fb() helper

2018-07-02 Thread Bernd Petrovitsch
Hi all! On Fri, 2018-06-29 at 00:20 +0800, Yisheng Xie wrote: [...] > diff --git a/include/linux/fb.h b/include/linux/fb.h > index aa74a22..3e13b95 100644 > --- a/include/linux/fb.h > +++ b/include/linux/fb.h > @@ -650,6 +650,10 @@ extern int fb_get_color_depth(struct > fb_var_screeninfo *var, >

Re: [PATCH] fbcon: introduce for_each_registered_fb() helper

2018-07-02 Thread Andy Shevchenko
On Mon, 2018-07-02 at 09:30 +0200, Daniel Vetter wrote: > On Fri, Jun 29, 2018 at 07:20:13PM +0300, Andy Shevchenko wrote: > > On Fri, 2018-06-29 at 00:20 +0800, Yisheng Xie wrote: > > LGTM except macro implementation. That's why I have mentioned > > for_each_pci_bridge() to look at. > > > > >

Re: [PATCH] fbcon: introduce for_each_registered_fb() helper

2018-07-02 Thread Daniel Vetter
On Fri, Jun 29, 2018 at 07:20:13PM +0300, Andy Shevchenko wrote: > On Fri, 2018-06-29 at 00:20 +0800, Yisheng Xie wrote: > > Following pattern is often used: > > > > for (i = 0; i < FB_MAX; i++) { > > if (registered_fb[i]) { > > ... > > } > > } > > > >

Re: [PATCH] fbcon: introduce for_each_registered_fb() helper

2018-07-01 Thread Andy Shevchenko
On Fri, 2018-06-29 at 00:20 +0800, Yisheng Xie wrote: > 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 Suggested-by then ? >

Re: [PATCH] fbcon: introduce for_each_registered_fb() helper

2018-07-01 Thread Yisheng Xie
Hi Hans, On 06/29/2018 02:50 AM, Hans de Goede wrote: > Hi, > > Looks good, but you should probably do a new version based on: > > https://github.com/bzolnier/linux/tree/fbdev-for-next > > This has one more loop to replace, in the fbcon_output_notifier() > function which was introduced by: >

Re: [PATCH] fbcon: introduce for_each_registered_fb() helper

2018-06-29 Thread Hans de Goede
Hi, Looks good, but you should probably do a new version based on: https://github.com/bzolnier/linux/tree/fbdev-for-next This has one more loop to replace, in the fbcon_output_notifier() function which was introduced by:

[PATCH] fbcon: introduce for_each_registered_fb() helper

2018-06-29 Thread Yisheng Xie
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