Re: [PATCH v2] samples: rust_dma: add missing newline in dev_info! call

From: Gary Guo

Date: Wed Nov 25 2026 - 11:39:58 EST


On Tue Nov 24, 2026 at 4:14 PM GMT, Daniel Almeida wrote:
>
>
>> On 24 Nov 2026, at 11:31, Gary Guo <gary@xxxxxxxxxxx> wrote:
>>
>> On Mon Nov 23, 2026 at 11:06 PM GMT, Ivan Borovyk wrote:
>>> The dev_info! call in PinnedDrop::drop() lacks a trailing newline in its
>>> format string, unlike the other dev_info!() calls in the file. End the
>>> format string with '\n' for consistency with the dev_*!() and pr_*!()
>>> macro conventions.
>>>
>>> Fixes: 5444799d701c ("samples: rust: dma: add sample code for SGTable")
>>> Suggested-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
>>> Link: https://github.com/Rust-for-Linux/linux/issues/1139
>>> Signed-off-by: Ivan Borovyk <saref012@xxxxxxxxx>
>>
>> FWIW I have a series that would make trailing newline optional (although I've
>> not got any feedbacks about whether people would like that):
>>
>> https://lore.kernel.org/rust-for-linux/20260728-printk-v1-5-855606634d70@xxxxxxxxxxx/
>>
>> Best,
>> Gary
>
> IIRC, there were some discussions about this, where people asked the Rust side
> to not deviate from the C side in this regard. It’s been a while though, so take it
> with a grain of salt.

I initially proposed requiring newline to be omitted, but people don't like it
because they might have habit of writing "\n" if they write a lot of C kernel
code.

On the other hand, people write a lot of Rust userspace code would have the
habit of not writing "\n" because that's how `log` and `tracing` library work.

So in that version I changed it to accept either and behave the same. The
newlines are stripped by printk anyway and gets turned into a non-continuable
marker and is not actually a newline, because printk keeps records as opposed to
plain texts.

Best,
Gary