Page MenuHomeFreeBSD

LinuxKPI: A bitfield.h implementation.
ClosedPublic

Authored by bz on Oct 7 2020, 6:05 PM.

Details

Summary

This implementation was iteratively produced during the work
on various WiFi drivers from individual functions to macro-created
implementations for the various bit sized needed (and then extended
to more for comepleteness). Some of the bit combinations do not
seem to make sense so are left out.

The __bf_shf(x) was obtained from D26681 [1].

Requested by:  manu [1]
Sponsored by:  The FreeBSD Foundation

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

bz requested review of this revision.Oct 7 2020, 6:05 PM
sys/compat/linuxkpi/common/include/linux/pci.h
32 ↗(On Diff #77982)

Please ignore the pci.h changes; arc diff to the wrong branch. Sorry.

sys/compat/linuxkpi/common/include/linux/bitfield.h
40 ↗(On Diff #77982)

This returns the least significant bit. Should the function be called f_lsb() ?

sys/compat/linuxkpi/common/include/linux/bitfield.h
40 ↗(On Diff #77982)

I am all for better naming;
I think (it's been a few months) they originated from how the results were used (as a mask or as a multiplier and then also divisor).

  • Rename f_mul to ___lsb as suggested by hselasky.
bz marked an inline comment as done.Oct 7 2020, 8:43 PM
This revision is now accepted and ready to land.Oct 7 2020, 8:49 PM

manu, if you are okay with it, either commit it yourself or let me know when so that you can deal with the drm-kmod bits as well

In D26708#595281, @bz wrote:

manu, if you are okay with it, either commit it yourself or let me know when so that you can deal with the drm-kmod bits as well

Haven't tested but should be ok for drm-kmod on current as we have this files and we include from the gplv2 directory before.

This revision was automatically updated to reflect the committed changes.