From nobody Mon Mar 20 20:47:45 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRdF3XbNz40DmW; Mon, 20 Mar 2023 20:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PgRdF377Bz3kKr; Mon, 20 Mar 2023 20:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PWyGIAU6W76OmUtCHQ4vAAGUV79WvGC5nsmQa3JP/jU=; b=BtBnqgvtqKAnipNItuBqdRE/gxCsdVghMelpF9R3OzMN2sUbJznSMX7l6MvEJHmRSrGb2M nGsd6fh6KZNRdNObinDg5Pqiia3OinwTrWW47g4+rFuzqP4m+gO3muHXDSgxzXMkdtlhMN EVQDNtLaK9b5iVfmWfOGbmrL9GAuR5dVPRLS/MYWw0loWazenWZO7gGGU5ewt2/mlpjCkJ W9DfBFcL0X6pJqS7OlnBpYz4PhABYs10clFAr9rKAslDswSbNxQX5evDy0MQ2Vm8nhyhls FGG5MjBCqtWZc8+t6gafb8hvcD6gY8u8NvK/5U8vzOlXbA4sqR4XxK3q/Q2KYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679345265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PWyGIAU6W76OmUtCHQ4vAAGUV79WvGC5nsmQa3JP/jU=; b=u/IfvEurC31/m0m25omZE5gOVMabZvmMDRo7G5aJFoX4ZfXbbyE5kAyBXNZZL43vbFhdRP 7dyiUj5t42xscpxNyGxuvBxcwPSTVIsn5j37/v8rSQH9tAbH5+FxraNeekwgc1bt1FhuXS SbvYi0tp5ZpIr+bzlnhmM3Nr94jas+RazHO1d3bzIbldyzYlpvx3bqG43YrvG6WwDqSbSy mLJSu6Ocdnzu0HbaofBmNsRjZEy+nlynUaPiFBAiGnlaVr0plWdTVq1YIrsia7w6V72Jkf AgWBgS2iFoi96i0PDV9PWGyJX0vF+4IBpbCbml0bLssY66twzaZeNn0QrkX95g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679345265; a=rsa-sha256; cv=none; b=NbypIvgh+ucDDiz1IHxEGTGp/254FNmcFLB7fKqSp0UMptrDIOJucKyGV6sCbOjvfKWd1C /bxeQmKFD40zNLqHIipSAmvrkah6GaTRKALmYis1dZ1W7f4gbBl/2WNTSxImF+j8ZyZKhl ti03bEez9fVWJBT0/rA6wIzsDR9qZlxp4fJSLY20wlzGlt0wkbe4BpLF2zylUglRLMJjiR tGeg0+IApLtObOiHV5AodSyvQ1AHmcS58cZ943BZPsv8vD57svKoLaxD1+sAJvmJ4yXJYo laFEL+7shggF5kRWBFr0QIC94tZWdpzfhEsTcGJqiNFDRHTpih7eeTzkt2cdBg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRdF247rzlCS; Mon, 20 Mar 2023 20:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32KKljVH083188; Mon, 20 Mar 2023 20:47:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKljre083187; Mon, 20 Mar 2023 20:47:45 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:47:45 GMT Message-Id: <202303202047.32KKljre083187@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: 0777b000f111 - main - linuxkpi: Define `dev_WARN()` and `dev_WARN_ONCE()` List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0777b000f1118af4abd7adf18bcff358fe8afd5e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=0777b000f1118af4abd7adf18bcff358fe8afd5e commit 0777b000f1118af4abd7adf18bcff358fe8afd5e Author: Jean-Sébastien Pédron AuthorDate: 2023-02-20 20:42:22 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-03-20 20:47:28 +0000 linuxkpi: Define `dev_WARN()` and `dev_WARN_ONCE()` Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39049 --- sys/compat/linuxkpi/common/include/linux/device.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 18f2eef895c0..09a61bdd0a64 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -199,6 +199,20 @@ show_class_attr_string(struct class *class, #define dev_printk(lvl, dev, fmt, ...) \ device_printf((dev)->bsddev, fmt, ##__VA_ARGS__) +#define dev_WARN(dev, fmt, ...) \ + device_printf((dev)->bsddev, "%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__) + +#define dev_WARN_ONCE(dev, condition, fmt, ...) do { \ + static bool __dev_WARN_ONCE; \ + bool __ret_warn_on = (condition); \ + if (unlikely(__ret_warn_on)) { \ + if (!__dev_WARN_ONCE) { \ + __dev_WARN_ONCE = true; \ + device_printf((dev)->bsddev, "%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__); \ + } \ + } \ +} while (0) + #define dev_info_once(dev, ...) do { \ static bool __dev_info_once; \ if (!__dev_info_once) { \