Re: [PATCH v3] hrtimer: add usage examples to documentation
From: Andreas Hindborg
Date: Mon Feb 23 2026 - 12:22:44 EST
"Miguel Ojeda" <miguel.ojeda.sandonis@xxxxxxxxx> writes:
> On Mon, Feb 23, 2026 at 4:29 PM Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>>
>> So, after copying these use statements elsewhere to format them, I was
>> rereading your message and I see that what you actually write is that
>> maybe we should be using the vertical style for imports in examples.
>>
>> The examples would be nothing but a wall of use statements. Do we
>> really want that? I know it is the style we picked for the kernel in
>> general, but I don't think it should necessarily apply to the examples.
>
> That is why I asked if we could perhaps merge two pairs of examples :)
> i.e. to reduce the "duplicated" boilerplate from the imports, and
> perhaps a couple of the items/types that are the same too.
>
> Either that, or you may want to hide them (but I am considering that
> we may want to just never hide them (or always doing so) and thus
> avoid the discussions that keep coming up on that).
>
> As for using a different style for examples, I can see we could save a
> few lines per example, but we would have to remember a different
> convention and we would increase the risk of conflicts there (though I
> reckon there may be not many conflicts there unlike the module
> imports).
I think I'll await broader consensus before shipping another version of
this patch. My 2c is that the imports take away form the actual example
code. I'd rather not have them.
If we are going to keep the imports visible in the examples, I would
prefer to fold the imports, so they take less space. I realize this is
not consistent with the general style we adopted, but I don't think that
is important. These are just examples to help understand an API. They
are not going to be subject of merge conflicts at a regular basis.
If we hide the imports, we might as well go for consistency with the
style we adopted.
Best regards,
Andreas Hindborg