From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751565AbeAPLMP (ORCPT + 1 other); Tue, 16 Jan 2018 06:12:15 -0500 Received: from mga09.intel.com ([134.134.136.24]:23184 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751256AbeAPLMO (ORCPT ); Tue, 16 Jan 2018 06:12:14 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,368,1511856000"; d="scan'208";a="19791139" Message-ID: <1516100440.7000.1010.camel@linux.intel.com> Subject: Re: [PATCH v1 6/6] x86/boot: Support nocfg parameter for earlyprintk From: Andy Shevchenko To: Ingo Molnar Cc: "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org Date: Tue, 16 Jan 2018 13:00:40 +0200 In-Reply-To: <20180116031234.5lkmuazcob6mqq6m@gmail.com> References: <20180114143254.15429-1-andriy.shevchenko@linux.intel.com> <20180114143254.15429-6-andriy.shevchenko@linux.intel.com> <20180116031234.5lkmuazcob6mqq6m@gmail.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, 2018-01-16 at 04:12 +0100, Ingo Molnar wrote: > * Andy Shevchenko wrote: > > > @@ -133,12 +135,16 @@ static void parse_earlyprintk(void) > > if (arg[pos] == ',') > > pos++; > > > > - baud = simple_strtoull(arg + pos, &e, 0); > > - if (baud == 0 || arg + pos == e) > > - baud = DEFAULT_BAUD; > > + if (strncmp(arg + pos, "nocfg", 5)) { > > + baud = simple_strtoull(arg + pos, &e, 0); > > + if (baud == 0 || arg + pos == e) > > + baud = DEFAULT_BAUD; > > + } else { > > + configure = false; > > + } > > } > > > > - early_serial_init(port, baud); > > + early_serial_init(port, baud, configure); > > } > > > > #define BASE_BAUD (1843200/16) > > @@ -162,6 +168,7 @@ static void parse_console_uart8250(void) > > char optstr[64], *options; > > int baud = DEFAULT_BAUD; > > unsigned long port = 0; > > + bool configure = true; > > > > /* > > * console=uart8250,io,0x3f8,115200n8 > > @@ -179,12 +186,16 @@ static void parse_console_uart8250(void) > > else > > return; > > > > - if (options && (options[0] == ',')) > > - baud = simple_strtoull(options + 1, &options, 0); > > - else > > + if (options[0] == ',') { > > + if (strncmp(options + 1, "nocfg", 5)) > > + baud = simple_strtoull(options + 1, > > &options, 0); > > + else > > + configure = false; > > + } else { > > baud = probe_baud(port); > > These code patters seem very similar - could a common function be > factored out, to > simplify future changes (such as the one done here)? Need to think about. Moreoever, arch/x86/kernel/early_print.c contains even more duplication, though I understand why it's split to different folders. And on top of that we have earlycon (which indeed would be more preferable solution). Perhaps, instead of playing with earlyprintk at boot stage we might parse earlycon option that more flexible? P.S. In any choice at least patch 1 (and maybe patch 2) would be needed. -- Andy Shevchenko Intel Finland Oy