lkml.org 
[lkml]   [2018]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] printk: Make printk_emit() local function.
From
Date
On 2018/11/23 21:24, Petr Mladek wrote:
> On Thu 2018-11-22 23:59:28, Tetsuo Handa wrote:
>> printk_emit() is called from only devkmsg_write() in the same file.
>> Save object size by making it a local function.
>>
>> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
>> ---
>> include/linux/printk.h | 5 -----
>> kernel/printk/printk.c | 31 +++++++++++++++----------------
>> 2 files changed, 15 insertions(+), 21 deletions(-)
>>
>> --- a/kernel/printk/printk.c
>> +++ b/kernel/printk/printk.c
>> @@ -752,6 +752,20 @@ struct devkmsg_user {
>> char buf[CONSOLE_EXT_LOG_MAX];
>> };
>>
>> +static __printf(3, 4) __cold int devkmsg_emit(int facility, int level,
>> + const char *fmt, ...);
>
> There is no need for the forward declaration. __printf(3, 4)
> and __cold could be part of the function definition.
> Or do I miss anything?

If you meant below one, it fails with "error: expected ',' or ';' before '{' token".
Attributes annotation needs to be done as the prototype definition.
(Though I don't know whether __cold here makes sense...)

static int devkmsg_emit(int facility, int level, const char *fmt, ...)
__printf(3, 4) __cold
{
va_list args;
int r;

va_start(args, fmt);
r = vprintk_emit(facility, level, NULL, 0, fmt, args);
va_end(args);

return r;
}

\
 
 \ /
  Last update: 2018-11-23 14:26    [W:0.057 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site