Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2062910pxb; Sat, 23 Jan 2021 15:41:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyymsqv1KqP3zdBLV+m5DPBRrgCLlcN3CmmjIUln6VAwtxs/m1dt8rocpUS0QbuqPBZ6pvw X-Received: by 2002:a05:6402:d1:: with SMTP id i17mr356168edu.85.1611445268686; Sat, 23 Jan 2021 15:41:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611445268; cv=none; d=google.com; s=arc-20160816; b=kcM5DoAF3Dc25sy9gkvkN4j8CHsak43BkWVPN2wh7BO8zxjpJiAqwMKvWGPvO8Tfnf jSNmPVKHsZP4xYB79fugCfihUvT4BbLxFVGKDd0/FyvjfzVX5FW+No83EiOHedGP3N4V oJjhFjopIoUvqF1tcFrxOB0Tf8wePotkHNpmdGJjvqsrZxutXLXrzXkdymR+8BOjRXei L9yuiuKP5ZhmmmXO5Ep9ZoIhzBWHJRsfhbK/t2ZCgFH9WFN2+jzKxltDJyXFBXafMnyx +2mfWMxR0Bomevk83osgrrfxwx8l12eixiWvlGoBaQpTfFZavnQ0EG7BJPTE3zICPnQv 8Rbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XWjFcE99pbuOQ+hBOKIGZV7Gw2pBP8y68332GRqUgWY=; b=0X1VtF8bW0TLTfFsc2zTc8bp2PoiyjWP9CBm3lomNVmImKeMa8yZe1uJMhDMVeKcf6 M/2itM0mJ+xoKVT4U/PTeXKkHT5q41TcL66GjztWqoV1pVzGLDqGVt/ICRhXdZ7htiss 0InRdGjz+1jHWFwx88WYfbMnWpHGBOpfovvLUxKBxG9bY65oIXnoNUJ0vXqgC9n8M9jy ePYnOKRwQJu4tD2d/AOkdf2XNQ0jlqJF22Apm+N03y7MUDwveZHSOCAJxkxcvdUm4eDx 5lEnJmrVbTSymCEkAjOwrdflr2ds/rE3x3oplTqusXUWFI88YizTi7Dcf05ho2ZjsmdH 5jaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g1si4502864ejz.557.2021.01.23.15.40.45; Sat, 23 Jan 2021 15:41:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726458AbhAWXir (ORCPT + 99 others); Sat, 23 Jan 2021 18:38:47 -0500 Received: from foss.arm.com ([217.140.110.172]:34256 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbhAWXip (ORCPT ); Sat, 23 Jan 2021 18:38:45 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 75776152D; Sat, 23 Jan 2021 15:37:59 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.194.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4E9D03F719; Sat, 23 Jan 2021 15:37:58 -0800 (PST) From: Qais Yousef To: Petr Mladek , Sergey Senozhatsky , Thomas Gleixner Cc: Steven Rostedt , John Ogness , "Peter Zijlstra (Intel)" , linux-kernel@vger.kernel.org, Qais Yousef Subject: [PATCH 1/2] printk: Add new pr_*_deferred_once() variants Date: Sat, 23 Jan 2021 23:37:40 +0000 Message-Id: <20210123233741.3614408-2-qais.yousef@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123233741.3614408-1-qais.yousef@arm.com> References: <20210123233741.3614408-1-qais.yousef@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To allow users in code where printk is not allowed. Signed-off-by: Qais Yousef --- include/linux/printk.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/linux/printk.h b/include/linux/printk.h index fe7eb2351610..92c0978c7b44 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -480,21 +480,45 @@ extern int kptr_restrict; printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) /* no pr_cont_once, don't do that... */ +#define pr_emerg_deferred_once(fmt, ...) \ + printk_deferred_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) +#define pr_alert_deferred_once(fmt, ...) \ + printk_deferred_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) +#define pr_crit_deferred_once(fmt, ...) \ + printk_deferred_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) +#define pr_err_deferred_once(fmt, ...) \ + printk_deferred_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) +#define pr_warn_deferred_once(fmt, ...) \ + printk_deferred_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) +#define pr_notice_deferred_once(fmt, ...) \ + printk_deferred_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) +#define pr_info_deferred_once(fmt, ...) \ + printk_deferred_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) +/* no pr_cont_deferred_once, don't do that... */ + #if defined(DEBUG) #define pr_devel_once(fmt, ...) \ printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) +#define pr_devel_deferred_once(fmt, ...) \ + printk_deferred_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else #define pr_devel_once(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) +#define pr_devel_deferred_once(fmt, ...) \ + no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif /* If you are writing a driver, please use dev_dbg instead */ #if defined(DEBUG) #define pr_debug_once(fmt, ...) \ printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) +#define pr_debug_deferred_once(fmt, ...) \ + printk_deferred_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else #define pr_debug_once(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) +#define pr_debug_deferred_once(fmt, ...) \ + no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif /* -- 2.25.1