[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ffe03b382ee84dbef8567b7377b929e4a8d6c23c.camel@linux.intel.com>
Date: Fri, 29 Jun 2018 19:20:13 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Yisheng Xie <ysxie@...mail.com>, b.zolnierkie@...sung.com,
keescook@...omium.org, j.w.r.degoede@...il.com,
david@...hnology.com
Cc: dri-devel@...ts.freedesktop.org, linux-fbdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fbcon: introduce for_each_registered_fb() helper
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 ?
> 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.
LGTM except macro implementation. That's why I have mentioned
for_each_pci_bridge() to look at.
> +#define for_each_registered_fb(i) \
> + for (i = 0; i < FB_MAX; i++) \
> + if (registered_fb[i])
> +
This needs to be protected against nested conditionals.
Otherwise compiler issues a warning and even may generate wrong code.
--
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Intel Finland Oy
Powered by blists - more mailing lists