From nobody Thu Jun 6 20:43:02 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 4VwGVt4vkCz5Mxn7; Thu, 06 Jun 2024 20:43:02 +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 4VwGVt33j7z4qbq; Thu, 6 Jun 2024 20:43:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717706582; 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=v2d4XiOKwd1rZi7JCrda88ea9sT97MdXpZQshllGmAs=; b=l+r6YPzS8oFBqGc2FCiSENeJssbzfck0912e7/uODr/GQEI45Nyr5zUWOtPH2n/AE9v7Wj h8FlmPBbgfQHZrK8WAqjNrxidIes9LFiwL9MZct4dFDp5uB0+6T+jzss7bcglUJSbjRiCq neueEp3M5Qlzc/67m9TbZKVZcNdn6ZqkLYNf6/fEgQjhApdoejyF4o/cNDXuwBaL7RnNAc jC9B5GTtcqHUac1fMXFzJO4IaKw+UWuQK3mqS8q97FweRDi0DrG5jbknp8Ralu7O8+Zz4P TB1MD4ldff9By6Wd94OqZrAnDjVCcIQhjckbdBZMyqKE+maUJ0JaMUGV9urftA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706582; a=rsa-sha256; cv=none; b=SDOOZHKisEd6u60Q0NzBfdXVRm9M6DuwXiK3WA8tNuFDAfWMF0FXj5GAmlbH0rgWyJ6fRA 7x9Zqq7KTFpqoJJ9XoUVt6byolu9TrbkVhBEblTnTCRMa+tdQwPSMnHy2jLXQOWCrFjhIj hR7zTLUmBX4RwuJ49g15maa9KQYPep60wPfVuUqmtFh4x3n5j+pU0NKDHGmRB1Z7/FHDdB n4pjeRZ7oUeWszo0NvRxixPaviVHueDSOCd2ce6VnJt0CY1m70laCGChHYKEf+N6oaoXmA ZFSaoHN3ldyNjxpeUUZTVaaT5FEwETJzspsQzDC1OkaMVZsPqweY68sfVK49pg== 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=1717706582; 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=v2d4XiOKwd1rZi7JCrda88ea9sT97MdXpZQshllGmAs=; b=dYqWb6+pFqM4Yicdjjnnt0GRPLWTi+SBEQbldGKMDA3K8QFRLl4l3twyV9v1KmPjLrFCfN YrqaMUCkJnJBIna5IJRQiu3UoRpgov3PiTTdYQgXKQrpBoFTffqzMG7JPHvX8ZlJOfx9WU Xo5AJzovH4FD9dXjVUJbJ453Ec+cTe13P3npTmWM87OZBvODjBWlfeQ+tyQHimt/yTfDpP 0iHJjJWZcE2DIGc3e5++e5IJmUmii7bNF1FSKnozM7PdghfOlkIhB64pvXN+vy4WMveuxF 70/J6AcAfbQKvPXxk7DRc95NyAcQGiIet2dwj/jxG7XKgl2uz5SkWIMM4QM1sQ== 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 4VwGVt2h8Tz11wh; Thu, 6 Jun 2024 20:43:02 +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 456Kh2OQ046368; Thu, 6 Jun 2024 20:43:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Kh2HL046365; Thu, 6 Jun 2024 20:43:02 GMT (envelope-from git) Date: Thu, 6 Jun 2024 20:43:02 GMT Message-Id: <202406062043.456Kh2HL046365@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: afc450fac9f0 - main - LinuxKPI: Add abs_diff to linux/math.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: afc450fac9f04f11cd916916ac28ffc52a973e1e Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=afc450fac9f04f11cd916916ac28ffc52a973e1e commit afc450fac9f04f11cd916916ac28ffc52a973e1e Author: Vladimir Kondratyev AuthorDate: 2024-06-06 20:42:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-06-06 20:42:07 +0000 LinuxKPI: Add abs_diff to linux/math.h It returns absolute value of the difference between the arguments. Add LinuxKPI version check as the macro was moved from drm-kmod to linux/math.h in Linux kernel commit 46f12960aad (6.6 timeframe). Sponsored by: Serenity Cyber Security, LLC MFC after: 1 week Reviewed by: bz, emaste Differential Revision: https://reviews.freebsd.org/D45453 --- sys/compat/linuxkpi/common/include/linux/math.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/math.h b/sys/compat/linuxkpi/common/include/linux/math.h index fc4542c83f1f..dad7fa7fbe9c 100644 --- a/sys/compat/linuxkpi/common/include/linux/math.h +++ b/sys/compat/linuxkpi/common/include/linux/math.h @@ -5,6 +5,7 @@ * Copyright (c) 2014-2015 François Tigeot * Copyright (c) 2016 Matt Macy * Copyright (c) 2019 Johannes Lundberg + * 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 @@ -55,6 +56,14 @@ __ret; \ }) +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 60600 +#define abs_diff(x, y) ({ \ + __typeof(x) _x = (x); \ + __typeof(y) _y = (y); \ + _x > _y ? _x - _y : _y - _x; \ +}) +#endif + static inline uintmax_t mult_frac(uintmax_t x, uintmax_t multiplier, uintmax_t divisor) {