Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1318629 > unrolled thread

Re: [PATCH v1 1/1] lib/vsprintf: define special_hex_number_unsigned_long()

Started byAndrew Morton <akpm@linux-foundation.org>
First post2016-01-27 05:50 +0100
Last post2016-01-27 13:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v1 1/1] lib/vsprintf: define  special_hex_number_unsigned_long() Andrew Morton <akpm@linux-foundation.org> - 2016-01-27 05:50 +0100
    Re: [PATCH v1 1/1] lib/vsprintf: define  special_hex_number_unsigned_long() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-01-27 13:20 +0100

#1318629 — Re: [PATCH v1 1/1] lib/vsprintf: define special_hex_number_unsigned_long()

FromAndrew Morton <akpm@linux-foundation.org>
Date2016-01-27 05:50 +0100
SubjectRe: [PATCH v1 1/1] lib/vsprintf: define special_hex_number_unsigned_long()
Message-ID<qVqdk-6wg-5@gated-at.bofh.it>
On Thu, 14 Jan 2016 14:34:49 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Define a macro for convenient use with values of unsigned long type.
> 
> The value in symbol_string() is type of unsigned long. Use it instead of void *
> when getting sizeof() of it.
> 
> ...
>
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -529,6 +529,9 @@ char *special_hex_number(char *buf, char *end, unsigned long long num, int size)
>  	return number(buf, end, num, spec);
>  }
>  
> +#define special_hex_number_unsigned_long(buf, end, n) \
> +	special_hex_number(buf, end, (unsigned long)n, sizeof(unsigned long))
> +
>  static void move_right(char *buf, char *end, unsigned len, unsigned spaces)
>  {
>  	size_t size;
> @@ -684,7 +687,7 @@ char *symbol_string(char *buf, char *end, void *ptr,
>  
>  	return string(buf, end, sym, spec);
>  #else
> -	return special_hex_number(buf, end, value, sizeof(void *));
> +	return special_hex_number_unsigned_long(buf, end, value);
>  #endif
>  }
>  
> @@ -1446,7 +1449,7 @@ char *clock(char *buf, char *end, struct clk *clk, struct printf_spec spec,
>  #ifdef CONFIG_COMMON_CLK
>  		return string(buf, end, __clk_get_name(clk), spec);
>  #else
> -		return special_hex_number(buf, end, (unsigned long)clk, sizeof(unsigned long));
> +		return special_hex_number_unsigned_long(buf, end, clk);
>  #endif
>  	}
>  }

I'm not sure this is worth the effort.

[toc] | [next] | [standalone]


#1318913

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2016-01-27 13:20 +0100
Message-ID<qVxeP-3jH-15@gated-at.bofh.it>
In reply to#1318629
On Tue, 2016-01-26 at 20:44 -0800, Andrew Morton wrote:
> On Thu, 14 Jan 2016 14:34:49 +0200 Andy Shevchenko <andriy.shevchenko
> @linux.intel.com> wrote:
> 
> > Define a macro for convenient use with values of unsigned long
> > type.
> > 
> > The value in symbol_string() is type of unsigned long. Use it
> > instead of void *
> > when getting sizeof() of it.
> > 
> > ...
> > 
> > --- a/lib/vsprintf.c
> > +++ b/lib/vsprintf.c
> > @@ -529,6 +529,9 @@ char *special_hex_number(char *buf, char *end,
> > unsigned long long num, int size)
> >  	return number(buf, end, num, spec);
> >  }
> >  
> > +#define special_hex_number_unsigned_long(buf, end, n) \
> > +	special_hex_number(buf, end, (unsigned long)n,
> > sizeof(unsigned long))
> > +
> >  static void move_right(char *buf, char *end, unsigned len,
> > unsigned spaces)
> >  {
> >  	size_t size;
> > @@ -684,7 +687,7 @@ char *symbol_string(char *buf, char *end, void
> > *ptr,
> >  
> >  	return string(buf, end, sym, spec);
> >  #else
> > -	return special_hex_number(buf, end, value, sizeof(void
> > *));
> > +	return special_hex_number_unsigned_long(buf, end, value);
> >  #endif
> >  }
> >  
> > @@ -1446,7 +1449,7 @@ char *clock(char *buf, char *end, struct clk
> > *clk, struct printf_spec spec,
> >  #ifdef CONFIG_COMMON_CLK
> >  		return string(buf, end, __clk_get_name(clk),
> > spec);
> >  #else
> > -		return special_hex_number(buf, end, (unsigned
> > long)clk, sizeof(unsigned long));
> > +		return special_hex_number_unsigned_long(buf, end,
> > clk);
> >  #endif
> >  	}
> >  }
> 
> I'm not sure this is worth the effort.

Drop it then! I'm fine with any decision.


-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web