Re: [PATCH] hrtimer: add usage examples to documentation

From: Daniel Almeida
Date: Thu Dec 18 2025 - 03:42:54 EST




> On 18 Dec 2025, at 05:36, Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>
> "Daniel Almeida" <daniel.almeida@xxxxxxxxxxxxx> writes:
>
> <cut>
>
>>>
>>>
>>
>> FWIW:
>>
>> [10:52:46] [PASSED] rust_doctest_kernel_time_hrtimer_rs_0
>> [10:52:46] [PASSED] rust_doctest_kernel_time_hrtimer_rs_1
>> [10:52:46] [PASSED] rust_doctest_kernel_time_hrtimer_rs_2
>> [10:52:46] [PASSED] rust_doctest_kernel_time_hrtimer_rs_3
>>
>> This looks good to me. The rendering looks ok as well.
>>
>> With the nits addressed:
>>
>> Tested-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
>> Reviewed-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
>
> Thanks for calling out the sloppy error handling, will fix.
>
> I don't understand what you mean about blanks?


e.g.:


> +//!
> +//! fn run(
> +//! this: ArcBorrow<'_, Self>,
> +//! _ctx: HrTimerCallbackContext<'_, Self>,
> +//! ) -> HrTimerRestart {
> +//! pr_info!("Timer called\n");
> +//! let flag = this.flag.fetch_add(1, ordering::Full);
> +//! this.cond.complete_all();
> +//! if flag == 4 {
> +//! HrTimerRestart::NoRestart
> +//! } else {
> +//! HrTimerRestart::Restart
> +//! }
> +//! }

There are zero blank lines here and elsewhere. Makes the code harder
to read. I am simply suggesting:


> +//!
> +//! fn run(
> +//! this: ArcBorrow<'_, Self>,
> +//! _ctx: HrTimerCallbackContext<'_, Self>,
> +//! ) -> HrTimerRestart {
> +//! pr_info!("Timer called\n");

<blank line>

> +//! let flag = this.flag.fetch_add(1, ordering::Full);
> +//! this.cond.complete_all();

<blank line>

> +//! if flag == 4 {
> +//! HrTimerRestart::NoRestart
> +//! } else {
> +//! HrTimerRestart::Restart
> +//! }
> +//! }

— Daniel