From nobody Wed Sep 07 15:10:25 2022 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 4MN5KY50fXz4bPRj; Wed, 7 Sep 2022 15:10:25 +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 4MN5KY4Flfz3ZCC; Wed, 7 Sep 2022 15:10:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662563425; 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=5eCQGeAQ4Y9Pr7CpSAbN5TdcZpshwWa2CT5Olp6dons=; b=JVoFk9NByqFwBB5rF6ExO4ksmz0svWQbiBmjGQ8+wX9gk6vdH6IfbMg5ycjgtw6PnIdHTn oB+3BG742l3GwAlx5XkS5dI0eR3EHOTH7D99t3fnXRPljrHuYOi9fwoSEotyobzwq4rIwY P4FXhETwhePf9GfikIonXmln4yddukvws3921I0ssKrb4nYaYh3ZKz1a8kPid4aMWHIwAA ByWm1R45WdAKd2fl1uf+IztxHljvOxxRhFTdcXaz1/3n76NrQ6WGjMEsAxdvyCGNV8Pj3N AiRcmttEgpCt9eg5EInsEcLzpsFEQn7qtl7IH+FQyJUnSnuoGkvZYSp/Ji0Kcw== 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 4MN5KY38grzYxK; Wed, 7 Sep 2022 15:10:25 +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 287FAPcv026238; Wed, 7 Sep 2022 15:10:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 287FAPiU026237; Wed, 7 Sep 2022 15:10:25 GMT (envelope-from git) Date: Wed, 7 Sep 2022 15:10:25 GMT Message-Id: <202209071510.287FAPiU026237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 37e07609505e - stable/13 - linuxkpi: Add refcount_dec_and_test 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: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 37e07609505e869831753bc7b25976c09bc3b52a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662563425; 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=5eCQGeAQ4Y9Pr7CpSAbN5TdcZpshwWa2CT5Olp6dons=; b=H74R5V+10BZIQv1rhCEHjgHCi3AKrqYGD12sfiveNHIIcp/lkA0hKxZCufYrNGAYh8d5SI h9dKWT9prCelTCnsCWUOVweFm7G1r9cIYMOXzeW4wjuxvQpfKn9KD3yHvt9SrpsAUDqNFI ttrAFz5bo8Y83ZBKVU2LYtxHp9Rqksma0jlSMfcteC0PxWU3p8quUMFdxkC91v1d/+liu9 j/o8Y2cyGD0c/m8HGoH7dII6XnAy5XLQkdFzbhjurbaQcdVnx/jBLcPTA+N9xLBWwJ5Wu8 Xr5VpFf/xr7A7+4ysfTXy4VJxYhvVrdrWfQxS/J/+GPQNNw3ZeRG3YBhbKT7kQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662563425; a=rsa-sha256; cv=none; b=WS75CwGBwGonxeaXFNN/I+5SqEIXyQw1Ums+L11PYLty9kMa+3F69NGD9JJNbq/5G73Yl5 N7wbhGW3N4QyvGmZ2bUVO+UXz6YkQQD1yGHHFH9ZNqTlPKAxkm+SfTn/5n9HvcsKjJSftU HDMhj2sZaC8bWV3pNQboPUp5ZmHnzO/+bx2NweaoiW2Mrm5nPc1XimwPMEqymBd3hNbgIJ yRt31J5d3avp8l86mHwtGwjGEIT8NbKifvyUyMZ1JaG5fAfcd15+h2F5QPEHqyY63Sg4jo NE6Hxruynqgg0sDzgU2UE5+Z0YbXlGyYC9ZW9fE13HXPCX4YflUwWwt30rMOkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=37e07609505e869831753bc7b25976c09bc3b52a commit 37e07609505e869831753bc7b25976c09bc3b52a Author: Emmanuel Vadot AuthorDate: 2022-08-09 09:03:34 +0000 Commit: Emmanuel Vadot CommitDate: 2022-09-07 15:09:05 +0000 linuxkpi: Add refcount_dec_and_test In Linux this takes a refcount_t argument but in linuxkpi struct kref uses an atomic_t for the refcount and code in drm directly uses this function with a kref so use an atomic_t here. Reviewed by: bz Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36099 (cherry picked from commit 1a6874e3a411c7876bee55bc631119a2e1cd09a2) --- sys/compat/linuxkpi/common/include/linux/kref.h | 1 + sys/compat/linuxkpi/common/include/linux/refcount.h | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/kref.h b/sys/compat/linuxkpi/common/include/linux/kref.h index 2c59794f4ddc..3b5645bf139b 100644 --- a/sys/compat/linuxkpi/common/include/linux/kref.h +++ b/sys/compat/linuxkpi/common/include/linux/kref.h @@ -43,6 +43,7 @@ #include struct kref { + /* XXX In Linux this is a refcount_t */ atomic_t refcount; }; diff --git a/sys/compat/linuxkpi/common/include/linux/refcount.h b/sys/compat/linuxkpi/common/include/linux/refcount.h index 7c055fb32029..6a49da530c0a 100644 --- a/sys/compat/linuxkpi/common/include/linux/refcount.h +++ b/sys/compat/linuxkpi/common/include/linux/refcount.h @@ -79,4 +79,15 @@ refcount_dec_and_lock_irqsave(refcount_t *ref, spinlock_t *lock, return (false); } +/* + * struct kref uses atomic_t and not refcount_t so + * we differ from Linux here. + */ +static inline bool +refcount_dec_and_test(atomic_t *r) +{ + + return (atomic_dec_and_test(r)); +} + #endif /* __LINUXKPI_LINUX_REFCOUNT_H__ */