Commit 6b1d64ca authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

tty: Use find_next_bit helper in tty_verify_active_pairs

Since we have find_next_bit in our sources now, lets
use for_each_bit helper to speedup a search procedure.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent aa53547a
...@@ -164,11 +164,15 @@ static int tty_get_index(u32 id) ...@@ -164,11 +164,15 @@ static int tty_get_index(u32 id)
/* Make sure the active pairs do exist */ /* Make sure the active pairs do exist */
int tty_verify_active_pairs(void) int tty_verify_active_pairs(void)
{ {
int i, unpaired_slaves = 0; unsigned long i, unpaired_slaves = 0;
for_each_bit(i, tty_active_pairs) {
if (is_log2(i)) {
if (test_bit(i + 1, tty_active_pairs)) {
i++;
continue;
}
for (i = 0; i < (MAX_TTYS << 1); i += 2) {
if (test_bit(i, tty_active_pairs) &&
!test_bit(i + 1, tty_active_pairs)) {
if (!opts.shell_job) { if (!opts.shell_job) {
pr_err("Found slave peer index %d without " pr_err("Found slave peer index %d without "
"correspond master peer\n", "correspond master peer\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment