Re: [PATCH] hrtimer: add usage examples to documentation
From: Andreas Hindborg
Date: Thu Dec 18 2025 - 04:38:26 EST
"Daniel Almeida" <daniel.almeida@xxxxxxxxxxxxx> writes:
>> 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
>> +//! }
>> +//! }
Ah, thanks for explaining. I was looking around for blank lines that was
maybe not supposed to be there.
I can sprinkle blank lines around, no problem 👍
Best regards,
Andreas Hindborg