From patchwork Wed Mar 1 16:13:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 94718 Delivered-To: patch@linaro.org Received: by 10.140.20.113 with SMTP id 104csp1873157qgi; Wed, 1 Mar 2017 08:18:08 -0800 (PST) X-Received: by 10.99.120.138 with SMTP id t132mr5732585pgc.80.1488385088642; Wed, 01 Mar 2017 08:18:08 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a62si4965175pgc.371.2017.03.01.08.18.08; Wed, 01 Mar 2017 08:18:08 -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; dkim=pass header.i=@linaro.org; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753218AbdCAQRv (ORCPT + 25 others); Wed, 1 Mar 2017 11:17:51 -0500 Received: from mail-lf0-f52.google.com ([209.85.215.52]:33901 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753049AbdCAQRs (ORCPT ); Wed, 1 Mar 2017 11:17:48 -0500 Received: by mail-lf0-f52.google.com with SMTP id k202so21728746lfe.1 for ; Wed, 01 Mar 2017 08:17:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=k7QiJqLwJUTEKlR4rGnmg9ocWKQxGmGKb/QMb25ffak=; b=a1i/bm7IREMFlpKzQ2kJEF4fTiERnDjoKOIBvAwfyiG0uHtRMamI5/3CjYljwHMD0u 4NZMYnJBzgGbYeTzi6j6jcBiWt0qnnQDGUMBhyOJgs81CX81yVV7Jcgw1Tu1wccY7X9+ L2PvzWnwypC5QtC/dICkAPXOnOT0DVpx3/Ejg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=k7QiJqLwJUTEKlR4rGnmg9ocWKQxGmGKb/QMb25ffak=; b=j5flr7LccWAe9PMKaGDKVjTdRPKAuTpG9sdIuiHEXYBN0TDLrM/WaADs44+9un7Atm sTc9REzdPUJRJ95bWG9xZiPPQ6CWGJvHQ5zGjFfLPCbNo41rqIDlH/FRF47UAJeZRRku w4sLhdn47ZhZIzLk0dxbp7QiWxn4irBrPyeIQFycunn9b6U+U2pb4XO/pPl/PwoWYktb WNXOb9UkJpUqXa+NTX6fv2MpZRuvFj2OhTequUDkRlg/5ym6DGk6T2xx5QMnWpB5dERn gHzXS25BhubnepwJC+4Dpzq6FSZAEJqhCXkB3QmrYP9vgG0PYWkpB9EFhPa1ymn4LdcD aGAg== X-Gm-Message-State: AMke39kY769rK9ddnxl+wXkibepK2MHzC1xQxFwB5xMVb3gMRF0xyHjHTvHr694EPGGHx/Po X-Received: by 10.25.19.194 with SMTP id 63mr3008251lft.144.1488385060893; Wed, 01 Mar 2017 08:17:40 -0800 (PST) Received: from localhost.localdomain (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id x64sm1161937lfd.15.2017.03.01.08.17.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Mar 2017 08:17:40 -0800 (PST) From: Aleksey Makarov To: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Aleksey Makarov , Sudeep Holla , Greg Kroah-Hartman , Peter Hurley , Jiri Slaby , Robin Murphy Subject: [PATCH 0/2] printk: fix double printing with earlycon Date: Wed, 1 Mar 2017 19:13:44 +0300 Message-Id: <20170301161347.4202-1-aleksey.makarov@linaro.org> X-Mailer: git-send-email 2.11.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a console was specified by ACPI SPCR table _and_ command line parameters like "console=ttyAMA0" _and_ "earlycon" were specified, then log messages appears twice. This issue was addressed in the patch [1] but the approach was wrong and a revert [2] was suggested. First patch "printk: fix name and type of some variables" was sent some time ago [3]. It fixes name/type/scope of some variables without changing the logic. The real fix is in the second patch. The root cause is that the code traverse the list of specified consoles (the `console_cmdline` array) and stops at the first match. But it may happen that the same console is referred by the elements of this array twice: ttyAMA0 -- from command line pl011,mmio,0x87e024000000,115200 -- from SPCR but in this case `preferred_console` points to the second entry and the flag CON_CONSDEV is not set, so bootconsole is not deregistered. To fix that, match the console against the `console_cmdline` entry pointed by `preferred_console` instead of the first match. [1] https://lkml.kernel.org/r/1485963998-921-1-git-send-email-sudeep.holla@arm.com commit aea9a80ba98a ("tty: serial: pl011: add ttyAMA for matching pl011 console") [2] https://lkml.kernel.org/r/20170301152304.29635-1-aleksey.makarov@linaro.org [3] https://lkml.kernel.org/r/1455299022-11641-2-git-send-email-aleksey.makarov@linaro.org Aleksey Makarov (2): printk: fix name and type of some variables printk: fix double printing with earlycon kernel/printk/printk.c | 66 +++++++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 28 deletions(-) -- 2.11.1