Page MenuHomeFreeBSD

linuxkpi: Add refcount_dec_and_test
ClosedPublic

Authored by manu on Aug 10 2022, 6:46 AM.
Tags
None
Referenced Files
F132421190: D36099.diff
Thu, Oct 16, 7:18 PM
Unknown Object (File)
Thu, Sep 25, 7:05 PM
Unknown Object (File)
Sep 5 2025, 1:52 AM
Unknown Object (File)
Sep 1 2025, 4:09 PM
Unknown Object (File)
Aug 28 2025, 3:47 PM
Unknown Object (File)
Aug 14 2025, 10:38 PM
Unknown Object (File)
Aug 12 2025, 2:37 PM
Unknown Object (File)
Aug 12 2025, 5:46 AM

Details

Summary

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.

Sponsored by: Beckhoff Automation GmbH & Co. KG

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

manu requested review of this revision.Aug 10 2022, 6:46 AM
bz added inline comments.
sys/compat/linuxkpi/common/include/linux/refcount.h
85

This may be a silly question, but why don't we fix kref instead to use refcount (now that it exists thanks to you)? Then this shouldn't be a problem here.

sys/compat/linuxkpi/common/include/linux/refcount.h
85

TBH I haven't tested if this open a big can of worms or not ...

bz added inline comments.
sys/compat/linuxkpi/common/include/linux/refcount.h
85

I'll be happy to get this in and defer the answer to the worms for later maybe with an XXX should kref use refcount_t? next to it as well?

This revision is now accepted and ready to land.Aug 10 2022, 4:04 PM
sys/compat/linuxkpi/common/include/linux/refcount.h
85

Yeah I'll add something in linux/kref.h too.

This revision was automatically updated to reflect the committed changes.