From owner-svn-src-all@freebsd.org Sun Feb 25 10:26:45 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33E65F26FE1; Sun, 25 Feb 2018 10:26:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CEC897564D; Sun, 25 Feb 2018 10:26:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C83313B23; Sun, 25 Feb 2018 10:26:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1PAQiQE013102; Sun, 25 Feb 2018 10:26:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1PAQiOt013101; Sun, 25 Feb 2018 10:26:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201802251026.w1PAQiOt013101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 25 Feb 2018 10:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329962 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 329962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Feb 2018 10:26:45 -0000 Author: hselasky Date: Sun Feb 25 10:26:44 2018 New Revision: 329962 URL: https://svnweb.freebsd.org/changeset/base/329962 Log: MFC r329470: Add support for printk_ratelimit() function macro and improve the existing printk_ratelimited() function macro to return a boolean stating if there was a printout, true, or not, false. Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/printk.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/printk.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/printk.h Sun Feb 25 10:25:47 2018 (r329961) +++ stable/11/sys/compat/linuxkpi/common/include/linux/printk.h Sun Feb 25 10:26:44 2018 (r329962) @@ -106,10 +106,16 @@ print_hex_dump_bytes(const char *prefix_str, const int print_hex_dump(NULL, prefix_str, prefix_type, 16, 1, buf, len, 0); } -#define printk_ratelimited(...) do { \ +#define printk_ratelimit() ({ \ static linux_ratelimit_t __ratelimited; \ - if (linux_ratelimited(&__ratelimited)) \ + linux_ratelimited(&__ratelimited); \ +}) + +#define printk_ratelimited(...) ({ \ + bool __retval = printk_ratelimit(); \ + if (__retval) \ printk(__VA_ARGS__); \ -} while (0) + __retval; \ +}) #endif /* _LINUX_PRINTK_H_ */