Re: [PATCH] locking/lockdep: Use seq_putc() in five functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 14/07/2024 à 23:31, Waiman Long a écrit :
On 7/14/24 06:25, Markus Elfring wrote:
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 14 Jul 2024 12:18:16 +0200

Single characters should be put into a sequence.
Thus use the corresponding function “seq_putc”.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---

...

@@ -422,10 +422,10 @@ static void seq_line(struct seq_file *m, char c, int offset, int length)
      int i;

      for (i = 0; i < offset; i++)
-        seq_puts(m, " ");
+        seq_putc(m, ' ');

Hi,

Most of the time, this kind of modification is useless because it is already done by the compiler, see [1].

      for (i = 0; i < length; i++)
          seq_printf(m, "%c", c);

But changing this seq_printf() into a seq_putc() would, IMHO, make sense and save a few cycles, should it matter.

CJ

[1]: https://elixir.bootlin.com/linux/v6.10-rc7/source/include/linux/seq_file.h#L123

-    seq_puts(m, "\n");
+    seq_putc(m, '\n');
  }

...

--
2.45.2

Acked-by: Waiman Long <longman@xxxxxxxxxx>






[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux