[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vdx2x8K0_LaJDY1nN0c+M9RUwAyHyoQ2jXz1FEGVOanRQ@mail.gmail.com>
Date: Mon, 28 Dec 2015 21:02:17 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 1/1] lib/vsprintf: refactor duplicate code to xnumber()
On Mon, Dec 28, 2015 at 8:25 PM, Joe Perches <joe@...ches.com> wrote:
> On Mon, 2015-12-28 at 20:18 +0200, Andy Shevchenko wrote:
>> xnumber() is a special helper to print a fixed size type in a hex format with
>> '0x' prefix with padding and reduced size. In the module we have already
>> several copies of such code. Consolidate them under xnumber() helper.
>>
>> There are couple of differences though.
>>
>> It seems nobody cared about the output in case of CONFIG_KALLSYMS=n when
>> printing symbol address because the asked width is not enough to care either
>> prefix or last byte. Fixed here.
>>
>> The %pNF specifier used to be allowed with a specific field width, though there
>> is neither any user of it nor mention in the documentation.
>>
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
>> ---
>> lib/vsprintf.c | 43 +++++++++++++++----------------------------
>> 1 file changed, 15 insertions(+), 28 deletions(-)
>>
>> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
>> index dcf5646..e971549 100644
>> --- a/lib/vsprintf.c
>> +++ b/lib/vsprintf.c
>> @@ -514,6 +514,16 @@ char *number(char *buf, char *end, unsigned long long num,
>> return buf;
>> }
>>
>> +static noinline_for_stack
>> +char *xnumber(char *buf, char *end, unsigned long long value, unsigned int type,
>> + struct printf_spec spec)
>
> xnumber isn't a great name.
I rather agree, however had nothing yet to replace. Any ideas?
> unsigned int type should probably be size_t size
Used to be :-), though I decided to move it to unsigned int since the
resulting field is anyway 8 bits of unsigned int.
If you think it's better to do all conversion inside xnumber (or
whatever name it would be), I redo this.
--
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists