diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-15 14:11:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-15 14:11:47 -0500 |
commit | 9682ec9692e5ac11c6caebd079324e727b19e7ce (patch) | |
tree | 16b25351557cd028913fc2c225e2db0175d750b6 /drivers/base/firmware_class.c | |
parent | 4ba63072b998cc31515cc6305c25f3b808b50c01 (diff) | |
parent | adf305f77878880fa5868a7179979da93be68d83 (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
Diffstat (limited to 'drivers/base/firmware_class.c')
-rw-r--r-- | drivers/base/firmware_class.c | 33 |
1 files changed, 11 insertions, 22 deletions
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 | ||
95 | static inline long firmware_loading_timeout(void) | 95 | static 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 |
448 | struct firmware_priv { | 448 | struct 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 | ||
839 | static 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 | |||
849 | static struct firmware_priv * | 838 | static struct firmware_priv * |
850 | fw_create_instance(struct firmware *firmware, const char *fw_name, | 839 | fw_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, | |||
1193 | EXPORT_SYMBOL(request_firmware); | 1182 | EXPORT_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 |