diff options
-rw-r--r-- | drivers/base/core.c | 29 | ||||
-rw-r--r-- | drivers/base/firmware_class.c | 33 | ||||
-rw-r--r-- | fs/sysfs/group.c | 2 | ||||
-rw-r--r-- | include/linux/device.h | 62 |
4 files changed, 53 insertions, 73 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 97e2baf..07304a3 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, ...) } EXPORT_SYMBOL(dev_printk_emit); -static int __dev_printk(const char *level, const struct device *dev, +static void __dev_printk(const char *level, const struct device *dev, struct va_format *vaf) { - if (!dev) - return printk("%s(NULL device *): %pV", level, vaf); - - return dev_printk_emit(level[1] - '0', dev, - "%s %s: %pV", - dev_driver_string(dev), dev_name(dev), vaf); + if (dev) + dev_printk_emit(level[1] - '0', dev, "%s %s: %pV", + dev_driver_string(dev), dev_name(dev), vaf); + else + printk("%s(NULL device *): %pV", level, vaf); } -int dev_printk(const char *level, const struct device *dev, - const char *fmt, ...) +void dev_printk(const char *level, const struct device *dev, + const char *fmt, ...) { struct va_format vaf; va_list args; - int r; va_start(args, fmt); vaf.fmt = fmt; vaf.va = &args; - r = __dev_printk(level, dev, &vaf); + __dev_printk(level, dev, &vaf); va_end(args); - - return r; } EXPORT_SYMBOL(dev_printk); #define define_dev_printk_level(func, kern_level) \ -int func(const struct device *dev, const char *fmt, ...) \ +void func(const struct device *dev, const char *fmt, ...) \ { \ struct va_format vaf; \ va_list args; \ - int r; \ \ va_start(args, fmt); \ \ vaf.fmt = fmt; \ vaf.va = &args; \ \ - r = __dev_printk(kern_level, dev, &vaf); \ + __dev_printk(kern_level, dev, &vaf); \ \ va_end(args); \ - \ - return r; \ } \ EXPORT_SYMBOL(func); diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index c3293f0..6c5c9ed 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -94,7 +94,7 @@ static int loading_timeout = 60; /* In seconds */ static inline long firmware_loading_timeout(void) { - return loading_timeout > 0 ? loading_timeout * HZ : MAX_SCHEDULE_TIMEOUT; + return loading_timeout > 0 ? loading_timeout * HZ : MAX_JIFFY_OFFSET; } /* firmware behavior options */ @@ -446,7 +446,6 @@ static int fw_add_devm_name(struct device *dev, const char *name) */ #ifdef CONFIG_FW_LOADER_USER_HELPER struct firmware_priv { - struct delayed_work timeout_work; bool nowait; struct device dev; struct firmware_buf *buf; @@ -836,16 +835,6 @@ static struct bin_attribute firmware_attr_data = { .write = firmware_data_write, }; -static void firmware_class_timeout_work(struct work_struct *work) -{ - struct firmware_priv *fw_priv = container_of(work, - struct firmware_priv, timeout_work.work); - - mutex_lock(&fw_lock); - fw_load_abort(fw_priv); - mutex_unlock(&fw_lock); -} - static struct firmware_priv * fw_create_instance(struct firmware *firmware, const char *fw_name, struct device *device, unsigned int opt_flags) @@ -861,9 +850,6 @@ fw_create_instance(struct firmware *firmware, const char *fw_name, fw_priv->nowait = !!(opt_flags & FW_OPT_NOWAIT); fw_priv->fw = firmware; - INIT_DELAYED_WORK(&fw_priv->timeout_work, - firmware_class_timeout_work); - f_dev = &fw_priv->dev; device_initialize(f_dev); @@ -916,16 +902,19 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, buf->need_uevent = true; dev_set_uevent_suppress(f_dev, false); dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id); - if (timeout != MAX_SCHEDULE_TIMEOUT) - queue_delayed_work(system_power_efficient_wq, - &fw_priv->timeout_work, timeout); - kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); + } else { + timeout = MAX_JIFFY_OFFSET; } - retval = wait_for_completion_interruptible(&buf->completion); + retval = wait_for_completion_interruptible_timeout(&buf->completion, + timeout); + if (retval == -ERESTARTSYS || !retval) { + mutex_lock(&fw_lock); + fw_load_abort(fw_priv); + mutex_unlock(&fw_lock); + } - cancel_delayed_work_sync(&fw_priv->timeout_work); if (is_fw_load_aborted(buf)) retval = -EAGAIN; else if (!buf->data) @@ -1193,7 +1182,7 @@ request_firmware(const struct firmware **firmware_p, const char *name, EXPORT_SYMBOL(request_firmware); /** - * request_firmware: - load firmware directly without usermode helper + * request_firmware_direct: - load firmware directly without usermode helper * @firmware_p: pointer to firmware image * @name: name of firmware file * @device: device for which firmware is being loaded diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 7d2a860..2554d88 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, return -EINVAL; if (!grp->attrs && !grp->bin_attrs) { WARN(1, "sysfs: (bin_)attrs not set by subsystem for group: %s/%s\n", - kobj->name, grp->name ? "" : grp->name); + kobj->name, grp->name ?: ""); return -EINVAL; } if (grp->name) { diff --git a/include/linux/device.h b/include/linux/device.h index fb50673..0eb8ee2 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1038,22 +1038,22 @@ extern __printf(3, 4) int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); extern __printf(3, 4) -int dev_printk(const char *level, const struct device *dev, - const char *fmt, ...); +void dev_printk(const char *level, const struct device *dev, + const char *fmt, ...); extern __printf(2, 3) -int dev_emerg(const struct device *dev, const char *fmt, ...); +void dev_emerg(const struct device *dev, const char *fmt, ...); extern __printf(2, 3) -int dev_alert(const struct device *dev, const char *fmt, ...); +void dev_alert(const struct device *dev, const char *fmt, ...); extern __printf(2, 3) -int dev_crit(const struct device *dev, const char *fmt, ...); +void dev_crit(const struct device *dev, const char *fmt, ...); extern __printf(2, 3) -int dev_err(const struct device *dev, const char *fmt, ...); +void dev_err(const struct device *dev, const char *fmt, ...); extern __printf(2, 3) -int dev_warn(const struct device *dev, const char *fmt, ...); +void dev_warn(const struct device *dev, const char *fmt, ...); extern __printf(2, 3) -int dev_notice(const struct device *dev, const char *fmt, ...); +void dev_notice(const struct device *dev, const char *fmt, ...); extern __printf(2, 3) -int _dev_info(const struct device *dev, const char *fmt, ...); +void _dev_info(const struct device *dev, const char *fmt, ...); #else @@ -1065,35 +1065,35 @@ static inline __printf(3, 4) int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...) { return 0; } -static inline int __dev_printk(const char *level, const struct device *dev, - struct va_format *vaf) -{ return 0; } +static inline void __dev_printk(const char *level, const struct device *dev, + struct va_format *vaf) +{} static inline __printf(3, 4) -int dev_printk(const char *level, const struct device *dev, - const char *fmt, ...) -{ return 0; } +void dev_printk(const char *level, const struct device *dev, + const char *fmt, ...) +{} static inline __printf(2, 3) -int dev_emerg(const struct device *dev, const char *fmt, ...) -{ return 0; } +void dev_emerg(const struct device *dev, const char *fmt, ...) +{} static inline __printf(2, 3) -int dev_crit(const struct device *dev, const char *fmt, ...) -{ return 0; } +void dev_crit(const struct device *dev, const char *fmt, ...) +{} static inline __printf(2, 3) -int dev_alert(const struct device *dev, const char *fmt, ...) -{ return 0; } +void dev_alert(const struct device *dev, const char *fmt, ...) +{} static inline __printf(2, 3) -int dev_err(const struct device *dev, const char *fmt, ...) -{ return 0; } +void dev_err(const struct device *dev, const char *fmt, ...) +{} static inline __printf(2, 3) -int dev_warn(const struct device *dev, const char *fmt, ...) -{ return 0; } +void dev_warn(const struct device *dev, const char *fmt, ...) +{} static inline __printf(2, 3) -int dev_notice(const struct device *dev, const char *fmt, ...) -{ return 0; } +void dev_notice(const struct device *dev, const char *fmt, ...) +{} static inline __printf(2, 3) -int _dev_info(const struct device *dev, const char *fmt, ...) -{ return 0; } +void _dev_info(const struct device *dev, const char *fmt, ...) +{} #endif @@ -1119,7 +1119,6 @@ do { \ ({ \ if (0) \ dev_printk(KERN_DEBUG, dev, format, ##arg); \ - 0; \ }) #endif @@ -1156,7 +1155,7 @@ do { \ #define dev_info_once(dev, fmt, ...) \ dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__) #define dev_dbg_once(dev, fmt, ...) \ - dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__) + dev_level_once(dev_dbg, dev, fmt, ##__VA_ARGS__) #define dev_level_ratelimited(dev_level, dev, fmt, ...) \ do { \ @@ -1215,7 +1214,6 @@ do { \ ({ \ if (0) \ dev_printk(KERN_DEBUG, dev, format, ##arg); \ - 0; \ }) #endif |