Date: Thu, 18 Aug 2022 09:10:03 GMT From: Emmanuel Vadot <manu@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 1a6874e3a411 - main - linuxkpi: Add refcount_dec_and_test Message-ID: <202208180910.27I9A3MZ016593@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=1a6874e3a411c7876bee55bc631119a2e1cd09a2 commit 1a6874e3a411c7876bee55bc631119a2e1cd09a2 Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2022-08-09 09:03:34 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2022-08-18 07:46:25 +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 --- 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 <asm/atomic.h> 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__ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202208180910.27I9A3MZ016593>