From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Qianqiang Liu <qianqiang.liu@163.com>
Cc: deller@gmx.de, linux-fbdev@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fbcon: break earlier in search_fb_in_map and search_for_mapped_con
Date: Sun, 29 Sep 2024 22:45:24 +0300 [thread overview]
Message-ID: <ZvmuVPwaHb1vFCmZ@surfacebook.localdomain> (raw)
In-Reply-To: <20240926115911.620624-1-qianqiang.liu@163.com>
Thu, Sep 26, 2024 at 07:59:11PM +0800, Qianqiang Liu kirjoitti:
> Break the for loop immediately upon finding the target, making the
> process more efficient.
You may make it even more effecient (in terms of code readability as I believe
compiler optimizes this anyway to the same):
> int i, retval = 0;
>
> for (i = first_fb_vc; i <= last_fb_vc; i++) {
> - if (con2fb_map[i] == idx)
> + if (con2fb_map[i] == idx) {
> retval = 1;
> + break;
> + }
return 1;
> }
> return retval;
return 0;
> }
...
> int i, retval = 0;
>
> for (i = first_fb_vc; i <= last_fb_vc; i++) {
> - if (con2fb_map[i] != -1)
> + if (con2fb_map[i] != -1) {
> retval = 1;
> + break;
> + }
> }
> return retval;
Ditto.
...
Since it's applied, you can consider a followup.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2024-09-29 19:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-26 11:59 [PATCH] fbcon: break earlier in search_fb_in_map and search_for_mapped_con Qianqiang Liu
2024-09-26 16:25 ` Helge Deller
2024-09-29 19:45 ` Andy Shevchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZvmuVPwaHb1vFCmZ@surfacebook.localdomain \
--to=andy.shevchenko@gmail.com \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qianqiang.liu@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).