提交 9682ec96 编写于 作者: L Linus Torvalds

Merge tag 'driver-core-3.20-rc1' of...

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
...@@ -2080,54 +2080,47 @@ int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...) ...@@ -2080,54 +2080,47 @@ int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
} }
EXPORT_SYMBOL(dev_printk_emit); 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) struct va_format *vaf)
{ {
if (!dev) if (dev)
return printk("%s(NULL device *): %pV", level, vaf); dev_printk_emit(level[1] - '0', dev, "%s %s: %pV",
dev_driver_string(dev), dev_name(dev), vaf);
return dev_printk_emit(level[1] - '0', dev, else
"%s %s: %pV", printk("%s(NULL device *): %pV", level, vaf);
dev_driver_string(dev), dev_name(dev), vaf);
} }
int dev_printk(const char *level, const struct device *dev, void dev_printk(const char *level, const struct device *dev,
const char *fmt, ...) const char *fmt, ...)
{ {
struct va_format vaf; struct va_format vaf;
va_list args; va_list args;
int r;
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
r = __dev_printk(level, dev, &vaf); __dev_printk(level, dev, &vaf);
va_end(args); va_end(args);
return r;
} }
EXPORT_SYMBOL(dev_printk); EXPORT_SYMBOL(dev_printk);
#define define_dev_printk_level(func, kern_level) \ #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; \ struct va_format vaf; \
va_list args; \ va_list args; \
int r; \
\ \
va_start(args, fmt); \ va_start(args, fmt); \
\ \
vaf.fmt = fmt; \ vaf.fmt = fmt; \
vaf.va = &args; \ vaf.va = &args; \
\ \
r = __dev_printk(kern_level, dev, &vaf); \ __dev_printk(kern_level, dev, &vaf); \
\ \
va_end(args); \ va_end(args); \
\
return r; \
} \ } \
EXPORT_SYMBOL(func); EXPORT_SYMBOL(func);
......
...@@ -94,7 +94,7 @@ static int loading_timeout = 60; /* In seconds */ ...@@ -94,7 +94,7 @@ static int loading_timeout = 60; /* In seconds */
static inline long firmware_loading_timeout(void) 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 */ /* firmware behavior options */
...@@ -446,7 +446,6 @@ static int fw_add_devm_name(struct device *dev, const char *name) ...@@ -446,7 +446,6 @@ static int fw_add_devm_name(struct device *dev, const char *name)
*/ */
#ifdef CONFIG_FW_LOADER_USER_HELPER #ifdef CONFIG_FW_LOADER_USER_HELPER
struct firmware_priv { struct firmware_priv {
struct delayed_work timeout_work;
bool nowait; bool nowait;
struct device dev; struct device dev;
struct firmware_buf *buf; struct firmware_buf *buf;
...@@ -836,16 +835,6 @@ static struct bin_attribute firmware_attr_data = { ...@@ -836,16 +835,6 @@ static struct bin_attribute firmware_attr_data = {
.write = firmware_data_write, .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 * static struct firmware_priv *
fw_create_instance(struct firmware *firmware, const char *fw_name, fw_create_instance(struct firmware *firmware, const char *fw_name,
struct device *device, unsigned int opt_flags) struct device *device, unsigned int opt_flags)
...@@ -861,9 +850,6 @@ fw_create_instance(struct firmware *firmware, const char *fw_name, ...@@ -861,9 +850,6 @@ fw_create_instance(struct firmware *firmware, const char *fw_name,
fw_priv->nowait = !!(opt_flags & FW_OPT_NOWAIT); fw_priv->nowait = !!(opt_flags & FW_OPT_NOWAIT);
fw_priv->fw = firmware; fw_priv->fw = firmware;
INIT_DELAYED_WORK(&fw_priv->timeout_work,
firmware_class_timeout_work);
f_dev = &fw_priv->dev; f_dev = &fw_priv->dev;
device_initialize(f_dev); device_initialize(f_dev);
...@@ -916,16 +902,19 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, ...@@ -916,16 +902,19 @@ static int _request_firmware_load(struct firmware_priv *fw_priv,
buf->need_uevent = true; buf->need_uevent = true;
dev_set_uevent_suppress(f_dev, false); dev_set_uevent_suppress(f_dev, false);
dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id); 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); 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)) if (is_fw_load_aborted(buf))
retval = -EAGAIN; retval = -EAGAIN;
else if (!buf->data) else if (!buf->data)
...@@ -1193,7 +1182,7 @@ request_firmware(const struct firmware **firmware_p, const char *name, ...@@ -1193,7 +1182,7 @@ request_firmware(const struct firmware **firmware_p, const char *name,
EXPORT_SYMBOL(request_firmware); 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 * @firmware_p: pointer to firmware image
* @name: name of firmware file * @name: name of firmware file
* @device: device for which firmware is being loaded * @device: device for which firmware is being loaded
......
...@@ -99,7 +99,7 @@ static int internal_create_group(struct kobject *kobj, int update, ...@@ -99,7 +99,7 @@ static int internal_create_group(struct kobject *kobj, int update,
return -EINVAL; return -EINVAL;
if (!grp->attrs && !grp->bin_attrs) { if (!grp->attrs && !grp->bin_attrs) {
WARN(1, "sysfs: (bin_)attrs not set by subsystem for group: %s/%s\n", 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; return -EINVAL;
} }
if (grp->name) { if (grp->name) {
......
...@@ -1038,22 +1038,22 @@ extern __printf(3, 4) ...@@ -1038,22 +1038,22 @@ extern __printf(3, 4)
int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
extern __printf(3, 4) extern __printf(3, 4)
int dev_printk(const char *level, const struct device *dev, void dev_printk(const char *level, const struct device *dev,
const char *fmt, ...); const char *fmt, ...);
extern __printf(2, 3) 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) 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) 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) 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) 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) 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) 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 #else
...@@ -1065,35 +1065,35 @@ static inline __printf(3, 4) ...@@ -1065,35 +1065,35 @@ static inline __printf(3, 4)
int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...) int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
{ return 0; } { return 0; }
static inline int __dev_printk(const char *level, const struct device *dev, static inline void __dev_printk(const char *level, const struct device *dev,
struct va_format *vaf) struct va_format *vaf)
{ return 0; } {}
static inline __printf(3, 4) static inline __printf(3, 4)
int dev_printk(const char *level, const struct device *dev, void dev_printk(const char *level, const struct device *dev,
const char *fmt, ...) const char *fmt, ...)
{ return 0; } {}
static inline __printf(2, 3) static inline __printf(2, 3)
int dev_emerg(const struct device *dev, const char *fmt, ...) void dev_emerg(const struct device *dev, const char *fmt, ...)
{ return 0; } {}
static inline __printf(2, 3) static inline __printf(2, 3)
int dev_crit(const struct device *dev, const char *fmt, ...) void dev_crit(const struct device *dev, const char *fmt, ...)
{ return 0; } {}
static inline __printf(2, 3) static inline __printf(2, 3)
int dev_alert(const struct device *dev, const char *fmt, ...) void dev_alert(const struct device *dev, const char *fmt, ...)
{ return 0; } {}
static inline __printf(2, 3) static inline __printf(2, 3)
int dev_err(const struct device *dev, const char *fmt, ...) void dev_err(const struct device *dev, const char *fmt, ...)
{ return 0; } {}
static inline __printf(2, 3) static inline __printf(2, 3)
int dev_warn(const struct device *dev, const char *fmt, ...) void dev_warn(const struct device *dev, const char *fmt, ...)
{ return 0; } {}
static inline __printf(2, 3) static inline __printf(2, 3)
int dev_notice(const struct device *dev, const char *fmt, ...) void dev_notice(const struct device *dev, const char *fmt, ...)
{ return 0; } {}
static inline __printf(2, 3) static inline __printf(2, 3)
int _dev_info(const struct device *dev, const char *fmt, ...) void _dev_info(const struct device *dev, const char *fmt, ...)
{ return 0; } {}
#endif #endif
...@@ -1119,7 +1119,6 @@ do { \ ...@@ -1119,7 +1119,6 @@ do { \
({ \ ({ \
if (0) \ if (0) \
dev_printk(KERN_DEBUG, dev, format, ##arg); \ dev_printk(KERN_DEBUG, dev, format, ##arg); \
0; \
}) })
#endif #endif
...@@ -1156,7 +1155,7 @@ do { \ ...@@ -1156,7 +1155,7 @@ do { \
#define dev_info_once(dev, fmt, ...) \ #define dev_info_once(dev, fmt, ...) \
dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__) dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__)
#define dev_dbg_once(dev, fmt, ...) \ #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, ...) \ #define dev_level_ratelimited(dev_level, dev, fmt, ...) \
do { \ do { \
...@@ -1215,7 +1214,6 @@ do { \ ...@@ -1215,7 +1214,6 @@ do { \
({ \ ({ \
if (0) \ if (0) \
dev_printk(KERN_DEBUG, dev, format, ##arg); \ dev_printk(KERN_DEBUG, dev, format, ##arg); \
0; \
}) })
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册