diff options
| -rw-r--r-- | drivers/base/core.c | 29 | ||||
| -rw-r--r-- | include/linux/device.h | 60 |
2 files changed, 40 insertions, 49 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 97e2baf6e5d8..07304a3b9ee2 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -2080,54 +2080,47 @@ int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...) | |||
| 2080 | } | 2080 | } |
| 2081 | EXPORT_SYMBOL(dev_printk_emit); | 2081 | EXPORT_SYMBOL(dev_printk_emit); |
| 2082 | 2082 | ||
| 2083 | static int __dev_printk(const char *level, const struct device *dev, | 2083 | static void __dev_printk(const char *level, const struct device *dev, |
| 2084 | struct va_format *vaf) | 2084 | struct va_format *vaf) |
| 2085 | { | 2085 | { |
| 2086 | if (!dev) | 2086 | if (dev) |
| 2087 | return printk("%s(NULL device *): %pV", level, vaf); | 2087 | dev_printk_emit(level[1] - '0', dev, "%s %s: %pV", |
| 2088 | 2088 | dev_driver_string(dev), dev_name(dev), vaf); | |
| 2089 | return dev_printk_emit(level[1] - '0', dev, | 2089 | else |
| 2090 | "%s %s: %pV", | 2090 | printk("%s(NULL device *): %pV", level, vaf); |
| 2091 | dev_driver_string(dev), dev_name(dev), vaf); | ||
| 2092 | } | 2091 | } |
| 2093 | 2092 | ||
| 2094 | int dev_printk(const char *level, const struct device *dev, | 2093 | void dev_printk(const char *level, const struct device *dev, |
| 2095 | const char *fmt, ...) | 2094 | const char *fmt, ...) |
| 2096 | { | 2095 | { |
| 2097 | struct va_format vaf; | 2096 | struct va_format vaf; |
| 2098 | va_list args; | 2097 | va_list args; |
| 2099 | int r; | ||
| 2100 | 2098 | ||
| 2101 | va_start(args, fmt); | 2099 | va_start(args, fmt); |
| 2102 | 2100 | ||
| 2103 | vaf.fmt = fmt; | 2101 | vaf.fmt = fmt; |
| 2104 | vaf.va = &args; | 2102 | vaf.va = &args; |
| 2105 | 2103 | ||
| 2106 | r = __dev_printk(level, dev, &vaf); | 2104 | __dev_printk(level, dev, &vaf); |
| 2107 | 2105 | ||
| 2108 | va_end(args); | 2106 | va_end(args); |
| 2109 | |||
| 2110 | return r; | ||
| 2111 | } | 2107 | } |
| 2112 | EXPORT_SYMBOL(dev_printk); | 2108 | EXPORT_SYMBOL(dev_printk); |
| 2113 | 2109 | ||
| 2114 | #define define_dev_printk_level(func, kern_level) \ | 2110 | #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, ...) \ |
| 2116 | { \ | 2112 | { \ |
| 2117 | struct va_format vaf; \ | 2113 | struct va_format vaf; \ |
| 2118 | va_list args; \ | 2114 | va_list args; \ |
| 2119 | int r; \ | ||
| 2120 | \ | 2115 | \ |
| 2121 | va_start(args, fmt); \ | 2116 | va_start(args, fmt); \ |
| 2122 | \ | 2117 | \ |
| 2123 | vaf.fmt = fmt; \ | 2118 | vaf.fmt = fmt; \ |
| 2124 | vaf.va = &args; \ | 2119 | vaf.va = &args; \ |
| 2125 | \ | 2120 | \ |
| 2126 | r = __dev_printk(kern_level, dev, &vaf); \ | 2121 | __dev_printk(kern_level, dev, &vaf); \ |
| 2127 | \ | 2122 | \ |
| 2128 | va_end(args); \ | 2123 | va_end(args); \ |
| 2129 | \ | ||
| 2130 | return r; \ | ||
| 2131 | } \ | 2124 | } \ |
| 2132 | EXPORT_SYMBOL(func); | 2125 | EXPORT_SYMBOL(func); |
| 2133 | 2126 | ||
diff --git a/include/linux/device.h b/include/linux/device.h index 7b2532361398..0eb8ee2dc6d1 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -1038,22 +1038,22 @@ extern __printf(3, 4) | |||
| 1038 | int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); | 1038 | int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); |
| 1039 | 1039 | ||
| 1040 | extern __printf(3, 4) | 1040 | extern __printf(3, 4) |
| 1041 | int dev_printk(const char *level, const struct device *dev, | 1041 | void dev_printk(const char *level, const struct device *dev, |
| 1042 | const char *fmt, ...); | 1042 | const char *fmt, ...); |
| 1043 | extern __printf(2, 3) | 1043 | 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, ...); |
| 1045 | extern __printf(2, 3) | 1045 | 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, ...); |
| 1047 | extern __printf(2, 3) | 1047 | 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, ...); |
| 1049 | extern __printf(2, 3) | 1049 | 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, ...); |
| 1051 | extern __printf(2, 3) | 1051 | 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, ...); |
| 1053 | extern __printf(2, 3) | 1053 | 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, ...); |
| 1055 | extern __printf(2, 3) | 1055 | 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, ...); |
| 1057 | 1057 | ||
| 1058 | #else | 1058 | #else |
| 1059 | 1059 | ||
| @@ -1065,35 +1065,35 @@ static inline __printf(3, 4) | |||
| 1065 | int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...) | 1065 | int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...) |
| 1066 | { return 0; } | 1066 | { return 0; } |
| 1067 | 1067 | ||
| 1068 | static inline int __dev_printk(const char *level, const struct device *dev, | 1068 | static inline void __dev_printk(const char *level, const struct device *dev, |
| 1069 | struct va_format *vaf) | 1069 | struct va_format *vaf) |
| 1070 | { return 0; } | 1070 | {} |
| 1071 | static inline __printf(3, 4) | 1071 | static inline __printf(3, 4) |
| 1072 | int dev_printk(const char *level, const struct device *dev, | 1072 | void dev_printk(const char *level, const struct device *dev, |
| 1073 | const char *fmt, ...) | 1073 | const char *fmt, ...) |
| 1074 | { return 0; } | 1074 | {} |
| 1075 | 1075 | ||
| 1076 | static inline __printf(2, 3) | 1076 | static inline __printf(2, 3) |
| 1077 | int dev_emerg(const struct device *dev, const char *fmt, ...) | 1077 | void dev_emerg(const struct device *dev, const char *fmt, ...) |
| 1078 | { return 0; } | 1078 | {} |
| 1079 | static inline __printf(2, 3) | 1079 | static inline __printf(2, 3) |
| 1080 | int dev_crit(const struct device *dev, const char *fmt, ...) | 1080 | void dev_crit(const struct device *dev, const char *fmt, ...) |
| 1081 | { return 0; } | 1081 | {} |
| 1082 | static inline __printf(2, 3) | 1082 | static inline __printf(2, 3) |
| 1083 | int dev_alert(const struct device *dev, const char *fmt, ...) | 1083 | void dev_alert(const struct device *dev, const char *fmt, ...) |
| 1084 | { return 0; } | 1084 | {} |
| 1085 | static inline __printf(2, 3) | 1085 | static inline __printf(2, 3) |
| 1086 | int dev_err(const struct device *dev, const char *fmt, ...) | 1086 | void dev_err(const struct device *dev, const char *fmt, ...) |
| 1087 | { return 0; } | 1087 | {} |
| 1088 | static inline __printf(2, 3) | 1088 | static inline __printf(2, 3) |
| 1089 | int dev_warn(const struct device *dev, const char *fmt, ...) | 1089 | void dev_warn(const struct device *dev, const char *fmt, ...) |
| 1090 | { return 0; } | 1090 | {} |
| 1091 | static inline __printf(2, 3) | 1091 | static inline __printf(2, 3) |
| 1092 | int dev_notice(const struct device *dev, const char *fmt, ...) | 1092 | void dev_notice(const struct device *dev, const char *fmt, ...) |
| 1093 | { return 0; } | 1093 | {} |
| 1094 | static inline __printf(2, 3) | 1094 | static inline __printf(2, 3) |
| 1095 | int _dev_info(const struct device *dev, const char *fmt, ...) | 1095 | void _dev_info(const struct device *dev, const char *fmt, ...) |
| 1096 | { return 0; } | 1096 | {} |
| 1097 | 1097 | ||
| 1098 | #endif | 1098 | #endif |
| 1099 | 1099 | ||
| @@ -1119,7 +1119,6 @@ do { \ | |||
| 1119 | ({ \ | 1119 | ({ \ |
| 1120 | if (0) \ | 1120 | if (0) \ |
| 1121 | dev_printk(KERN_DEBUG, dev, format, ##arg); \ | 1121 | dev_printk(KERN_DEBUG, dev, format, ##arg); \ |
| 1122 | 0; \ | ||
| 1123 | }) | 1122 | }) |
| 1124 | #endif | 1123 | #endif |
| 1125 | 1124 | ||
| @@ -1215,7 +1214,6 @@ do { \ | |||
| 1215 | ({ \ | 1214 | ({ \ |
| 1216 | if (0) \ | 1215 | if (0) \ |
| 1217 | dev_printk(KERN_DEBUG, dev, format, ##arg); \ | 1216 | dev_printk(KERN_DEBUG, dev, format, ##arg); \ |
| 1218 | 0; \ | ||
| 1219 | }) | 1217 | }) |
| 1220 | #endif | 1218 | #endif |
| 1221 | 1219 | ||
