in_circular_range(9)
π« in_circular_range π«
okay bestie, gather round, because today we're looking at a little kernel helper called in_circular_range β it's a helper function to check if a value is within the range of two numbers (circular range) β¨ and honestly? it's giving "tiny function, big responsibility." this one lives in the Kernel API Manual (section 9, for all my fellow kernel-girlies π) and she's here to do exactly one thing and do it well.
β¨ SYNOPSIS β¨
bool in_circular_range (uint32_t start , uint32_t end , uint32_t value
);
yes ma'am, that's the whole signature π
three uint32_t args in, one bool out. simple. iconic. no cap.
πΈ ARGUMENTS πΈ
ngl the original docs were a little shy here, so let me give you exactly what they give us β nothing more, nothing less, fr fr:
startβ -- undescribed -- πendβ -- undescribed -- πvalueβ -- undescribed -- π
not me pointing out that all three are literally marked -- undescribed -- π the manpage said "figure it out babes." iykyk.
π¦ RETURN π¦
she returns True if value is within the range of [start, end], where start and end can be a circular range (i.e., start > end) π₯ β that's the whole plot twist, bestie, the range wraps around!
and then, no joke, the original page hits you with this legendary line of asterisks, which we are preserving in all its chaotic glory:
***********************************************************************************************************
main character energy honestly. π
π SEE ALSO π
π§ Kernel file
lowkey the actual source file path is a whole journey:
./drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/alternate_pstate_shared_lib.c
she's long, she's specific, she's that girl. π
π Related functions, aka the whole friend group
these are the siblings/cousins/group-chat members you should also go read:
apply_svp1_workaround(9)calculate_start_line_and_height_from_swath(9)get_swath_deadlines(9)calculate_swath_deadline_dst(9)is_dst_in_next_frame(9)is_end_swath_in_next_frame(9)is_svp_dst_in_next_frame(9)calculate_swath_idx_from_dst(9)populate_svp_params(9)populate_start_index_num_swaths_helper(9)calculate_start_index_num_swaths(9)calculate_hubp_start_end_lines(9)get_prefetch_end_line(9)get_effective_vblank_start(9)
like, the entire swath-lore extended universe π«Ά go read them, they're obsessed with you too.
aaaand that's the page, bestie! π this lil cutie comes to you from the source file ./drivers/gpu/drm/amd/display/... (yes, the ... is doing a lot of heavy lifting there π
) and she's dated October 2026, all wrapped up under in_circular_range(9). slay, no notes, periodt. πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms