Skip to content

Commit d1f1052

Browse files
JoePerchesgregkh
authored andcommitted
device: Change dev_<level> logging functions to return void
No caller or macro uses the return value so make all the functions return void. Compiled x86 allyesconfig and defconfig w/o CONFIG_PRINTK Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a2a15d5 commit d1f1052

File tree

2 files changed

+40
-49
lines changed

2 files changed

+40
-49
lines changed

drivers/base/core.c

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,54 +2080,47 @@ int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
20802080
}
20812081
EXPORT_SYMBOL(dev_printk_emit);
20822082

2083-
static int __dev_printk(const char *level, const struct device *dev,
2083+
static void __dev_printk(const char *level, const struct device *dev,
20842084
struct va_format *vaf)
20852085
{
2086-
if (!dev)
2087-
return printk("%s(NULL device *): %pV", level, vaf);
2088-
2089-
return dev_printk_emit(level[1] - '0', dev,
2090-
"%s %s: %pV",
2091-
dev_driver_string(dev), dev_name(dev), vaf);
2086+
if (dev)
2087+
dev_printk_emit(level[1] - '0', dev, "%s %s: %pV",
2088+
dev_driver_string(dev), dev_name(dev), vaf);
2089+
else
2090+
printk("%s(NULL device *): %pV", level, vaf);
20922091
}
20932092

2094-
int dev_printk(const char *level, const struct device *dev,
2095-
const char *fmt, ...)
2093+
void dev_printk(const char *level, const struct device *dev,
2094+
const char *fmt, ...)
20962095
{
20972096
struct va_format vaf;
20982097
va_list args;
2099-
int r;
21002098

21012099
va_start(args, fmt);
21022100

21032101
vaf.fmt = fmt;
21042102
vaf.va = &args;
21052103

2106-
r = __dev_printk(level, dev, &vaf);
2104+
__dev_printk(level, dev, &vaf);
21072105

21082106
va_end(args);
2109-
2110-
return r;
21112107
}
21122108
EXPORT_SYMBOL(dev_printk);
21132109

21142110
#define define_dev_printk_level(func, kern_level) \
2115-
int func(const struct device *dev, const char *fmt, ...) \
2111+
void func(const struct device *dev, const char *fmt, ...) \
21162112
{ \
21172113
struct va_format vaf; \
21182114
va_list args; \
2119-
int r; \
21202115
\
21212116
va_start(args, fmt); \
21222117
\
21232118
vaf.fmt = fmt; \
21242119
vaf.va = &args; \
21252120
\
2126-
r = __dev_printk(kern_level, dev, &vaf); \
2121+
__dev_printk(kern_level, dev, &vaf); \
21272122
\
21282123
va_end(args); \
2129-
\
2130-
return r; \
21312124
} \
21322125
EXPORT_SYMBOL(func);
21332126

include/linux/device.h

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,22 +1038,22 @@ extern __printf(3, 4)
10381038
int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
10391039

10401040
extern __printf(3, 4)
1041-
int dev_printk(const char *level, const struct device *dev,
1042-
const char *fmt, ...);
1041+
void dev_printk(const char *level, const struct device *dev,
1042+
const char *fmt, ...);
10431043
extern __printf(2, 3)
1044-
int dev_emerg(const struct device *dev, const char *fmt, ...);
1044+
void dev_emerg(const struct device *dev, const char *fmt, ...);
10451045
extern __printf(2, 3)
1046-
int dev_alert(const struct device *dev, const char *fmt, ...);
1046+
void dev_alert(const struct device *dev, const char *fmt, ...);
10471047
extern __printf(2, 3)
1048-
int dev_crit(const struct device *dev, const char *fmt, ...);
1048+
void dev_crit(const struct device *dev, const char *fmt, ...);
10491049
extern __printf(2, 3)
1050-
int dev_err(const struct device *dev, const char *fmt, ...);
1050+
void dev_err(const struct device *dev, const char *fmt, ...);
10511051
extern __printf(2, 3)
1052-
int dev_warn(const struct device *dev, const char *fmt, ...);
1052+
void dev_warn(const struct device *dev, const char *fmt, ...);
10531053
extern __printf(2, 3)
1054-
int dev_notice(const struct device *dev, const char *fmt, ...);
1054+
void dev_notice(const struct device *dev, const char *fmt, ...);
10551055
extern __printf(2, 3)
1056-
int _dev_info(const struct device *dev, const char *fmt, ...);
1056+
void _dev_info(const struct device *dev, const char *fmt, ...);
10571057

10581058
#else
10591059

@@ -1065,35 +1065,35 @@ static inline __printf(3, 4)
10651065
int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
10661066
{ return 0; }
10671067

1068-
static inline int __dev_printk(const char *level, const struct device *dev,
1069-
struct va_format *vaf)
1070-
{ return 0; }
1068+
static inline void __dev_printk(const char *level, const struct device *dev,
1069+
struct va_format *vaf)
1070+
{}
10711071
static inline __printf(3, 4)
1072-
int dev_printk(const char *level, const struct device *dev,
1073-
const char *fmt, ...)
1074-
{ return 0; }
1072+
void dev_printk(const char *level, const struct device *dev,
1073+
const char *fmt, ...)
1074+
{}
10751075

10761076
static inline __printf(2, 3)
1077-
int dev_emerg(const struct device *dev, const char *fmt, ...)
1078-
{ return 0; }
1077+
void dev_emerg(const struct device *dev, const char *fmt, ...)
1078+
{}
10791079
static inline __printf(2, 3)
1080-
int dev_crit(const struct device *dev, const char *fmt, ...)
1081-
{ return 0; }
1080+
void dev_crit(const struct device *dev, const char *fmt, ...)
1081+
{}
10821082
static inline __printf(2, 3)
1083-
int dev_alert(const struct device *dev, const char *fmt, ...)
1084-
{ return 0; }
1083+
void dev_alert(const struct device *dev, const char *fmt, ...)
1084+
{}
10851085
static inline __printf(2, 3)
1086-
int dev_err(const struct device *dev, const char *fmt, ...)
1087-
{ return 0; }
1086+
void dev_err(const struct device *dev, const char *fmt, ...)
1087+
{}
10881088
static inline __printf(2, 3)
1089-
int dev_warn(const struct device *dev, const char *fmt, ...)
1090-
{ return 0; }
1089+
void dev_warn(const struct device *dev, const char *fmt, ...)
1090+
{}
10911091
static inline __printf(2, 3)
1092-
int dev_notice(const struct device *dev, const char *fmt, ...)
1093-
{ return 0; }
1092+
void dev_notice(const struct device *dev, const char *fmt, ...)
1093+
{}
10941094
static inline __printf(2, 3)
1095-
int _dev_info(const struct device *dev, const char *fmt, ...)
1096-
{ return 0; }
1095+
void _dev_info(const struct device *dev, const char *fmt, ...)
1096+
{}
10971097

10981098
#endif
10991099

@@ -1119,7 +1119,6 @@ do { \
11191119
({ \
11201120
if (0) \
11211121
dev_printk(KERN_DEBUG, dev, format, ##arg); \
1122-
0; \
11231122
})
11241123
#endif
11251124

@@ -1215,7 +1214,6 @@ do { \
12151214
({ \
12161215
if (0) \
12171216
dev_printk(KERN_DEBUG, dev, format, ##arg); \
1218-
0; \
12191217
})
12201218
#endif
12211219

0 commit comments

Comments
 (0)