[PATCH] clk: make use of %pC format specifier for printing name

Sascha Hauer s.hauer at pengutronix.de
Mon Jun 9 23:31:04 PDT 2025


On Mon, Jun 09, 2025 at 08:31:27AM +0200, Ahmad Fatoum wrote:
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index ba87f6c210d2..b2eeb2702f3d 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -16,6 +16,7 @@
>  #include <linux/string.h>
>  #include <linux/ctype.h>
>  #include <linux/math64.h>
> +#include <linux/clk.h>
>  #include <malloc.h>
>  #include <kallsyms.h>
>  #include <wchar.h>
> @@ -310,7 +311,7 @@ char *ip4_addr_string(char *buf, const char *end, const u8 *addr, int field_widt
>  }
>  
>  static
> -char *error_string(char *buf, const char *end, const u8 *errptr, int field_width,
> +char *error_string(char *buf, const char *end, const void *errptr, int field_width,
>  		   int precision, int flags, const char *fmt)
>  {
>      if (!IS_ERR(errptr))
> @@ -477,6 +478,16 @@ char *device_node_string(char *buf, const char *end, const struct device_node *n
>  		      precision, flags);
>  }
>  
> +static noinline_for_stack
> +char *clock(char *buf, const char *end, const struct clk *clk,
> +	    int field_width, int precision, int flags, const char *fmt)
> +{
> +	if (IS_ERR_OR_NULL(clk))
> +		return error_string(buf, end, clk, field_width, precision, flags, fmt);
> +
> +	return string(buf, end, clk->name, field_width, precision, flags);
> +}

struct clk is declared inside #ifdef CONFIG_COMMON_CLK. Without some
ifdef here you'll likely hit compile errors.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list