aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-15 14:11:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-15 14:11:47 -0500
commit9682ec9692e5ac11c6caebd079324e727b19e7ce (patch)
tree16b25351557cd028913fc2c225e2db0175d750b6
parent4ba63072b998cc31515cc6305c25f3b808b50c01 (diff)
parentadf305f77878880fa5868a7179979da93be68d83 (diff)
Merge tag 'driver-core-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core patches from Greg KH: "Really tiny set of patches for this kernel. Nothing major, all described in the shortlog and have been in linux-next for a while" * tag 'driver-core-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: sysfs: fix warning when creating a sysfs group without attributes firmware_loader: handle timeout via wait_for_completion_interruptible_timeout() firmware_loader: abort request if wait_for_completion is interrupted firmware: Correct function name in comment device: Change dev_<level> logging functions to return void device: Fix dev_dbg_once macro
-rw-r--r--drivers/base/core.c29
-rw-r--r--drivers/base/firmware_class.c33
-rw-r--r--fs/sysfs/group.c2
-rw-r--r--include/linux/device.h62
4 files changed, 53 insertions, 73 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}
2081EXPORT_SYMBOL(dev_printk_emit); 2081EXPORT_SYMBOL(dev_printk_emit);
2082 2082
2083static int __dev_printk(const char *level, const struct device *dev, 2083static 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
2094int dev_printk(const char *level, const struct device *dev, 2093void 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}
2112EXPORT_SYMBOL(dev_printk); 2108EXPORT_SYMBOL(dev_printk);
2113 2109
2114#define define_dev_printk_level(func, kern_level) \ 2110#define define_dev_printk_level(func, kern_level) \
2115int func(const struct device *dev, const char *fmt, ...) \ 2111void 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} \
2132EXPORT_SYMBOL(func); 2125EXPORT_SYMBOL(func);
2133 2126
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index c3293f0a8573..6c5c9edf5ff6 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -94,7 +94,7 @@ static int loading_timeout = 60; /* In seconds */
94 94
95static inline long firmware_loading_timeout(void) 95static inline long firmware_loading_timeout(void)
96{ 96{
97 return loading_timeout > 0 ? loading_timeout * HZ : MAX_SCHEDULE_TIMEOUT; 97 return loading_timeout > 0 ? loading_timeout * HZ : MAX_JIFFY_OFFSET;
98} 98}
99 99
100/* firmware behavior options */ 100/* firmware behavior options */
@@ -446,7 +446,6 @@ static int fw_add_devm_name(struct device *dev, const char *name)
446 */ 446 */
447#ifdef CONFIG_FW_LOADER_USER_HELPER 447#ifdef CONFIG_FW_LOADER_USER_HELPER
448struct firmware_priv { 448struct firmware_priv {
449 struct delayed_work timeout_work;
450 bool nowait; 449 bool nowait;
451 struct device dev; 450 struct device dev;
452 struct firmware_buf *buf; 451 struct firmware_buf *buf;
@@ -836,16 +835,6 @@ static struct bin_attribute firmware_attr_data = {
836 .write = firmware_data_write, 835 .write = firmware_data_write,
837}; 836};
838 837
839static void firmware_class_timeout_work(struct work_struct *work)
840{
841 struct firmware_priv *fw_priv = container_of(work,
842 struct firmware_priv, timeout_work.work);
843
844 mutex_lock(&fw_lock);
845 fw_load_abort(fw_priv);
846 mutex_unlock(&fw_lock);
847}
848
849static struct firmware_priv * 838static struct firmware_priv *
850fw_create_instance(struct firmware *firmware, const char *fw_name, 839fw_create_instance(struct firmware *firmware, const char *fw_name,
851 struct device *device, unsigned int opt_flags) 840 struct device *device, unsigned int opt_flags)
@@ -861,9 +850,6 @@ fw_create_instance(struct firmware *firmware, const char *fw_name,
861 850
862 fw_priv->nowait = !!(opt_flags & FW_OPT_NOWAIT); 851 fw_priv->nowait = !!(opt_flags & FW_OPT_NOWAIT);
863 fw_priv->fw = firmware; 852 fw_priv->fw = firmware;
864 INIT_DELAYED_WORK(&fw_priv->timeout_work,
865 firmware_class_timeout_work);
866
867 f_dev = &fw_priv->dev; 853 f_dev = &fw_priv->dev;
868 854
869 device_initialize(f_dev); 855 device_initialize(f_dev);
@@ -916,16 +902,19 @@ static int _request_firmware_load(struct firmware_priv *fw_priv,
916 buf->need_uevent = true; 902 buf->need_uevent = true;
917 dev_set_uevent_suppress(f_dev, false); 903 dev_set_uevent_suppress(f_dev, false);
918 dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id); 904 dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id);
919 if (timeout != MAX_SCHEDULE_TIMEOUT)
920 queue_delayed_work(system_power_efficient_wq,
921 &fw_priv->timeout_work, timeout);
922
923 kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); 905 kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD);
906 } else {
907 timeout = MAX_JIFFY_OFFSET;
924 } 908 }
925 909
926 retval = wait_for_completion_interruptible(&buf->completion); 910 retval = wait_for_completion_interruptible_timeout(&buf->completion,
911 timeout);
912 if (retval == -ERESTARTSYS || !retval) {
913 mutex_lock(&fw_lock);
914 fw_load_abort(fw_priv);
915 mutex_unlock(&fw_lock);
916 }
927 917
928 cancel_delayed_work_sync(&fw_priv->timeout_work);
929 if (is_fw_load_aborted(buf)) 918 if (is_fw_load_aborted(buf))
930 retval = -EAGAIN; 919 retval = -EAGAIN;
931 else if (!buf->data) 920 else if (!buf->data)
@@ -1193,7 +1182,7 @@ request_firmware(const struct firmware **firmware_p, const char *name,
1193EXPORT_SYMBOL(request_firmware); 1182EXPORT_SYMBOL(request_firmware);
1194 1183
1195/** 1184/**
1196 * request_firmware: - load firmware directly without usermode helper 1185 * request_firmware_direct: - load firmware directly without usermode helper
1197 * @firmware_p: pointer to firmware image 1186 * @firmware_p: pointer to firmware image
1198 * @name: name of firmware file 1187 * @name: name of firmware file
1199 * @device: device for which firmware is being loaded 1188 * @device: device for which firmware is being loaded
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c
index 7d2a860ba788..2554d8835b48 100644
--- a/fs/sysfs/group.c
+++ b/fs/sysfs/group.c
@@ -99,7 +99,7 @@ static int internal_create_group(struct kobject *kobj, int update,
99 return -EINVAL; 99 return -EINVAL;
100 if (!grp->attrs && !grp->bin_attrs) { 100 if (!grp->attrs && !grp->bin_attrs) {
101 WARN(1, "sysfs: (bin_)attrs not set by subsystem for group: %s/%s\n", 101 WARN(1, "sysfs: (bin_)attrs not set by subsystem for group: %s/%s\n",
102 kobj->name, grp->name ? "" : grp->name); 102 kobj->name, grp->name ?: "");
103 return -EINVAL; 103 return -EINVAL;
104 } 104 }
105 if (grp->name) { 105 if (grp->name) {
diff --git a/include/linux/device.h b/include/linux/device.h
index fb506738f7b7..0eb8ee2dc6d1 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1038,22 +1038,22 @@ extern __printf(3, 4)
1038int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); 1038int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
1039 1039
1040extern __printf(3, 4) 1040extern __printf(3, 4)
1041int dev_printk(const char *level, const struct device *dev, 1041void dev_printk(const char *level, const struct device *dev,
1042 const char *fmt, ...); 1042 const char *fmt, ...);
1043extern __printf(2, 3) 1043extern __printf(2, 3)
1044int dev_emerg(const struct device *dev, const char *fmt, ...); 1044void dev_emerg(const struct device *dev, const char *fmt, ...);
1045extern __printf(2, 3) 1045extern __printf(2, 3)
1046int dev_alert(const struct device *dev, const char *fmt, ...); 1046void dev_alert(const struct device *dev, const char *fmt, ...);
1047extern __printf(2, 3) 1047extern __printf(2, 3)
1048int dev_crit(const struct device *dev, const char *fmt, ...); 1048void dev_crit(const struct device *dev, const char *fmt, ...);
1049extern __printf(2, 3) 1049extern __printf(2, 3)
1050int dev_err(const struct device *dev, const char *fmt, ...); 1050void dev_err(const struct device *dev, const char *fmt, ...);
1051extern __printf(2, 3) 1051extern __printf(2, 3)
1052int dev_warn(const struct device *dev, const char *fmt, ...); 1052void dev_warn(const struct device *dev, const char *fmt, ...);
1053extern __printf(2, 3) 1053extern __printf(2, 3)
1054int dev_notice(const struct device *dev, const char *fmt, ...); 1054void dev_notice(const struct device *dev, const char *fmt, ...);
1055extern __printf(2, 3) 1055extern __printf(2, 3)
1056int _dev_info(const struct device *dev, const char *fmt, ...); 1056void _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)
1065int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...) 1065int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
1066{ return 0; } 1066{ return 0; }
1067 1067
1068static inline int __dev_printk(const char *level, const struct device *dev, 1068static 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{}
1071static inline __printf(3, 4) 1071static inline __printf(3, 4)
1072int dev_printk(const char *level, const struct device *dev, 1072void dev_printk(const char *level, const struct device *dev,
1073 const char *fmt, ...) 1073 const char *fmt, ...)
1074{ return 0; } 1074{}
1075 1075
1076static inline __printf(2, 3) 1076static inline __printf(2, 3)
1077int dev_emerg(const struct device *dev, const char *fmt, ...) 1077void dev_emerg(const struct device *dev, const char *fmt, ...)
1078{ return 0; } 1078{}
1079static inline __printf(2, 3) 1079static inline __printf(2, 3)
1080int dev_crit(const struct device *dev, const char *fmt, ...) 1080void dev_crit(const struct device *dev, const char *fmt, ...)
1081{ return 0; } 1081{}
1082static inline __printf(2, 3) 1082static inline __printf(2, 3)
1083int dev_alert(const struct device *dev, const char *fmt, ...) 1083void dev_alert(const struct device *dev, const char *fmt, ...)
1084{ return 0; } 1084{}
1085static inline __printf(2, 3) 1085static inline __printf(2, 3)
1086int dev_err(const struct device *dev, const char *fmt, ...) 1086void dev_err(const struct device *dev, const char *fmt, ...)
1087{ return 0; } 1087{}
1088static inline __printf(2, 3) 1088static inline __printf(2, 3)
1089int dev_warn(const struct device *dev, const char *fmt, ...) 1089void dev_warn(const struct device *dev, const char *fmt, ...)
1090{ return 0; } 1090{}
1091static inline __printf(2, 3) 1091static inline __printf(2, 3)
1092int dev_notice(const struct device *dev, const char *fmt, ...) 1092void dev_notice(const struct device *dev, const char *fmt, ...)
1093{ return 0; } 1093{}
1094static inline __printf(2, 3) 1094static inline __printf(2, 3)
1095int _dev_info(const struct device *dev, const char *fmt, ...) 1095void _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
@@ -1156,7 +1155,7 @@ do { \
1156#define dev_info_once(dev, fmt, ...) \ 1155#define dev_info_once(dev, fmt, ...) \
1157 dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__) 1156 dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__)
1158#define dev_dbg_once(dev, fmt, ...) \ 1157#define dev_dbg_once(dev, fmt, ...) \
1159 dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__) 1158 dev_level_once(dev_dbg, dev, fmt, ##__VA_ARGS__)
1160 1159
1161#define dev_level_ratelimited(dev_level, dev, fmt, ...) \ 1160#define dev_level_ratelimited(dev_level, dev, fmt, ...) \
1162do { \ 1161do { \
@@ -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