Page MenuHomeFreeBSD

sound: Clean up midi/ includes
ClosedPublic

Authored by christos on Thu, Nov 20, 2:00 PM.
Tags
None
Referenced Files
F137245831: D53841.id166908.diff
Fri, Nov 21, 7:00 PM
F137243865: D53841.id166906.diff
Fri, Nov 21, 6:28 PM
F137240511: D53841.id166846.diff
Fri, Nov 21, 5:54 PM
F137240214: D53841.id166906.diff
Fri, Nov 21, 5:54 PM
F137240124: D53841.id.diff
Fri, Nov 21, 5:53 PM
F137240054: D53841.id166908.diff
Fri, Nov 21, 5:53 PM
F137240028: D53841.id166880.diff
Fri, Nov 21, 5:53 PM
F137239293: D53841.diff
Fri, Nov 21, 5:48 PM
Subscribers
None

Details

Summary

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68764
Build 65647: arc lint + arc unit

Event Timeline

christos created this revision.
sys/dev/sound/midi/midi.c
35

style(9) calls for sys/types.h first

Kernel include files (sys/*.h) come first.  If either <sys/types.h> or
<sys/param.h> is needed, include it before other include files.
(<sys/param.h> includes <sys/types.h>; do not include both.) Next,
include <sys/systm.h>, if needed.  The remaining kernel headers should be
sorted alphabetically.
sys/dev/sound/midi/midi.h
32

Do we not want this for uint8_t?

christos marked 2 inline comments as done.
  • Bring back sys/types.h in midi.h.
  • Do not include sys/types.h where sys/param.h is included.
  • Sort includes alphabetically after sys/param.h and sys/systm.h.
sys/dev/sound/midi/midi.h
32

Compiler didn't complain, but I'll include it to be safe.

sys/dev/sound/midi/midi.c
38

See mutex.9: mutex.h requires lock.h to be included first. Otherwise you're relying on some other header implicitly bringing it in for you, which is fragile and sometimes breaks.

Per what I wrote above, someday we should ensure that mutex.h is self-contained, but in the meantime we should follow the documented include protocol.

sys/dev/sound/midi/midi.h
32

"The compiler doesn't complain" isn't a good test in general. You're basically requiring that every file which includes midi.h also include types.h first. In the past few years we've been trying to move away from that kind of thing, at least for userspace headers. That is, headers should be self-contained when possible. This is less important for kernel-only headers such as this one, but still there's no reason to remove the types.h include.

sys/dev/sound/midi/midi.c
38

Yeah, I brought it back earlier, but didn't update the diff. It did cause a compilation error at some point.

This revision was not accepted when it landed; it landed in state Needs Review.Fri, Nov 21, 4:15 PM
This revision was automatically updated to reflect the committed changes.