From nobody Thu Aug 01 22:27:37 2024 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 4WZk9k2cxfz5RZ7S; Thu, 01 Aug 2024 22:27:38 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WZk9k0d4qz4Ymq; Thu, 1 Aug 2024 22:27:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722551258; 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=7B0LaqHwCsD+KCB9Kv9SRKVoUDN8afvWNKQpFpQiuBw=; b=hU3nhEwVgtYGfJ6VvreNYrTGSwsc98VTlQcw0+IgLndxJceePZVontDthrJvb6Zcp8fQus lKmd89azlGkIvHX1DN/MK2S3bBPPIfTbwZaxYK8m0Ze3TYkDqtZtMCUJ9FX8HUjT3sZDc6 ULVPElqNh2gnt2fBuIMyM2wfs/CiiTKkEYX9ZO5tWYHGJvmLU3fRs55y7EkFEQwgqwaIpE Zxet7E3GorXL7VCj6KURdDRxk9kIPHQVVQbbZeMy6fYkIBwTSoZaArpl5lplhVGiXXb0EK ulktmruTBPqfqwRFZXEZbYbL4lVdXCWqHbmIhg/zuWMIeEtpUT8tzbQgVuH4tA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722551258; a=rsa-sha256; cv=none; b=KSzVfyTY3iXIOONyMBg0IEmXECOm7YByA6KeyJPHERi5XuiEMszqeCYFon3BT9Y1eSTPvd VFgA/fU30c952itv3cKgt1mFlHO04xW/EYZ+sdjv+WiW3KB2XLEnJK9Hdu2LaDWmXjnJOo FpfifSjkrtYi+aqCVg1cMOMTEkDYMhgF/LTADzb/tIKPJqaPOj1yWjxcU0K+dPalCvJLtN YMEHpAe7ll5jxfZd+UkBzvXSInVOp8uJp4jaLS4yT/+hCbVVcybx+WWvjW7VkeO2EKrC1Q DVEaDQ3cAjT9tCeUTmmcsleMcCkYn9P/jELAv/vgaXy8y9TVCOvljqgMfLiyKA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722551258; 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=7B0LaqHwCsD+KCB9Kv9SRKVoUDN8afvWNKQpFpQiuBw=; b=bjwGDB9rW1Y0G1o3clffZpCIsRyVhEAmTuxb/dvAzuHUw83XvfLUrq7KM61ysnwYZz67by Vu7UEVc8Y64x58RyTqqcL0eyo0D3zP7J6SwvNPv9bOVh6ElWzg+TpSDqF1fJFPuogO5wiL sWm2/8mKoS30pVAJMPh/yxq6yuia5p86j3WxMNVdiujMp22vze1WtxDALxVOpXWc3iFgeo ED8iWjpu0BEuuerjrNPOVLz2pCXPNtsmcgztUaDiWZ8QeF4WhFqkfy41R410pcwyx0Zjb8 WaLyAOiMtQEi2MZChm7v+PJM+p6XvidrlzdnyZzZgRfrwnnAgPpqFvWC84Qyjg== 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 4WZk9k0F8Nz12nn; Thu, 1 Aug 2024 22:27:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 471MRbuG027540; Thu, 1 Aug 2024 22:27:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 471MRbZV027537; Thu, 1 Aug 2024 22:27:37 GMT (envelope-from git) Date: Thu, 1 Aug 2024 22:27:37 GMT Message-Id: <202408012227.471MRbZV027537@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: ef2a82120fc1 - stable/14 - LinuxKPI: Add min_not_zero() to linux/minmax.h 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ef2a82120fc1a742236368d527bab8e864c40e60 Auto-Submitted: auto-generated The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=ef2a82120fc1a742236368d527bab8e864c40e60 commit ef2a82120fc1a742236368d527bab8e864c40e60 Author: Vladimir Kondratyev AuthorDate: 2024-06-06 20:42:06 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-08-01 21:09:39 +0000 LinuxKPI: Add min_not_zero() to linux/minmax.h It returns the minimum that is not zero, except both equals to zero. Sponsored by: Serenity Cyber Security, LLC MFC after: 1 week Reviewed by: bz, emaste, ssaxena Differential Revision: https://reviews.freebsd.org/D45450 Differential Revision: https://reviews.freebsd.org/D45451 (cherry picked from commit 07c7c41ca1e31c20c2e2d8fb68c148f521831e4d) --- sys/compat/linuxkpi/common/include/linux/minmax.h | 7 +++++++ sys/dev/bnxt/bnxt_re/bnxt_re.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/minmax.h b/sys/compat/linuxkpi/common/include/linux/minmax.h index 465607371b9b..d48958f0899f 100644 --- a/sys/compat/linuxkpi/common/include/linux/minmax.h +++ b/sys/compat/linuxkpi/common/include/linux/minmax.h @@ -7,6 +7,7 @@ * Copyright (c) 2014-2015 François Tigeot * Copyright (c) 2015 Hans Petter Selasky * Copyright (c) 2016 Matt Macy + * Copyright (c) 2023 Serenity Cyber Security, LLC. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -43,6 +44,12 @@ #define min3(a, b, c) min(a, min(b, c)) #define max3(a, b, c) max(a, max(b, c)) +#define min_not_zero(x, y) ({ \ + __typeof(x) __min1 = (x); \ + __typeof(y) __min2 = (y); \ + __min1 == 0 ? __min2 : ((__min2 == 0) ? __min1 : min(__min1, __min2));\ +}) + #define min_t(type, x, y) ({ \ type __min1 = (x); \ type __min2 = (y); \ diff --git a/sys/dev/bnxt/bnxt_re/bnxt_re.h b/sys/dev/bnxt/bnxt_re/bnxt_re.h index 3bf0bbeb1061..56b3c8c0488c 100644 --- a/sys/dev/bnxt/bnxt_re/bnxt_re.h +++ b/sys/dev/bnxt/bnxt_re/bnxt_re.h @@ -100,10 +100,12 @@ * @x: value1 * @y: value2 */ +#ifndef min_not_zero #define min_not_zero(x, y) ({ \ typeof(x) __x = (x); \ typeof(y) __y = (y); \ __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); }) +#endif struct ib_mr_init_attr { int max_reg_descriptors;