Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vsprintf: remove redundant and unused %pCn format specifier

%pC and %pCn print the same string, and commit 900cca294425 ("lib/vsprintf:
add %pC{,n,r} format specifiers for clocks") introducing them does not
clarify any intended difference. It can be assumed %pC is a default for
%pCn as some other specifiers do, but not all are consistent with this
policy. Moreover there is now no other suffix other than 'n', which makes a
default not really useful.

All users in the kernel were using %pC except for one which has been
converted. So now remove %pCn and all the unnecessary extra code and
documentation.

Acked-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Yanteng Si <si.yanteng@linux.dev>
Link: https://lore.kernel.org/r/20250311-vsprintf-pcn-v2-2-0af40fc7dee4@bootlin.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Luca Ceresoli and committed by
Daniel Lezcano
592ebd77 b0d71cb4

+4 -12
+1 -2
Documentation/core-api/printk-formats.rst
··· 571 571 :: 572 572 573 573 %pC pll1 574 - %pCn pll1 575 574 576 - For printing struct clk structures. %pC and %pCn print the name of the clock 575 + For printing struct clk structures. %pC prints the name of the clock 577 576 (Common Clock Framework) or a unique 32-bit ID (legacy clock framework). 578 577 579 578 Passed by reference.
+1 -2
Documentation/translations/zh_CN/core-api/printk-formats.rst
··· 523 523 :: 524 524 525 525 %pC pll1 526 - %pCn pll1 527 526 528 - 用于打印clk结构。%pC 和 %pCn 打印时钟的名称(通用时钟框架)或唯一的32位 527 + 用于打印clk结构。%pC 打印时钟的名称(通用时钟框架)或唯一的32位 529 528 ID(传统时钟框架)。 530 529 531 530 通过引用传递。
+2 -8
lib/vsprintf.c
··· 1981 1981 if (check_pointer(&buf, end, clk, spec)) 1982 1982 return buf; 1983 1983 1984 - switch (fmt[1]) { 1985 - case 'n': 1986 - default: 1987 1984 #ifdef CONFIG_COMMON_CLK 1988 - return string(buf, end, __clk_get_name(clk), spec); 1985 + return string(buf, end, __clk_get_name(clk), spec); 1989 1986 #else 1990 - return ptr_to_id(buf, end, clk, spec); 1987 + return ptr_to_id(buf, end, clk, spec); 1991 1988 #endif 1992 - } 1993 1989 } 1994 1990 1995 1991 static ··· 2387 2391 * T time64_t 2388 2392 * - 'C' For a clock, it prints the name (Common Clock Framework) or address 2389 2393 * (legacy clock framework) of the clock 2390 - * - 'Cn' For a clock, it prints the name (Common Clock Framework) or address 2391 - * (legacy clock framework) of the clock 2392 2394 * - 'G' For flags to be printed as a collection of symbolic strings that would 2393 2395 * construct the specific value. Supported flags given by option: 2394 2396 * p page flags (see struct page) given as pointer to unsigned long