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

From: Andy Shevchenko
Date: Wed Jan 27 2016 - 07:18:53 EST


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@xxxxxxxxxxxxxxx>
Intel Finland Oy