From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754416AbdFNHlH (ORCPT ); Wed, 14 Jun 2017 03:41:07 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33201 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754388AbdFNHlF (ORCPT ); Wed, 14 Jun 2017 03:41:05 -0400 Date: Wed, 14 Jun 2017 16:41:04 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Andrew Morton , Peter Zijlstra , Aleksey Makarov , Sabrina Dubroca , Sudeep Holla , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH 1/3] printk/console: Remove superfluous setting of has_preferred state value Message-ID: <20170614074104.GA3011@jagdpanzerIV.localdomain> References: <1497358444-30736-1-git-send-email-pmladek@suse.com> <1497358444-30736-2-git-send-email-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1497358444-30736-2-git-send-email-pmladek@suse.com> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (06/13/17 14:54), Petr Mladek wrote: > It is superfluous to set "has_preferred" when the really preferred > console is enabled. The variable "i" is index of an array. Therefore > "has_preferred" is set only when preferred_console is >= 0. But then > it was already true because of the above code: > > if (!has_preferred || bcon || !console_drivers) > has_preferred = preferred_console >= 0; > > This line was added by the commit ab4af03a4054bd78bc ("[PATCH] CON_CONSDEV > bit not set correctly on last console"). It was kind of logic to store > the really used index there. But this commit actually caused that > "preferred_console" started to be used only as a boolean. This was > discovered and corrected by the commit b077bafa2f3848ddfcef ("printk: > fix name/type/scope of preferred_console var"). > > Signed-off-by: Petr Mladek agree. Reviewed-by: Sergey Senozhatsky -ss > --- > kernel/printk/printk.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index a1db38abac5b..8ebc480fdbc6 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2489,10 +2489,8 @@ void register_console(struct console *newcon) > } > > newcon->flags |= CON_ENABLED; > - if (i == preferred_console) { > + if (i == preferred_console) > newcon->flags |= CON_CONSDEV; > - has_preferred = true; > - } > break; > } > > -- > 1.8.5.6 >