From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750997AbeAPDMj (ORCPT + 1 other); Mon, 15 Jan 2018 22:12:39 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:37008 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750796AbeAPDMi (ORCPT ); Mon, 15 Jan 2018 22:12:38 -0500 X-Google-Smtp-Source: ACJfBovCZKUbCR1Ydz2sS2VDx/1C8eloeMGalA8jrQR7DQkLyo+yWJkmjWsD8CFPjlPDdnG4vN9F5A== Date: Tue, 16 Jan 2018 04:12:34 +0100 From: Ingo Molnar To: Andy Shevchenko Cc: "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 6/6] x86/boot: Support nocfg parameter for earlyprintk Message-ID: <20180116031234.5lkmuazcob6mqq6m@gmail.com> References: <20180114143254.15429-1-andriy.shevchenko@linux.intel.com> <20180114143254.15429-6-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180114143254.15429-6-andriy.shevchenko@linux.intel.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: * 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)? Thanks, Ingo