From nobody Thu Jun 06 20:42:59 2024 X-Original-To: dev-commits-src-main@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 4VwGVs0yvMz5MxVj; Thu, 06 Jun 2024 20:43:01 +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 4VwGVr13fmz4qX9; Thu, 6 Jun 2024 20:43:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717706580; 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=3g1bAkUX10pbIDbSWLCdW9USqP5J4iXPWgzgvkcl9uQ=; b=mLSw/MH2Nj2R4IsVCRBcjFctaGoJb+1qbW5ow7nQp+VXtJjDivY8/oPIanW8G/+6BqpJNP gp2wNQuwCXGIfGYD68gXNQsb5P3ueBZT8p+L4r9nOCrqAiXbs362v0kH8IUF/fPntJFRCM lc6dsk1bDr4imA+H/JzOgzwPCjQrfOL4Tt3oQAbSOEfII+OSafCJ5RSdVgNUt+TTqA0477 20EXft6OCuWi3k4Ty1o9vvW7kgU+3R2r3vZk8WATRRW3hEeKoBxoERnFi6KUYSC3ARNP1I wz3nZLxXj9jKy0W9Vul9zlmTZ5SDU9nADDr/Ms94XKIuCzeJumLXlBeS2UqiPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706580; a=rsa-sha256; cv=none; b=i2BiJdPOM4TtcsM9NBFaLlseJOXTuAThGtLCT51qY/tBVeCe6Jat+vwO8g7fuYRg2uC0ps SJQDQuyj++YDnD+/KmV2uciSzT++nN7OztRbzH59WiWKnW/BX5N4vlucsUhsmwTSgZMSuj O9EQkGmO9ifz1iNWP902wwDdILUGaCWEAzeaWRkX2ncH0BRKXjOuc/01GWn7zZhR/vSXDK ZkrN37uNkbDTkZeBdJH1ndKHEBrFiMYr1sWn06EOw2aL7QnZcBzjejNX63HDeE+JSMMgc7 tQm5yCtox3zwQaY3ToLm9RWszbnGnqdAXQefQYOoLxpjAxpvUE5NKNiO1kTG4g== 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=1717706580; 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=3g1bAkUX10pbIDbSWLCdW9USqP5J4iXPWgzgvkcl9uQ=; b=mcUV/V6i0F/YSR6ih7hAdCBTxNfQNt30d8j4CKwVEZ3bXS+7itlaN+o7pTu/kW0r45zDoz aAYgFi1APMe9RPW7ew2WfveOqbFuXCDutPvRmUyBwn9kmrnE1YBiXteF3aTjbyHaPqW43W 8zNnWQMURworjwV7qGhThlLfmNyiAZVazCzaU9CJyv3f294jQLyhogeVDCTDI3cpw2eqGU gQ4g2wgz9zxlkNwS3aD95yC2LiFV2z4lcLzt+yJAVn42cl1rp4TVxoEhZPU15VfrOQSCQm oeO7Z6/x4xF0iFuhQgzKWXGc4qekTsq97li8dd2zDHnyxywW/AQD0nxvIUkqbQ== 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 4VwGVr0dJGz11fr; Thu, 6 Jun 2024 20:43:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456KgxZk046271; Thu, 6 Jun 2024 20:42:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456KgxxK046268; Thu, 6 Jun 2024 20:42:59 GMT (envelope-from git) Date: Thu, 6 Jun 2024 20:42:59 GMT Message-Id: <202406062042.456KgxxK046268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 07c7c41ca1e3 - main - LinuxKPI: Add min_not_zero() to linux/minmax.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 07c7c41ca1e31c20c2e2d8fb68c148f521831e4d Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=07c7c41ca1e31c20c2e2d8fb68c148f521831e4d commit 07c7c41ca1e31c20c2e2d8fb68c148f521831e4d Author: Vladimir Kondratyev AuthorDate: 2024-06-06 20:42:06 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-06-06 20:42:06 +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 --- 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;