diff options
Diffstat (limited to 'drivers/base/firmware_class.c')
| -rw-r--r-- | drivers/base/firmware_class.c | 266 |
1 files changed, 151 insertions, 115 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 81541452887b..8945f4e489ed 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
| @@ -36,68 +36,6 @@ MODULE_AUTHOR("Manuel Estrada Sainz"); | |||
| 36 | MODULE_DESCRIPTION("Multi purpose firmware loading support"); | 36 | MODULE_DESCRIPTION("Multi purpose firmware loading support"); |
| 37 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
| 38 | 38 | ||
| 39 | static const char *fw_path[] = { | ||
| 40 | "/lib/firmware/updates/" UTS_RELEASE, | ||
| 41 | "/lib/firmware/updates", | ||
| 42 | "/lib/firmware/" UTS_RELEASE, | ||
| 43 | "/lib/firmware" | ||
| 44 | }; | ||
| 45 | |||
| 46 | /* Don't inline this: 'struct kstat' is biggish */ | ||
| 47 | static noinline long fw_file_size(struct file *file) | ||
| 48 | { | ||
| 49 | struct kstat st; | ||
| 50 | if (vfs_getattr(file->f_path.mnt, file->f_path.dentry, &st)) | ||
| 51 | return -1; | ||
| 52 | if (!S_ISREG(st.mode)) | ||
| 53 | return -1; | ||
| 54 | if (st.size != (long)st.size) | ||
| 55 | return -1; | ||
| 56 | return st.size; | ||
| 57 | } | ||
| 58 | |||
| 59 | static bool fw_read_file_contents(struct file *file, struct firmware *fw) | ||
| 60 | { | ||
| 61 | long size; | ||
| 62 | char *buf; | ||
| 63 | |||
| 64 | size = fw_file_size(file); | ||
| 65 | if (size < 0) | ||
| 66 | return false; | ||
| 67 | buf = vmalloc(size); | ||
| 68 | if (!buf) | ||
| 69 | return false; | ||
| 70 | if (kernel_read(file, 0, buf, size) != size) { | ||
| 71 | vfree(buf); | ||
| 72 | return false; | ||
| 73 | } | ||
| 74 | fw->data = buf; | ||
| 75 | fw->size = size; | ||
| 76 | return true; | ||
| 77 | } | ||
| 78 | |||
| 79 | static bool fw_get_filesystem_firmware(struct firmware *fw, const char *name) | ||
| 80 | { | ||
| 81 | int i; | ||
| 82 | bool success = false; | ||
| 83 | char *path = __getname(); | ||
| 84 | |||
| 85 | for (i = 0; i < ARRAY_SIZE(fw_path); i++) { | ||
| 86 | struct file *file; | ||
| 87 | snprintf(path, PATH_MAX, "%s/%s", fw_path[i], name); | ||
| 88 | |||
| 89 | file = filp_open(path, O_RDONLY, 0); | ||
| 90 | if (IS_ERR(file)) | ||
| 91 | continue; | ||
| 92 | success = fw_read_file_contents(file, fw); | ||
| 93 | fput(file); | ||
| 94 | if (success) | ||
| 95 | break; | ||
| 96 | } | ||
| 97 | __putname(path); | ||
| 98 | return success; | ||
| 99 | } | ||
| 100 | |||
| 101 | /* Builtin firmware support */ | 39 | /* Builtin firmware support */ |
| 102 | 40 | ||
| 103 | #ifdef CONFIG_FW_LOADER | 41 | #ifdef CONFIG_FW_LOADER |
| @@ -150,6 +88,11 @@ enum { | |||
| 150 | FW_STATUS_ABORT, | 88 | FW_STATUS_ABORT, |
| 151 | }; | 89 | }; |
| 152 | 90 | ||
| 91 | enum fw_buf_fmt { | ||
| 92 | VMALLOC_BUF, /* used in direct loading */ | ||
| 93 | PAGE_BUF, /* used in loading via userspace */ | ||
| 94 | }; | ||
| 95 | |||
| 153 | static int loading_timeout = 60; /* In seconds */ | 96 | static int loading_timeout = 60; /* In seconds */ |
| 154 | 97 | ||
| 155 | static inline long firmware_loading_timeout(void) | 98 | static inline long firmware_loading_timeout(void) |
| @@ -173,8 +116,6 @@ struct firmware_cache { | |||
| 173 | spinlock_t name_lock; | 116 | spinlock_t name_lock; |
| 174 | struct list_head fw_names; | 117 | struct list_head fw_names; |
| 175 | 118 | ||
| 176 | wait_queue_head_t wait_queue; | ||
| 177 | int cnt; | ||
| 178 | struct delayed_work work; | 119 | struct delayed_work work; |
| 179 | 120 | ||
| 180 | struct notifier_block pm_notify; | 121 | struct notifier_block pm_notify; |
| @@ -187,6 +128,7 @@ struct firmware_buf { | |||
| 187 | struct completion completion; | 128 | struct completion completion; |
| 188 | struct firmware_cache *fwc; | 129 | struct firmware_cache *fwc; |
| 189 | unsigned long status; | 130 | unsigned long status; |
| 131 | enum fw_buf_fmt fmt; | ||
| 190 | void *data; | 132 | void *data; |
| 191 | size_t size; | 133 | size_t size; |
| 192 | struct page **pages; | 134 | struct page **pages; |
| @@ -240,6 +182,7 @@ static struct firmware_buf *__allocate_fw_buf(const char *fw_name, | |||
| 240 | strcpy(buf->fw_id, fw_name); | 182 | strcpy(buf->fw_id, fw_name); |
| 241 | buf->fwc = fwc; | 183 | buf->fwc = fwc; |
| 242 | init_completion(&buf->completion); | 184 | init_completion(&buf->completion); |
| 185 | buf->fmt = VMALLOC_BUF; | ||
| 243 | 186 | ||
| 244 | pr_debug("%s: fw-%s buf=%p\n", __func__, fw_name, buf); | 187 | pr_debug("%s: fw-%s buf=%p\n", __func__, fw_name, buf); |
| 245 | 188 | ||
| @@ -307,10 +250,14 @@ static void __fw_free_buf(struct kref *ref) | |||
| 307 | list_del(&buf->list); | 250 | list_del(&buf->list); |
| 308 | spin_unlock(&fwc->lock); | 251 | spin_unlock(&fwc->lock); |
| 309 | 252 | ||
| 310 | vunmap(buf->data); | 253 | |
| 311 | for (i = 0; i < buf->nr_pages; i++) | 254 | if (buf->fmt == PAGE_BUF) { |
| 312 | __free_page(buf->pages[i]); | 255 | vunmap(buf->data); |
| 313 | kfree(buf->pages); | 256 | for (i = 0; i < buf->nr_pages; i++) |
| 257 | __free_page(buf->pages[i]); | ||
| 258 | kfree(buf->pages); | ||
| 259 | } else | ||
| 260 | vfree(buf->data); | ||
| 314 | kfree(buf); | 261 | kfree(buf); |
| 315 | } | 262 | } |
| 316 | 263 | ||
| @@ -319,6 +266,69 @@ static void fw_free_buf(struct firmware_buf *buf) | |||
| 319 | kref_put(&buf->ref, __fw_free_buf); | 266 | kref_put(&buf->ref, __fw_free_buf); |
| 320 | } | 267 | } |
| 321 | 268 | ||
| 269 | /* direct firmware loading support */ | ||
| 270 | static const char *fw_path[] = { | ||
| 271 | "/lib/firmware/updates/" UTS_RELEASE, | ||
| 272 | "/lib/firmware/updates", | ||
| 273 | "/lib/firmware/" UTS_RELEASE, | ||
| 274 | "/lib/firmware" | ||
| 275 | }; | ||
| 276 | |||
| 277 | /* Don't inline this: 'struct kstat' is biggish */ | ||
| 278 | static noinline long fw_file_size(struct file *file) | ||
| 279 | { | ||
| 280 | struct kstat st; | ||
| 281 | if (vfs_getattr(file->f_path.mnt, file->f_path.dentry, &st)) | ||
| 282 | return -1; | ||
| 283 | if (!S_ISREG(st.mode)) | ||
| 284 | return -1; | ||
| 285 | if (st.size != (long)st.size) | ||
| 286 | return -1; | ||
| 287 | return st.size; | ||
| 288 | } | ||
| 289 | |||
| 290 | static bool fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf) | ||
| 291 | { | ||
| 292 | long size; | ||
| 293 | char *buf; | ||
| 294 | |||
| 295 | size = fw_file_size(file); | ||
| 296 | if (size < 0) | ||
| 297 | return false; | ||
| 298 | buf = vmalloc(size); | ||
| 299 | if (!buf) | ||
| 300 | return false; | ||
| 301 | if (kernel_read(file, 0, buf, size) != size) { | ||
| 302 | vfree(buf); | ||
| 303 | return false; | ||
| 304 | } | ||
| 305 | fw_buf->data = buf; | ||
| 306 | fw_buf->size = size; | ||
| 307 | return true; | ||
| 308 | } | ||
| 309 | |||
| 310 | static bool fw_get_filesystem_firmware(struct firmware_buf *buf) | ||
| 311 | { | ||
| 312 | int i; | ||
| 313 | bool success = false; | ||
| 314 | char *path = __getname(); | ||
| 315 | |||
| 316 | for (i = 0; i < ARRAY_SIZE(fw_path); i++) { | ||
| 317 | struct file *file; | ||
| 318 | snprintf(path, PATH_MAX, "%s/%s", fw_path[i], buf->fw_id); | ||
| 319 | |||
| 320 | file = filp_open(path, O_RDONLY, 0); | ||
| 321 | if (IS_ERR(file)) | ||
| 322 | continue; | ||
| 323 | success = fw_read_file_contents(file, buf); | ||
| 324 | fput(file); | ||
| 325 | if (success) | ||
| 326 | break; | ||
| 327 | } | ||
| 328 | __putname(path); | ||
| 329 | return success; | ||
| 330 | } | ||
| 331 | |||
| 322 | static struct firmware_priv *to_firmware_priv(struct device *dev) | 332 | static struct firmware_priv *to_firmware_priv(struct device *dev) |
| 323 | { | 333 | { |
| 324 | return container_of(dev, struct firmware_priv, dev); | 334 | return container_of(dev, struct firmware_priv, dev); |
| @@ -423,6 +433,21 @@ static void firmware_free_data(const struct firmware *fw) | |||
| 423 | #ifndef PAGE_KERNEL_RO | 433 | #ifndef PAGE_KERNEL_RO |
| 424 | #define PAGE_KERNEL_RO PAGE_KERNEL | 434 | #define PAGE_KERNEL_RO PAGE_KERNEL |
| 425 | #endif | 435 | #endif |
| 436 | |||
| 437 | /* one pages buffer should be mapped/unmapped only once */ | ||
| 438 | static int fw_map_pages_buf(struct firmware_buf *buf) | ||
| 439 | { | ||
| 440 | if (buf->fmt != PAGE_BUF) | ||
| 441 | return 0; | ||
| 442 | |||
| 443 | if (buf->data) | ||
| 444 | vunmap(buf->data); | ||
| 445 | buf->data = vmap(buf->pages, buf->nr_pages, 0, PAGE_KERNEL_RO); | ||
| 446 | if (!buf->data) | ||
| 447 | return -ENOMEM; | ||
| 448 | return 0; | ||
| 449 | } | ||
| 450 | |||
| 426 | /** | 451 | /** |
| 427 | * firmware_loading_store - set value in the 'loading' control file | 452 | * firmware_loading_store - set value in the 'loading' control file |
| 428 | * @dev: device pointer | 453 | * @dev: device pointer |
| @@ -467,6 +492,14 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
| 467 | if (test_bit(FW_STATUS_LOADING, &fw_buf->status)) { | 492 | if (test_bit(FW_STATUS_LOADING, &fw_buf->status)) { |
| 468 | set_bit(FW_STATUS_DONE, &fw_buf->status); | 493 | set_bit(FW_STATUS_DONE, &fw_buf->status); |
| 469 | clear_bit(FW_STATUS_LOADING, &fw_buf->status); | 494 | clear_bit(FW_STATUS_LOADING, &fw_buf->status); |
| 495 | |||
| 496 | /* | ||
| 497 | * Several loading requests may be pending on | ||
| 498 | * one same firmware buf, so let all requests | ||
| 499 | * see the mapped 'buf->data' once the loading | ||
| 500 | * is completed. | ||
| 501 | * */ | ||
| 502 | fw_map_pages_buf(fw_buf); | ||
| 470 | complete_all(&fw_buf->completion); | 503 | complete_all(&fw_buf->completion); |
| 471 | break; | 504 | break; |
| 472 | } | 505 | } |
| @@ -670,15 +703,6 @@ exit: | |||
| 670 | return fw_priv; | 703 | return fw_priv; |
| 671 | } | 704 | } |
| 672 | 705 | ||
| 673 | /* one pages buffer is mapped/unmapped only once */ | ||
| 674 | static int fw_map_pages_buf(struct firmware_buf *buf) | ||
| 675 | { | ||
| 676 | buf->data = vmap(buf->pages, buf->nr_pages, 0, PAGE_KERNEL_RO); | ||
| 677 | if (!buf->data) | ||
| 678 | return -ENOMEM; | ||
| 679 | return 0; | ||
| 680 | } | ||
| 681 | |||
| 682 | /* store the pages buffer info firmware from buf */ | 706 | /* store the pages buffer info firmware from buf */ |
| 683 | static void fw_set_page_data(struct firmware_buf *buf, struct firmware *fw) | 707 | static void fw_set_page_data(struct firmware_buf *buf, struct firmware *fw) |
| 684 | { | 708 | { |
| @@ -778,11 +802,6 @@ _request_firmware_prepare(const struct firmware **firmware_p, const char *name, | |||
| 778 | return NULL; | 802 | return NULL; |
| 779 | } | 803 | } |
| 780 | 804 | ||
| 781 | if (fw_get_filesystem_firmware(firmware, name)) { | ||
| 782 | dev_dbg(device, "firmware: direct-loading firmware %s\n", name); | ||
| 783 | return NULL; | ||
| 784 | } | ||
| 785 | |||
| 786 | ret = fw_lookup_and_allocate_buf(name, &fw_cache, &buf); | 805 | ret = fw_lookup_and_allocate_buf(name, &fw_cache, &buf); |
| 787 | if (!ret) | 806 | if (!ret) |
| 788 | fw_priv = fw_create_instance(firmware, name, device, | 807 | fw_priv = fw_create_instance(firmware, name, device, |
| @@ -832,6 +851,21 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
| 832 | struct device *f_dev = &fw_priv->dev; | 851 | struct device *f_dev = &fw_priv->dev; |
| 833 | struct firmware_buf *buf = fw_priv->buf; | 852 | struct firmware_buf *buf = fw_priv->buf; |
| 834 | struct firmware_cache *fwc = &fw_cache; | 853 | struct firmware_cache *fwc = &fw_cache; |
| 854 | int direct_load = 0; | ||
| 855 | |||
| 856 | /* try direct loading from fs first */ | ||
| 857 | if (fw_get_filesystem_firmware(buf)) { | ||
| 858 | dev_dbg(f_dev->parent, "firmware: direct-loading" | ||
| 859 | " firmware %s\n", buf->fw_id); | ||
| 860 | |||
| 861 | set_bit(FW_STATUS_DONE, &buf->status); | ||
| 862 | complete_all(&buf->completion); | ||
| 863 | direct_load = 1; | ||
| 864 | goto handle_fw; | ||
| 865 | } | ||
| 866 | |||
| 867 | /* fall back on userspace loading */ | ||
| 868 | buf->fmt = PAGE_BUF; | ||
| 835 | 869 | ||
| 836 | dev_set_uevent_suppress(f_dev, true); | 870 | dev_set_uevent_suppress(f_dev, true); |
| 837 | 871 | ||
| @@ -870,6 +904,7 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
| 870 | 904 | ||
| 871 | del_timer_sync(&fw_priv->timeout); | 905 | del_timer_sync(&fw_priv->timeout); |
| 872 | 906 | ||
| 907 | handle_fw: | ||
| 873 | mutex_lock(&fw_lock); | 908 | mutex_lock(&fw_lock); |
| 874 | if (!buf->size || test_bit(FW_STATUS_ABORT, &buf->status)) | 909 | if (!buf->size || test_bit(FW_STATUS_ABORT, &buf->status)) |
| 875 | retval = -ENOENT; | 910 | retval = -ENOENT; |
| @@ -884,9 +919,6 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
| 884 | if (!retval && f_dev->parent) | 919 | if (!retval && f_dev->parent) |
| 885 | fw_add_devm_name(f_dev->parent, buf->fw_id); | 920 | fw_add_devm_name(f_dev->parent, buf->fw_id); |
| 886 | 921 | ||
| 887 | if (!retval) | ||
| 888 | retval = fw_map_pages_buf(buf); | ||
| 889 | |||
| 890 | /* | 922 | /* |
| 891 | * After caching firmware image is started, let it piggyback | 923 | * After caching firmware image is started, let it piggyback |
| 892 | * on request firmware. | 924 | * on request firmware. |
| @@ -902,6 +934,9 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
| 902 | fw_priv->buf = NULL; | 934 | fw_priv->buf = NULL; |
| 903 | mutex_unlock(&fw_lock); | 935 | mutex_unlock(&fw_lock); |
| 904 | 936 | ||
| 937 | if (direct_load) | ||
| 938 | goto err_put_dev; | ||
| 939 | |||
| 905 | device_remove_file(f_dev, &dev_attr_loading); | 940 | device_remove_file(f_dev, &dev_attr_loading); |
| 906 | err_del_bin_attr: | 941 | err_del_bin_attr: |
| 907 | device_remove_bin_file(f_dev, &firmware_attr_data); | 942 | device_remove_bin_file(f_dev, &firmware_attr_data); |
| @@ -1129,6 +1164,8 @@ int uncache_firmware(const char *fw_name) | |||
| 1129 | } | 1164 | } |
| 1130 | 1165 | ||
| 1131 | #ifdef CONFIG_PM_SLEEP | 1166 | #ifdef CONFIG_PM_SLEEP |
| 1167 | static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain); | ||
| 1168 | |||
| 1132 | static struct fw_cache_entry *alloc_fw_cache_entry(const char *name) | 1169 | static struct fw_cache_entry *alloc_fw_cache_entry(const char *name) |
| 1133 | { | 1170 | { |
| 1134 | struct fw_cache_entry *fce; | 1171 | struct fw_cache_entry *fce; |
| @@ -1142,17 +1179,27 @@ exit: | |||
| 1142 | return fce; | 1179 | return fce; |
| 1143 | } | 1180 | } |
| 1144 | 1181 | ||
| 1145 | static int fw_cache_piggyback_on_request(const char *name) | 1182 | static int __fw_entry_found(const char *name) |
| 1146 | { | 1183 | { |
| 1147 | struct firmware_cache *fwc = &fw_cache; | 1184 | struct firmware_cache *fwc = &fw_cache; |
| 1148 | struct fw_cache_entry *fce; | 1185 | struct fw_cache_entry *fce; |
| 1149 | int ret = 0; | ||
| 1150 | 1186 | ||
| 1151 | spin_lock(&fwc->name_lock); | ||
| 1152 | list_for_each_entry(fce, &fwc->fw_names, list) { | 1187 | list_for_each_entry(fce, &fwc->fw_names, list) { |
| 1153 | if (!strcmp(fce->name, name)) | 1188 | if (!strcmp(fce->name, name)) |
| 1154 | goto found; | 1189 | return 1; |
| 1155 | } | 1190 | } |
| 1191 | return 0; | ||
| 1192 | } | ||
| 1193 | |||
| 1194 | static int fw_cache_piggyback_on_request(const char *name) | ||
| 1195 | { | ||
| 1196 | struct firmware_cache *fwc = &fw_cache; | ||
| 1197 | struct fw_cache_entry *fce; | ||
| 1198 | int ret = 0; | ||
| 1199 | |||
| 1200 | spin_lock(&fwc->name_lock); | ||
| 1201 | if (__fw_entry_found(name)) | ||
| 1202 | goto found; | ||
| 1156 | 1203 | ||
| 1157 | fce = alloc_fw_cache_entry(name); | 1204 | fce = alloc_fw_cache_entry(name); |
| 1158 | if (fce) { | 1205 | if (fce) { |
| @@ -1185,12 +1232,6 @@ static void __async_dev_cache_fw_image(void *fw_entry, | |||
| 1185 | 1232 | ||
| 1186 | free_fw_cache_entry(fce); | 1233 | free_fw_cache_entry(fce); |
| 1187 | } | 1234 | } |
| 1188 | |||
| 1189 | spin_lock(&fwc->name_lock); | ||
| 1190 | fwc->cnt--; | ||
| 1191 | spin_unlock(&fwc->name_lock); | ||
| 1192 | |||
| 1193 | wake_up(&fwc->wait_queue); | ||
| 1194 | } | 1235 | } |
| 1195 | 1236 | ||
| 1196 | /* called with dev->devres_lock held */ | 1237 | /* called with dev->devres_lock held */ |
| @@ -1229,11 +1270,19 @@ static void dev_cache_fw_image(struct device *dev, void *data) | |||
| 1229 | list_del(&fce->list); | 1270 | list_del(&fce->list); |
| 1230 | 1271 | ||
| 1231 | spin_lock(&fwc->name_lock); | 1272 | spin_lock(&fwc->name_lock); |
| 1232 | fwc->cnt++; | 1273 | /* only one cache entry for one firmware */ |
| 1233 | list_add(&fce->list, &fwc->fw_names); | 1274 | if (!__fw_entry_found(fce->name)) { |
| 1275 | list_add(&fce->list, &fwc->fw_names); | ||
| 1276 | } else { | ||
| 1277 | free_fw_cache_entry(fce); | ||
| 1278 | fce = NULL; | ||
| 1279 | } | ||
| 1234 | spin_unlock(&fwc->name_lock); | 1280 | spin_unlock(&fwc->name_lock); |
| 1235 | 1281 | ||
| 1236 | async_schedule(__async_dev_cache_fw_image, (void *)fce); | 1282 | if (fce) |
| 1283 | async_schedule_domain(__async_dev_cache_fw_image, | ||
| 1284 | (void *)fce, | ||
| 1285 | &fw_cache_domain); | ||
| 1237 | } | 1286 | } |
| 1238 | } | 1287 | } |
| 1239 | 1288 | ||
| @@ -1275,6 +1324,9 @@ static void device_cache_fw_images(void) | |||
| 1275 | 1324 | ||
| 1276 | pr_debug("%s\n", __func__); | 1325 | pr_debug("%s\n", __func__); |
| 1277 | 1326 | ||
| 1327 | /* cancel uncache work */ | ||
| 1328 | cancel_delayed_work_sync(&fwc->work); | ||
| 1329 | |||
| 1278 | /* | 1330 | /* |
| 1279 | * use small loading timeout for caching devices' firmware | 1331 | * use small loading timeout for caching devices' firmware |
| 1280 | * because all these firmware images have been loaded | 1332 | * because all these firmware images have been loaded |
| @@ -1292,21 +1344,7 @@ static void device_cache_fw_images(void) | |||
| 1292 | mutex_unlock(&fw_lock); | 1344 | mutex_unlock(&fw_lock); |
| 1293 | 1345 | ||
| 1294 | /* wait for completion of caching firmware for all devices */ | 1346 | /* wait for completion of caching firmware for all devices */ |
| 1295 | spin_lock(&fwc->name_lock); | 1347 | async_synchronize_full_domain(&fw_cache_domain); |
| 1296 | for (;;) { | ||
| 1297 | prepare_to_wait(&fwc->wait_queue, &wait, | ||
| 1298 | TASK_UNINTERRUPTIBLE); | ||
| 1299 | if (!fwc->cnt) | ||
| 1300 | break; | ||
| 1301 | |||
| 1302 | spin_unlock(&fwc->name_lock); | ||
| 1303 | |||
| 1304 | schedule(); | ||
| 1305 | |||
| 1306 | spin_lock(&fwc->name_lock); | ||
| 1307 | } | ||
| 1308 | spin_unlock(&fwc->name_lock); | ||
| 1309 | finish_wait(&fwc->wait_queue, &wait); | ||
| 1310 | 1348 | ||
| 1311 | loading_timeout = old_timeout; | 1349 | loading_timeout = old_timeout; |
| 1312 | } | 1350 | } |
| @@ -1394,9 +1432,7 @@ static void __init fw_cache_init(void) | |||
| 1394 | #ifdef CONFIG_PM_SLEEP | 1432 | #ifdef CONFIG_PM_SLEEP |
| 1395 | spin_lock_init(&fw_cache.name_lock); | 1433 | spin_lock_init(&fw_cache.name_lock); |
| 1396 | INIT_LIST_HEAD(&fw_cache.fw_names); | 1434 | INIT_LIST_HEAD(&fw_cache.fw_names); |
| 1397 | fw_cache.cnt = 0; | ||
| 1398 | 1435 | ||
| 1399 | init_waitqueue_head(&fw_cache.wait_queue); | ||
| 1400 | INIT_DELAYED_WORK(&fw_cache.work, | 1436 | INIT_DELAYED_WORK(&fw_cache.work, |
| 1401 | device_uncache_fw_images_work); | 1437 | device_uncache_fw_images_work); |
| 1402 | 1438 | ||
