Skip to content

Commit 592ebd7

Browse files
lucaceresolidlezcano
authored andcommitted
vsprintf: remove redundant and unused %pCn format specifier
%pC and %pCn print the same string, and commit 900cca2 ("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>
1 parent b0d71cb commit 592ebd7

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

Documentation/core-api/printk-formats.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,8 @@ struct clk
571571
::
572572

573573
%pC pll1
574-
%pCn pll1
575574

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
577576
(Common Clock Framework) or a unique 32-bit ID (legacy clock framework).
578577

579578
Passed by reference.

Documentation/translations/zh_CN/core-api/printk-formats.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,8 @@ clk结构体
523523
::
524524

525525
%pC pll1
526-
%pCn pll1
527526

528-
用于打印clk结构。%pC 和 %pCn 打印时钟的名称(通用时钟框架)或唯一的32位
527+
用于打印clk结构。%pC 打印时钟的名称(通用时钟框架)或唯一的32位
529528
ID(传统时钟框架)。
530529

531530
通过引用传递。

lib/vsprintf.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,15 +1981,11 @@ char *clock(char *buf, char *end, struct clk *clk, struct printf_spec spec,
19811981
if (check_pointer(&buf, end, clk, spec))
19821982
return buf;
19831983

1984-
switch (fmt[1]) {
1985-
case 'n':
1986-
default:
19871984
#ifdef CONFIG_COMMON_CLK
1988-
return string(buf, end, __clk_get_name(clk), spec);
1985+
return string(buf, end, __clk_get_name(clk), spec);
19891986
#else
1990-
return ptr_to_id(buf, end, clk, spec);
1987+
return ptr_to_id(buf, end, clk, spec);
19911988
#endif
1992-
}
19931989
}
19941990

19951991
static
@@ -2391,8 +2387,6 @@ early_param("no_hash_pointers", no_hash_pointers_enable);
23912387
* T time64_t
23922388
* - 'C' For a clock, it prints the name (Common Clock Framework) or address
23932389
* (legacy clock framework) of the clock
2394-
* - 'Cn' For a clock, it prints the name (Common Clock Framework) or address
2395-
* (legacy clock framework) of the clock
23962390
* - 'G' For flags to be printed as a collection of symbolic strings that would
23972391
* construct the specific value. Supported flags given by option:
23982392
* p page flags (see struct page) given as pointer to unsigned long

0 commit comments

Comments
 (0)