Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp968543ybl; Fri, 24 Jan 2020 12:54:42 -0800 (PST) X-Google-Smtp-Source: APXvYqyhftVlPI+JvMcDRgRhpmlY7CL5T3YQlpy2xSz4lxjZjEYPS7afCxF753WG16hHFDRmS0OG X-Received: by 2002:a9d:6acd:: with SMTP id m13mr4077369otq.313.1579899281980; Fri, 24 Jan 2020 12:54:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579899281; cv=none; d=google.com; s=arc-20160816; b=h9Q62dT1ffYHvY+/9FzqTgLF/4ozTa0e9Evd5sAGA006weJgQmkRPxlEJhnbyj5bHA qBApAST0qFWwerUNSEPjb5mB/KLk5qnQYqmRph1VYJLEZDRJ2qRNcRIap5vCS7gBx9VZ wl3czVi2BRE+0oDxUryIR4RucIitmXdrG3+qLctdmmxEcu+p6X0irzQmAilnK3lTmnth HXQsK4hn+JVoHzAgGCjQMJkvPlh5Z2CbNNVWMixxU/uz8KwxOkLTUqyAposkwCFYknR8 qtHbUK/RXUt70o/Sp51ztAsH50NpeQmXDgEoschThVMNUXW+DqddOxVwKPaeVnam3q8f ykVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=hpKJfjGVpY7/tpMEt7HEU6ICIlVVYPhBQE9M3PMVVro=; b=RkBil0dGCtfB+ItIufnxtDTJJYwcifZDLMc3gC4I9z4v7RDvDnxER2KQyKVw7cOPfR 8ESBu+Bj9LlSXcg6oO+K2UcwG+eUfsaS8a56Y2UiN09wI3DXEo9mL9a1BCInzCne8X63 sXV2tnjyxxt/eqto+xcDZf4yYyOLR6QovTmn1JIMPkEfp7gkNfxMcaXj3DfFunZ3eZO8 Y0bws8gR9uzeCmD21oXfdLXDdVyQMuHcZTZVVXBVbn7FU5d9rHQF/vHleGuxCzYxBlsS sljFmDhsTjz/t4/YJDaemIHCEsiqfxdwp87K5PAv0lvogCqXvVvUZ5iVcJXoEFBctDje 5vyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h7si2948381otm.165.2020.01.24.12.54.29; Fri, 24 Jan 2020 12:54:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730653AbgAXP5p (ORCPT + 99 others); Fri, 24 Jan 2020 10:57:45 -0500 Received: from mga17.intel.com ([192.55.52.151]:53173 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729225AbgAXP5h (ORCPT ); Fri, 24 Jan 2020 10:57:37 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2020 07:57:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,358,1574150400"; d="scan'208";a="375542487" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 24 Jan 2020 07:57:34 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8A7CC115; Fri, 24 Jan 2020 17:57:33 +0200 (EET) From: Andy Shevchenko To: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v2 1/5] console: Don't perform test for CON_BRL flag twice Date: Fri, 24 Jan 2020 17:57:28 +0200 Message-Id: <20200124155733.54799-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The braille_unregister_console() already tests for console to have CON_BRL flag. No need to repeat this in _braille_unregister_console(). However, we need to check for that flag at the beginning of the function to avoid any regressions in the callers. Signed-off-by: Andy Shevchenko --- v2: new patch drivers/accessibility/braille/braille_console.c | 4 ++-- kernel/printk/braille.c | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/accessibility/braille/braille_console.c b/drivers/accessibility/braille/braille_console.c index 1339c586bf64..f0ffccfb6bb7 100644 --- a/drivers/accessibility/braille/braille_console.c +++ b/drivers/accessibility/braille/braille_console.c @@ -369,10 +369,10 @@ int braille_register_console(struct console *console, int index, int braille_unregister_console(struct console *console) { - if (braille_co != console) - return -EINVAL; if (!(console->flags & CON_BRL)) return 0; + if (braille_co != console) + return -EINVAL; unregister_keyboard_notifier(&keyboard_notifier_block); unregister_vt_notifier(&vt_notifier_block); braille_co = NULL; diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c index 17a9591e54ff..2ec42173890f 100644 --- a/kernel/printk/braille.c +++ b/kernel/printk/braille.c @@ -51,8 +51,5 @@ _braille_register_console(struct console *console, struct console_cmdline *c) int _braille_unregister_console(struct console *console) { - if (console->flags & CON_BRL) - return braille_unregister_console(console); - - return 0; + return braille_unregister_console(console); } -- 2.24.1