linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 fbdev-for-next 1/2] fbcon: introduce for_each_registered_fb() helper
@ 2018-06-30  7:29 ` Yisheng Xie
  2018-06-30 10:32   ` Hans de Goede
                     ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Yisheng Xie @ 2018-06-30  7:29 UTC (permalink / raw)
  To: b.zolnierkie, keescook, j.w.r.degoede, david
  Cc: andriy.shevchenko, dri-devel, linux-fbdev, linux-kernel, 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 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>
---
v2:
 - rebase it to fbdev-for-next branch and add one more loop to replace - per Hans
 - Macro should be protected against nested conditionals. - per Andy
 drivers/video/fbdev/core/fbcon.c | 31 +++++++++++--------------------
 drivers/video/fbdev/core/fbmem.c |  4 +---
 include/linux/fb.h               |  4 ++++
 3 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 5fb156b..e30d3a1 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2234,8 +2234,8 @@ static int fbcon_switch(struct vc_data *vc)
 	 *
 	 * info->currcon = vc->vc_num;
 	 */
-	for (i = 0; i < FB_MAX; i++) {
-		if (registered_fb[i] != NULL && registered_fb[i]->fbcon_par) {
+	for_each_registered_fb(i) {
+		if (registered_fb[i]->fbcon_par) {
 			struct fbcon_ops *o = registered_fb[i]->fbcon_par;
 
 			o->currcon = vc->vc_num;
@@ -3124,11 +3124,9 @@ static int fbcon_fb_unregistered(struct fb_info *info)
 	if (idx == info_idx) {
 		info_idx = -1;
 
-		for (i = 0; i < FB_MAX; i++) {
-			if (registered_fb[i] != NULL) {
-				info_idx = i;
-				break;
-			}
+		for_each_registered_fb(i) {
+			info_idx = i;
+			break;
 		}
 	}
 
@@ -3609,10 +3607,8 @@ static int fbcon_output_notifier(struct notifier_block *nb,
 	deferred_takeover = false;
 	logo_shown = FBCON_LOGO_DONTSHOW;
 
-	for (i = 0; i < FB_MAX; i++) {
-		if (registered_fb[i])
-			fbcon_fb_registered(registered_fb[i]);
-	}
+	for_each_registered_fb(i)
+		fbcon_fb_registered(registered_fb[i]);
 
 	return NOTIFY_OK;
 }
@@ -3638,11 +3634,9 @@ static void fbcon_start(void)
 
 		console_lock();
 
-		for (i = 0; i < FB_MAX; i++) {
-			if (registered_fb[i] != NULL) {
-				info_idx = i;
-				break;
-			}
+		for_each_registered_fb(i) {
+			info_idx = i;
+			break;
 		}
 
 		do_fbcon_takeover(0);
@@ -3669,15 +3663,12 @@ static void fbcon_exit(void)
 	kfree((void *)softback_buf);
 	softback_buf = 0UL;
 
-	for (i = 0; i < FB_MAX; i++) {
+	for_each_registered_fb(i) {
 		int pending = 0;
 
 		mapped = 0;
 		info = registered_fb[i];
 
-		if (info == NULL)
-			continue;
-
 		if (info->queue.func)
 			pending = cancel_work_sync(&info->queue);
 		DPRINTK("fbcon: %s pending work\n", (pending ? "canceled" :
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 609438d..645c6ac 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1593,10 +1593,8 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
 	int i, ret;
 
 	/* check all firmware fbs and kick off if the base addr overlaps */
-	for (i = 0 ; i < FB_MAX; i++) {
+	for_each_registered_fb(i) {
 		struct apertures_struct *gen_aper;
-		if (!registered_fb[i])
-			continue;
 
 		if (!(registered_fb[i]->flags & FBINFO_MISC_FIRMWARE))
 			continue;
diff --git a/include/linux/fb.h b/include/linux/fb.h
index aa74a22..fd31e6f 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,
 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)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 fbdev-for-next 1/2] fbcon: introduce for_each_registered_fb() helper
  2018-06-30  7:29 ` [PATCH v2 fbdev-for-next 1/2] fbcon: introduce for_each_registered_fb() helper Yisheng Xie
@ 2018-06-30 10:32   ` Hans de Goede
  2018-06-30 15:50   ` Andy Shevchenko
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2018-06-30 10:32 UTC (permalink / raw)
  To: Yisheng Xie, b.zolnierkie, keescook, david
  Cc: andriy.shevchenko, dri-devel, linux-fbdev, linux-kernel

Hi,

On 30-06-18 09:29, 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
> 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>

Both patches look good to me, and both are:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
> v2:
>   - rebase it to fbdev-for-next branch and add one more loop to replace - per Hans
>   - Macro should be protected against nested conditionals. - per Andy
>   drivers/video/fbdev/core/fbcon.c | 31 +++++++++++--------------------
>   drivers/video/fbdev/core/fbmem.c |  4 +---
>   include/linux/fb.h               |  4 ++++
>   3 files changed, 16 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 5fb156b..e30d3a1 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -2234,8 +2234,8 @@ static int fbcon_switch(struct vc_data *vc)
>   	 *
>   	 * info->currcon = vc->vc_num;
>   	 */
> -	for (i = 0; i < FB_MAX; i++) {
> -		if (registered_fb[i] != NULL && registered_fb[i]->fbcon_par) {
> +	for_each_registered_fb(i) {
> +		if (registered_fb[i]->fbcon_par) {
>   			struct fbcon_ops *o = registered_fb[i]->fbcon_par;
>   
>   			o->currcon = vc->vc_num;
> @@ -3124,11 +3124,9 @@ static int fbcon_fb_unregistered(struct fb_info *info)
>   	if (idx == info_idx) {
>   		info_idx = -1;
>   
> -		for (i = 0; i < FB_MAX; i++) {
> -			if (registered_fb[i] != NULL) {
> -				info_idx = i;
> -				break;
> -			}
> +		for_each_registered_fb(i) {
> +			info_idx = i;
> +			break;
>   		}
>   	}
>   
> @@ -3609,10 +3607,8 @@ static int fbcon_output_notifier(struct notifier_block *nb,
>   	deferred_takeover = false;
>   	logo_shown = FBCON_LOGO_DONTSHOW;
>   
> -	for (i = 0; i < FB_MAX; i++) {
> -		if (registered_fb[i])
> -			fbcon_fb_registered(registered_fb[i]);
> -	}
> +	for_each_registered_fb(i)
> +		fbcon_fb_registered(registered_fb[i]);
>   
>   	return NOTIFY_OK;
>   }
> @@ -3638,11 +3634,9 @@ static void fbcon_start(void)
>   
>   		console_lock();
>   
> -		for (i = 0; i < FB_MAX; i++) {
> -			if (registered_fb[i] != NULL) {
> -				info_idx = i;
> -				break;
> -			}
> +		for_each_registered_fb(i) {
> +			info_idx = i;
> +			break;
>   		}
>   
>   		do_fbcon_takeover(0);
> @@ -3669,15 +3663,12 @@ static void fbcon_exit(void)
>   	kfree((void *)softback_buf);
>   	softback_buf = 0UL;
>   
> -	for (i = 0; i < FB_MAX; i++) {
> +	for_each_registered_fb(i) {
>   		int pending = 0;
>   
>   		mapped = 0;
>   		info = registered_fb[i];
>   
> -		if (info == NULL)
> -			continue;
> -
>   		if (info->queue.func)
>   			pending = cancel_work_sync(&info->queue);
>   		DPRINTK("fbcon: %s pending work\n", (pending ? "canceled" :
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index 609438d..645c6ac 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1593,10 +1593,8 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
>   	int i, ret;
>   
>   	/* check all firmware fbs and kick off if the base addr overlaps */
> -	for (i = 0 ; i < FB_MAX; i++) {
> +	for_each_registered_fb(i) {
>   		struct apertures_struct *gen_aper;
> -		if (!registered_fb[i])
> -			continue;
>   
>   		if (!(registered_fb[i]->flags & FBINFO_MISC_FIRMWARE))
>   			continue;
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index aa74a22..fd31e6f 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,
>   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)
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 fbdev-for-next 1/2] fbcon: introduce for_each_registered_fb() helper
  2018-06-30  7:29 ` [PATCH v2 fbdev-for-next 1/2] fbcon: introduce for_each_registered_fb() helper Yisheng Xie
  2018-06-30 10:32   ` Hans de Goede
@ 2018-06-30 15:50   ` Andy Shevchenko
  2018-07-02 13:57   ` Jani Nikula
  2018-07-24 15:18   ` Bartlomiej Zolnierkiewicz
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2018-06-30 15:50 UTC (permalink / raw)
  To: Yisheng Xie, b.zolnierkie, keescook, j.w.r.degoede, david
  Cc: dri-devel, linux-fbdev, linux-kernel

On Sat, 2018-06-30 at 15:29 +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
> 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.
> 

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Yisheng Xie <ysxie@foxmail.com>
> ---
> v2:
>  - rebase it to fbdev-for-next branch and add one more loop to replace
> - per Hans
>  - Macro should be protected against nested conditionals. - per Andy
>  drivers/video/fbdev/core/fbcon.c | 31 +++++++++++--------------------
>  drivers/video/fbdev/core/fbmem.c |  4 +---
>  include/linux/fb.h               |  4 ++++
>  3 files changed, 16 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c
> b/drivers/video/fbdev/core/fbcon.c
> index 5fb156b..e30d3a1 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -2234,8 +2234,8 @@ static int fbcon_switch(struct vc_data *vc)
>  	 *
>  	 * info->currcon = vc->vc_num;
>  	 */
> -	for (i = 0; i < FB_MAX; i++) {
> -		if (registered_fb[i] != NULL && registered_fb[i]-
> >fbcon_par) {
> +	for_each_registered_fb(i) {
> +		if (registered_fb[i]->fbcon_par) {
>  			struct fbcon_ops *o = registered_fb[i]-
> >fbcon_par;
>  
>  			o->currcon = vc->vc_num;
> @@ -3124,11 +3124,9 @@ static int fbcon_fb_unregistered(struct fb_info
> *info)
>  	if (idx == info_idx) {
>  		info_idx = -1;
>  
> -		for (i = 0; i < FB_MAX; i++) {
> -			if (registered_fb[i] != NULL) {
> -				info_idx = i;
> -				break;
> -			}
> +		for_each_registered_fb(i) {
> +			info_idx = i;
> +			break;
>  		}
>  	}
>  
> @@ -3609,10 +3607,8 @@ static int fbcon_output_notifier(struct
> notifier_block *nb,
>  	deferred_takeover = false;
>  	logo_shown = FBCON_LOGO_DONTSHOW;
>  
> -	for (i = 0; i < FB_MAX; i++) {
> -		if (registered_fb[i])
> -			fbcon_fb_registered(registered_fb[i]);
> -	}
> +	for_each_registered_fb(i)
> +		fbcon_fb_registered(registered_fb[i]);
>  
>  	return NOTIFY_OK;
>  }
> @@ -3638,11 +3634,9 @@ static void fbcon_start(void)
>  
>  		console_lock();
>  
> -		for (i = 0; i < FB_MAX; i++) {
> -			if (registered_fb[i] != NULL) {
> -				info_idx = i;
> -				break;
> -			}
> +		for_each_registered_fb(i) {
> +			info_idx = i;
> +			break;
>  		}
>  
>  		do_fbcon_takeover(0);
> @@ -3669,15 +3663,12 @@ static void fbcon_exit(void)
>  	kfree((void *)softback_buf);
>  	softback_buf = 0UL;
>  
> -	for (i = 0; i < FB_MAX; i++) {
> +	for_each_registered_fb(i) {
>  		int pending = 0;
>  
>  		mapped = 0;
>  		info = registered_fb[i];
>  
> -		if (info == NULL)
> -			continue;
> -
>  		if (info->queue.func)
>  			pending = cancel_work_sync(&info->queue);
>  		DPRINTK("fbcon: %s pending work\n", (pending ?
> "canceled" :
> diff --git a/drivers/video/fbdev/core/fbmem.c
> b/drivers/video/fbdev/core/fbmem.c
> index 609438d..645c6ac 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1593,10 +1593,8 @@ static int
> do_remove_conflicting_framebuffers(struct apertures_struct *a,
>  	int i, ret;
>  
>  	/* check all firmware fbs and kick off if the base addr
> overlaps */
> -	for (i = 0 ; i < FB_MAX; i++) {
> +	for_each_registered_fb(i) {
>  		struct apertures_struct *gen_aper;
> -		if (!registered_fb[i])
> -			continue;
>  
>  		if (!(registered_fb[i]->flags &
> FBINFO_MISC_FIRMWARE))
>  			continue;
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index aa74a22..fd31e6f 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,
>  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)

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 fbdev-for-next 1/2] fbcon: introduce for_each_registered_fb() helper
  2018-06-30  7:29 ` [PATCH v2 fbdev-for-next 1/2] fbcon: introduce for_each_registered_fb() helper Yisheng Xie
  2018-06-30 10:32   ` Hans de Goede
  2018-06-30 15:50   ` Andy Shevchenko
@ 2018-07-02 13:57   ` Jani Nikula
  2018-07-24 15:18   ` Bartlomiej Zolnierkiewicz
  3 siblings, 0 replies; 5+ messages in thread
From: Jani Nikula @ 2018-07-02 13:57 UTC (permalink / raw)
  To: Yisheng Xie, b.zolnierkie, keescook, j.w.r.degoede, david
  Cc: Yisheng Xie, linux-fbdev, andriy.shevchenko, linux-kernel, dri-devel

On Sat, 30 Jun 2018, Yisheng Xie <ysxie@foxmail.com> 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
> 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>
> ---
> v2:
>  - rebase it to fbdev-for-next branch and add one more loop to replace - per Hans
>  - Macro should be protected against nested conditionals. - per Andy
>  drivers/video/fbdev/core/fbcon.c | 31 +++++++++++--------------------
>  drivers/video/fbdev/core/fbmem.c |  4 +---
>  include/linux/fb.h               |  4 ++++
>  3 files changed, 16 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 5fb156b..e30d3a1 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -2234,8 +2234,8 @@ static int fbcon_switch(struct vc_data *vc)
>  	 *
>  	 * info->currcon = vc->vc_num;
>  	 */
> -	for (i = 0; i < FB_MAX; i++) {
> -		if (registered_fb[i] != NULL && registered_fb[i]->fbcon_par) {
> +	for_each_registered_fb(i) {
> +		if (registered_fb[i]->fbcon_par) {
>  			struct fbcon_ops *o = registered_fb[i]->fbcon_par;
>  
>  			o->currcon = vc->vc_num;
> @@ -3124,11 +3124,9 @@ static int fbcon_fb_unregistered(struct fb_info *info)
>  	if (idx == info_idx) {
>  		info_idx = -1;
>  
> -		for (i = 0; i < FB_MAX; i++) {
> -			if (registered_fb[i] != NULL) {
> -				info_idx = i;
> -				break;
> -			}
> +		for_each_registered_fb(i) {
> +			info_idx = i;
> +			break;
>  		}
>  	}
>  
> @@ -3609,10 +3607,8 @@ static int fbcon_output_notifier(struct notifier_block *nb,
>  	deferred_takeover = false;
>  	logo_shown = FBCON_LOGO_DONTSHOW;
>  
> -	for (i = 0; i < FB_MAX; i++) {
> -		if (registered_fb[i])
> -			fbcon_fb_registered(registered_fb[i]);
> -	}
> +	for_each_registered_fb(i)
> +		fbcon_fb_registered(registered_fb[i]);
>  
>  	return NOTIFY_OK;
>  }
> @@ -3638,11 +3634,9 @@ static void fbcon_start(void)
>  
>  		console_lock();
>  
> -		for (i = 0; i < FB_MAX; i++) {
> -			if (registered_fb[i] != NULL) {
> -				info_idx = i;
> -				break;
> -			}
> +		for_each_registered_fb(i) {
> +			info_idx = i;
> +			break;
>  		}
>  
>  		do_fbcon_takeover(0);
> @@ -3669,15 +3663,12 @@ static void fbcon_exit(void)
>  	kfree((void *)softback_buf);
>  	softback_buf = 0UL;
>  
> -	for (i = 0; i < FB_MAX; i++) {
> +	for_each_registered_fb(i) {
>  		int pending = 0;
>  
>  		mapped = 0;
>  		info = registered_fb[i];
>  
> -		if (info == NULL)
> -			continue;
> -
>  		if (info->queue.func)
>  			pending = cancel_work_sync(&info->queue);
>  		DPRINTK("fbcon: %s pending work\n", (pending ? "canceled" :
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index 609438d..645c6ac 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1593,10 +1593,8 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
>  	int i, ret;
>  
>  	/* check all firmware fbs and kick off if the base addr overlaps */
> -	for (i = 0 ; i < FB_MAX; i++) {
> +	for_each_registered_fb(i) {
>  		struct apertures_struct *gen_aper;
> -		if (!registered_fb[i])
> -			continue;
>  
>  		if (!(registered_fb[i]->flags & FBINFO_MISC_FIRMWARE))
>  			continue;
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index aa74a22..fd31e6f 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,
>  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

There's for_each_if in drmP.h to handle dangling else. Maybe that should
be lifted outside of drm.

BR,
Jani.

> +
>  extern int lock_fb_info(struct fb_info *info);
>  
>  static inline void unlock_fb_info(struct fb_info *info)

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 fbdev-for-next 1/2] fbcon: introduce for_each_registered_fb() helper
  2018-06-30  7:29 ` [PATCH v2 fbdev-for-next 1/2] fbcon: introduce for_each_registered_fb() helper Yisheng Xie
                     ` (2 preceding siblings ...)
  2018-07-02 13:57   ` Jani Nikula
@ 2018-07-24 15:18   ` Bartlomiej Zolnierkiewicz
  3 siblings, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-07-24 15:18 UTC (permalink / raw)
  To: Yisheng Xie
  Cc: keescook, j.w.r.degoede, david, andriy.shevchenko, dri-devel,
	linux-fbdev, linux-kernel

On Saturday, June 30, 2018 03:29:49 PM 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
> 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>

Patch queued for 4.19, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-24 15:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180630073004epcas2p2d87aa0abbbae08dafd661c8378ba1de1@epcas2p2.samsung.com>
2018-06-30  7:29 ` [PATCH v2 fbdev-for-next 1/2] fbcon: introduce for_each_registered_fb() helper Yisheng Xie
2018-06-30 10:32   ` Hans de Goede
2018-06-30 15:50   ` Andy Shevchenko
2018-07-02 13:57   ` Jani Nikula
2018-07-24 15:18   ` Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).