From nobody Thu Aug 01 22:27:40 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 4WZk9m5346z5RZZG; Thu, 01 Aug 2024 22:27:40 +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 4WZk9m2b0jz4YqQ; Thu, 1 Aug 2024 22:27:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722551260; 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=lAs+1KA2ZCtPSapRx8IFYZz8NnnpbcnJ7Err2Toh9Y0=; b=Kpu873zImBlRIZ2HbbjqSIOBntLXNiLXvqvLJr09MUETi2Io+P9FSbjKCjYUmE0Kf/1yyy xFnJGRSXowSIuC79u10xvk2tdhGRap8CcCX5mbz63B+6DLpLjDLIYVkTHtvLeGAvqVytAo rZWPrD87qUkI70joKILkRNUAuy21X8DRlbOH3Bpi+SZneNZj1hHSw4Ox/upY9JGwAO8JJf APKTMzVwJenasQHG067f5g3nRjGT7V4pBzUbnbwKYlvi4JPh76XhML9A/MV14bsJO+ltJB zLK7L1ZoBKFVofqE30dCTBNS7kTaRc40NdWSKu6ZpXVSxVd7uVmC7OVWZE/6EQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722551260; a=rsa-sha256; cv=none; b=SaOPKcHFYSs/5YxpyMD3qQ1bTzecxP12E0XhWU5kHF/U1+MoQItbnPWFKmRJpDhXHjz4LM rBURvVPtNxyHYzqnDENCBrEPMUYFMeGq5sVqIFgHuw6XuJz6eM4hc9eMuLG5EhEdpiOYjC EKMynVweomVJuz35+uhrlbBrUW4bh17Wrtz8TljOpA6FyFyCjE2LuArD2/7I6p0f0vGf9d wW893bXTlRJC6F0lcZ+fkAR8PcBqDu04TIbfkg7sLmciZ0xHWNx7fAiiL0LytvSIEhBog0 J3/foUOyBeFksN+bBfcoWAXi3XdNQffp4gW1ASl6pt+vcRHEvR8hf46lU+iKBQ== 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=1722551260; 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=lAs+1KA2ZCtPSapRx8IFYZz8NnnpbcnJ7Err2Toh9Y0=; b=W4NEpomofXgNGR6NMbFMCNf1bA8ctjs4FvsVA7vVry5SpZJvS6ULClLbttTFJ+va1RCWun wX8oP9ZP7jrzndXUx7L4n/Fxp4zGdgLEUWlSH0mAN618RnW4bMKgMMKcCueNAjW3Bb2vId FE0ofDbTrrTevc9JTtS2MPEwYWqoMw3RIMs22rptqqkwzHBuGn43mWQSTIgjxJ7QFOGp8n 64e+8BFsDf2m0RBChkGyTIJgsq0ygLqfr3yUBozAfzf+OjtMNotKWeAG5dXdr7H1WWtvFL hVNCKoKQBYFziqlhJfei5FTTKdXyoHR4ZcP9bW+X4keUAl7OHhhCmlECFAwb+A== 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 4WZk9m2BXzz12Jl; Thu, 1 Aug 2024 22:27:40 +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 471MReXE027634; Thu, 1 Aug 2024 22:27:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 471MRe2x027631; Thu, 1 Aug 2024 22:27:40 GMT (envelope-from git) Date: Thu, 1 Aug 2024 22:27:40 GMT Message-Id: <202408012227.471MRe2x027631@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: 42aeb3866cea - stable/14 - LinuxKPI: Add abs_diff to linux/math.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: 42aeb3866cea6b00c00de0f5f0ecb09c863ee18f Auto-Submitted: auto-generated The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=42aeb3866cea6b00c00de0f5f0ecb09c863ee18f commit 42aeb3866cea6b00c00de0f5f0ecb09c863ee18f Author: Vladimir Kondratyev AuthorDate: 2024-06-06 20:42:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-08-01 21:09:40 +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 (cherry picked from commit afc450fac9f04f11cd916916ac28ffc52a973e1e) --- 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) {