Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1579029imm; Fri, 7 Sep 2018 02:43:06 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYlx4zB0v9lk3sF3ojIhR529yq+H/rx7+u9+3vdKHS/n1oKWf2nxhkU2uReP5id/ocsz+8p X-Received: by 2002:a63:2043:: with SMTP id r3-v6mr7266218pgm.105.1536313386817; Fri, 07 Sep 2018 02:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536313386; cv=none; d=google.com; s=arc-20160816; b=PUe7BmEWLdobx326w0t2r2byRcBiGq3LO4jMCIYqUEEChMc0fomo6mj/UU+ZNS3fbK j49xq/svvTrEWmKfK1OIjFhZWpVrOJL6IF9I7gLHu9TwJAA66Xm+wNU95SFoV2SoFlFY kMC6Ky5+0rTjLTeEck0vbuSLM3NhoCkszKzV18aUW9Lust1NgTh0zy2guxPLg4qMM3Dz 3NhYPVn+nvGvQEM8FIZltQM4Zn2FDABfoyIyYZo8IgGfD40tz8H+7kuYPsg0fpUPiEcS pl9fKTvWENxpmSky12HSQw+RAUgMNJL2KziJXKYFA2uryD1eFulTEBbM1beP6G16lgKs oZqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=N2nxlAPwxCY787lzi2fWINFuw6kMiTtSA+BaIRlVVdE=; b=BVEh3RumUvlTiufI7w4fMwyTjjZjJ+dv6q9a7OiHazpd657I71LDicf6d5pQjbWO2V 1C6VcQOQa9e/Jj8yjn+PWKB3UhIOXX9isaaLTKD3ritcywmD+wp/aImffqxvBF0pA40V b0l61L2mzBrUAHnbNQJJm8a9XlMijAOmfpzadXfgb4MV7efesdamaVA8L318PyC7zvBu c+tvD/yMrwvxmdHCQS+S0gxZYUQMMLdWkwqf8JbKHob/nDElrdXDSnUFeuLnA28DSqMq 56xRJhb8RO9risk1KvKhs3BlcjXvyzU3KRXbe9ZhgXaSDEwFhb0SHL0w0NS11lN6newy 5aww== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=nW7bx6+F; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f34-v6si7745615ple.365.2018.09.07.02.42.20; Fri, 07 Sep 2018 02:43:06 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=nW7bx6+F; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728038AbeIGM6E (ORCPT + 99 others); Fri, 7 Sep 2018 08:58:04 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:42145 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727847AbeIGM6E (ORCPT ); Fri, 7 Sep 2018 08:58:04 -0400 Received: by mail-ed1-f66.google.com with SMTP id l5so10912020edw.9 for ; Fri, 07 Sep 2018 01:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=N2nxlAPwxCY787lzi2fWINFuw6kMiTtSA+BaIRlVVdE=; b=nW7bx6+FX6MuobpiNK93j+S9ZGNeI/hBMyS89GouGnTHZ7V6MLuc1NYVZCUbzCgLQL FPj8IVCweZKFQ2RKmwmJbjiJN+NFIMW2XnRhdA+cUiga/ACETl/uOTX9Sikbimst8Yag i6peVuJkiNNKfLHw7OXUEDBlvi67+FNDOd8kOnhfpsnJI2ldc3+r9r7PLqZduf7qICuG U8CkMf2iiS8nmk3h0w/dtw+s0bIqSTNBWxrMXrzkTsjTB3oX3B3UFzUO7hbx0+CFQ2w3 SyOnu1UyAclJIbPJxe8fcDiPa6AYnDffKB3Od+l/ED3OGnuvj4T65FfgdmIT+L4F/b+C s8qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=N2nxlAPwxCY787lzi2fWINFuw6kMiTtSA+BaIRlVVdE=; b=gfPaJOPDDBcvvBAVK8X+ywCVahMNzkvnmnqZn5Gm1HqqPcGWImlsKnE/IWhHiL8aAG 6mwIocwu/t8irjmApa2xX0uazXi29aPVhQiruUC+/kd474lyhkuoc1nv2y/7R77gkkdJ kIYyRfABLsjfuU5HllRi7kPzemx3DeAbbeW+MlhmzqS0SFjOEucu3CTKiVxjN9YWFmg5 yZji5KTcJq2xIGel6G6VUawMzMjsUPRVsipjAiJE1qkasg11gt71uRS5R3/84RSah6Lv NsJkq3nSdku0m1ziy915AUC3E4oh1fOMaXFCxjZfRJRqeLauFeCfhji7lk0zh9ieSLLD 0ptw== X-Gm-Message-State: APzg51BfOHGdhFemdgZO4JsIp6t8m3SRxHNBQqud5vY3cC4HWpaBZG6d niu2pV6j1rkmKTL+Kc0/nhY= X-Received: by 2002:a50:a9a4:: with SMTP id n33-v6mr7741856edc.208.1536308294592; Fri, 07 Sep 2018 01:18:14 -0700 (PDT) Received: from dell.be.48ers.dk (d51A5BC31.access.telenet.be. [81.165.188.49]) by smtp.gmail.com with ESMTPSA id w20-v6sm9301172edc.12.2018.09.07.01.18.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Sep 2018 01:18:13 -0700 (PDT) Received: from peko by dell.be.48ers.dk with local (Exim 4.89) (envelope-from ) id 1fyBy0-0005dO-VV; Fri, 07 Sep 2018 10:18:12 +0200 From: Peter Korsgaard To: Arnd Bergmann , Greg Kroah-Hartman , Joe Perches , linux-kernel@vger.kernel.org Cc: Peter Korsgaard Subject: [PATCH v2] ttyprintk: make the printk log level configurable Date: Fri, 7 Sep 2018 10:18:10 +0200 Message-Id: <20180907081810.21615-1-peter@korsgaard.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For some use cases it is handy to use a different printk log level than the default (info) for the messages written to ttyprintk, so add a Kconfig option similar to what we have for default console loglevel. Signed-off-by: Peter Korsgaard --- Changes since v1: - Leave [U] prefix in printk invocation and drop space before it as suggested by Joe Perces. drivers/char/Kconfig | 8 ++++++++ drivers/char/ttyprintk.c | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index ce277ee0a28a..14a7f023f20b 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -66,6 +66,14 @@ config TTY_PRINTK If unsure, say N. +config TTY_PRINTK_LEVEL + depends on TTY_PRINTK + int "ttyprintk log level (1-7)" + range 1 7 + default "6" + help + Printk log level to use for ttyprintk messages. + config PRINTER tristate "Parallel printer support" depends on PARPORT diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c index 67549ce88cc9..88808dbba486 100644 --- a/drivers/char/ttyprintk.c +++ b/drivers/char/ttyprintk.c @@ -37,6 +37,8 @@ static struct ttyprintk_port tpk_port; */ #define TPK_STR_SIZE 508 /* should be bigger then max expected line length */ #define TPK_MAX_ROOM 4096 /* we could assume 4K for instance */ +#define TPK_PREFIX KERN_SOH __stringify(CONFIG_TTY_PRINTK_LEVEL) + static int tpk_curr; static char tpk_buffer[TPK_STR_SIZE + 4]; @@ -45,7 +47,7 @@ static void tpk_flush(void) { if (tpk_curr > 0) { tpk_buffer[tpk_curr] = '\0'; - pr_info("[U] %s\n", tpk_buffer); + printk(TPK_PREFIX "[U] %s\n", tpk_buffer); tpk_curr = 0; } } -- 2.11.0