OSDN Git Service

firmware loader: simplify pages ownership transfer
[uclinux-h8/linux.git] / drivers / base / firmware_class.c
1 /*
2  * firmware_class.c - Multi purpose firmware loading support
3  *
4  * Copyright (c) 2003 Manuel Estrada Sainz
5  *
6  * Please see Documentation/firmware_class/ for more information.
7  *
8  */
9
10 #include <linux/capability.h>
11 #include <linux/device.h>
12 #include <linux/module.h>
13 #include <linux/init.h>
14 #include <linux/timer.h>
15 #include <linux/vmalloc.h>
16 #include <linux/interrupt.h>
17 #include <linux/bitops.h>
18 #include <linux/mutex.h>
19 #include <linux/workqueue.h>
20 #include <linux/highmem.h>
21 #include <linux/firmware.h>
22 #include <linux/slab.h>
23 #include <linux/sched.h>
24
25 MODULE_AUTHOR("Manuel Estrada Sainz");
26 MODULE_DESCRIPTION("Multi purpose firmware loading support");
27 MODULE_LICENSE("GPL");
28
29 /* Builtin firmware support */
30
31 #ifdef CONFIG_FW_LOADER
32
33 extern struct builtin_fw __start_builtin_fw[];
34 extern struct builtin_fw __end_builtin_fw[];
35
36 static bool fw_get_builtin_firmware(struct firmware *fw, const char *name)
37 {
38         struct builtin_fw *b_fw;
39
40         for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) {
41                 if (strcmp(name, b_fw->name) == 0) {
42                         fw->size = b_fw->size;
43                         fw->data = b_fw->data;
44                         return true;
45                 }
46         }
47
48         return false;
49 }
50
51 static bool fw_is_builtin_firmware(const struct firmware *fw)
52 {
53         struct builtin_fw *b_fw;
54
55         for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++)
56                 if (fw->data == b_fw->data)
57                         return true;
58
59         return false;
60 }
61
62 #else /* Module case - no builtin firmware support */
63
64 static inline bool fw_get_builtin_firmware(struct firmware *fw, const char *name)
65 {
66         return false;
67 }
68
69 static inline bool fw_is_builtin_firmware(const struct firmware *fw)
70 {
71         return false;
72 }
73 #endif
74
75 enum {
76         FW_STATUS_LOADING,
77         FW_STATUS_DONE,
78         FW_STATUS_ABORT,
79 };
80
81 static int loading_timeout = 60;        /* In seconds */
82
83 static inline long firmware_loading_timeout(void)
84 {
85         return loading_timeout > 0 ? loading_timeout * HZ : MAX_SCHEDULE_TIMEOUT;
86 }
87
88 /* fw_lock could be moved to 'struct firmware_priv' but since it is just
89  * guarding for corner cases a global lock should be OK */
90 static DEFINE_MUTEX(fw_lock);
91
92 struct firmware_priv {
93         struct completion completion;
94         struct firmware *fw;
95         unsigned long status;
96         void *data;
97         size_t size;
98         struct page **pages;
99         int nr_pages;
100         int page_array_size;
101         struct timer_list timeout;
102         struct device dev;
103         bool nowait;
104         char fw_id[];
105 };
106
107 static struct firmware_priv *to_firmware_priv(struct device *dev)
108 {
109         return container_of(dev, struct firmware_priv, dev);
110 }
111
112 static void fw_load_abort(struct firmware_priv *fw_priv)
113 {
114         set_bit(FW_STATUS_ABORT, &fw_priv->status);
115         wmb();
116         complete(&fw_priv->completion);
117 }
118
119 static ssize_t firmware_timeout_show(struct class *class,
120                                      struct class_attribute *attr,
121                                      char *buf)
122 {
123         return sprintf(buf, "%d\n", loading_timeout);
124 }
125
126 /**
127  * firmware_timeout_store - set number of seconds to wait for firmware
128  * @class: device class pointer
129  * @attr: device attribute pointer
130  * @buf: buffer to scan for timeout value
131  * @count: number of bytes in @buf
132  *
133  *      Sets the number of seconds to wait for the firmware.  Once
134  *      this expires an error will be returned to the driver and no
135  *      firmware will be provided.
136  *
137  *      Note: zero means 'wait forever'.
138  **/
139 static ssize_t firmware_timeout_store(struct class *class,
140                                       struct class_attribute *attr,
141                                       const char *buf, size_t count)
142 {
143         loading_timeout = simple_strtol(buf, NULL, 10);
144         if (loading_timeout < 0)
145                 loading_timeout = 0;
146
147         return count;
148 }
149
150 static struct class_attribute firmware_class_attrs[] = {
151         __ATTR(timeout, S_IWUSR | S_IRUGO,
152                 firmware_timeout_show, firmware_timeout_store),
153         __ATTR_NULL
154 };
155
156 static void fw_dev_release(struct device *dev)
157 {
158         struct firmware_priv *fw_priv = to_firmware_priv(dev);
159         int i;
160
161         /* free untransfered pages buffer */
162         for (i = 0; i < fw_priv->nr_pages; i++)
163                 __free_page(fw_priv->pages[i]);
164         kfree(fw_priv->pages);
165
166         kfree(fw_priv);
167
168         module_put(THIS_MODULE);
169 }
170
171 static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
172 {
173         struct firmware_priv *fw_priv = to_firmware_priv(dev);
174
175         if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->fw_id))
176                 return -ENOMEM;
177         if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout))
178                 return -ENOMEM;
179         if (add_uevent_var(env, "ASYNC=%d", fw_priv->nowait))
180                 return -ENOMEM;
181
182         return 0;
183 }
184
185 static struct class firmware_class = {
186         .name           = "firmware",
187         .class_attrs    = firmware_class_attrs,
188         .dev_uevent     = firmware_uevent,
189         .dev_release    = fw_dev_release,
190 };
191
192 static ssize_t firmware_loading_show(struct device *dev,
193                                      struct device_attribute *attr, char *buf)
194 {
195         struct firmware_priv *fw_priv = to_firmware_priv(dev);
196         int loading = test_bit(FW_STATUS_LOADING, &fw_priv->status);
197
198         return sprintf(buf, "%d\n", loading);
199 }
200
201 /* firmware holds the ownership of pages */
202 static void firmware_free_data(const struct firmware *fw)
203 {
204         int i;
205         vunmap(fw->data);
206         if (fw->pages) {
207                 for (i = 0; i < PFN_UP(fw->size); i++)
208                         __free_page(fw->pages[i]);
209                 kfree(fw->pages);
210         }
211 }
212
213 /* Some architectures don't have PAGE_KERNEL_RO */
214 #ifndef PAGE_KERNEL_RO
215 #define PAGE_KERNEL_RO PAGE_KERNEL
216 #endif
217 /**
218  * firmware_loading_store - set value in the 'loading' control file
219  * @dev: device pointer
220  * @attr: device attribute pointer
221  * @buf: buffer to scan for loading control value
222  * @count: number of bytes in @buf
223  *
224  *      The relevant values are:
225  *
226  *       1: Start a load, discarding any previous partial load.
227  *       0: Conclude the load and hand the data to the driver code.
228  *      -1: Conclude the load with an error and discard any written data.
229  **/
230 static ssize_t firmware_loading_store(struct device *dev,
231                                       struct device_attribute *attr,
232                                       const char *buf, size_t count)
233 {
234         struct firmware_priv *fw_priv = to_firmware_priv(dev);
235         int loading = simple_strtol(buf, NULL, 10);
236         int i;
237
238         mutex_lock(&fw_lock);
239
240         if (!fw_priv->fw)
241                 goto out;
242
243         switch (loading) {
244         case 1:
245                 /* discarding any previous partial load */
246                 for (i = 0; i < fw_priv->nr_pages; i++)
247                         __free_page(fw_priv->pages[i]);
248                 kfree(fw_priv->pages);
249                 fw_priv->pages = NULL;
250                 fw_priv->page_array_size = 0;
251                 fw_priv->nr_pages = 0;
252                 set_bit(FW_STATUS_LOADING, &fw_priv->status);
253                 break;
254         case 0:
255                 if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) {
256                         complete(&fw_priv->completion);
257                         clear_bit(FW_STATUS_LOADING, &fw_priv->status);
258                         break;
259                 }
260                 /* fallthrough */
261         default:
262                 dev_err(dev, "%s: unexpected value (%d)\n", __func__, loading);
263                 /* fallthrough */
264         case -1:
265                 fw_load_abort(fw_priv);
266                 break;
267         }
268 out:
269         mutex_unlock(&fw_lock);
270         return count;
271 }
272
273 static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store);
274
275 static ssize_t firmware_data_read(struct file *filp, struct kobject *kobj,
276                                   struct bin_attribute *bin_attr,
277                                   char *buffer, loff_t offset, size_t count)
278 {
279         struct device *dev = kobj_to_dev(kobj);
280         struct firmware_priv *fw_priv = to_firmware_priv(dev);
281         struct firmware *fw;
282         ssize_t ret_count;
283
284         mutex_lock(&fw_lock);
285         fw = fw_priv->fw;
286         if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) {
287                 ret_count = -ENODEV;
288                 goto out;
289         }
290         if (offset > fw_priv->size) {
291                 ret_count = 0;
292                 goto out;
293         }
294         if (count > fw_priv->size - offset)
295                 count = fw_priv->size - offset;
296
297         ret_count = count;
298
299         while (count) {
300                 void *page_data;
301                 int page_nr = offset >> PAGE_SHIFT;
302                 int page_ofs = offset & (PAGE_SIZE-1);
303                 int page_cnt = min_t(size_t, PAGE_SIZE - page_ofs, count);
304
305                 page_data = kmap(fw_priv->pages[page_nr]);
306
307                 memcpy(buffer, page_data + page_ofs, page_cnt);
308
309                 kunmap(fw_priv->pages[page_nr]);
310                 buffer += page_cnt;
311                 offset += page_cnt;
312                 count -= page_cnt;
313         }
314 out:
315         mutex_unlock(&fw_lock);
316         return ret_count;
317 }
318
319 static int fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size)
320 {
321         int pages_needed = ALIGN(min_size, PAGE_SIZE) >> PAGE_SHIFT;
322
323         /* If the array of pages is too small, grow it... */
324         if (fw_priv->page_array_size < pages_needed) {
325                 int new_array_size = max(pages_needed,
326                                          fw_priv->page_array_size * 2);
327                 struct page **new_pages;
328
329                 new_pages = kmalloc(new_array_size * sizeof(void *),
330                                     GFP_KERNEL);
331                 if (!new_pages) {
332                         fw_load_abort(fw_priv);
333                         return -ENOMEM;
334                 }
335                 memcpy(new_pages, fw_priv->pages,
336                        fw_priv->page_array_size * sizeof(void *));
337                 memset(&new_pages[fw_priv->page_array_size], 0, sizeof(void *) *
338                        (new_array_size - fw_priv->page_array_size));
339                 kfree(fw_priv->pages);
340                 fw_priv->pages = new_pages;
341                 fw_priv->page_array_size = new_array_size;
342         }
343
344         while (fw_priv->nr_pages < pages_needed) {
345                 fw_priv->pages[fw_priv->nr_pages] =
346                         alloc_page(GFP_KERNEL | __GFP_HIGHMEM);
347
348                 if (!fw_priv->pages[fw_priv->nr_pages]) {
349                         fw_load_abort(fw_priv);
350                         return -ENOMEM;
351                 }
352                 fw_priv->nr_pages++;
353         }
354         return 0;
355 }
356
357 /**
358  * firmware_data_write - write method for firmware
359  * @filp: open sysfs file
360  * @kobj: kobject for the device
361  * @bin_attr: bin_attr structure
362  * @buffer: buffer being written
363  * @offset: buffer offset for write in total data store area
364  * @count: buffer size
365  *
366  *      Data written to the 'data' attribute will be later handed to
367  *      the driver as a firmware image.
368  **/
369 static ssize_t firmware_data_write(struct file *filp, struct kobject *kobj,
370                                    struct bin_attribute *bin_attr,
371                                    char *buffer, loff_t offset, size_t count)
372 {
373         struct device *dev = kobj_to_dev(kobj);
374         struct firmware_priv *fw_priv = to_firmware_priv(dev);
375         struct firmware *fw;
376         ssize_t retval;
377
378         if (!capable(CAP_SYS_RAWIO))
379                 return -EPERM;
380
381         mutex_lock(&fw_lock);
382         fw = fw_priv->fw;
383         if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) {
384                 retval = -ENODEV;
385                 goto out;
386         }
387
388         retval = fw_realloc_buffer(fw_priv, offset + count);
389         if (retval)
390                 goto out;
391
392         retval = count;
393
394         while (count) {
395                 void *page_data;
396                 int page_nr = offset >> PAGE_SHIFT;
397                 int page_ofs = offset & (PAGE_SIZE - 1);
398                 int page_cnt = min_t(size_t, PAGE_SIZE - page_ofs, count);
399
400                 page_data = kmap(fw_priv->pages[page_nr]);
401
402                 memcpy(page_data + page_ofs, buffer, page_cnt);
403
404                 kunmap(fw_priv->pages[page_nr]);
405                 buffer += page_cnt;
406                 offset += page_cnt;
407                 count -= page_cnt;
408         }
409
410         fw_priv->size = max_t(size_t, offset, fw_priv->size);
411 out:
412         mutex_unlock(&fw_lock);
413         return retval;
414 }
415
416 static struct bin_attribute firmware_attr_data = {
417         .attr = { .name = "data", .mode = 0644 },
418         .size = 0,
419         .read = firmware_data_read,
420         .write = firmware_data_write,
421 };
422
423 static void firmware_class_timeout(u_long data)
424 {
425         struct firmware_priv *fw_priv = (struct firmware_priv *) data;
426
427         fw_load_abort(fw_priv);
428 }
429
430 static struct firmware_priv *
431 fw_create_instance(struct firmware *firmware, const char *fw_name,
432                    struct device *device, bool uevent, bool nowait)
433 {
434         struct firmware_priv *fw_priv;
435         struct device *f_dev;
436
437         fw_priv = kzalloc(sizeof(*fw_priv) + strlen(fw_name) + 1 , GFP_KERNEL);
438         if (!fw_priv) {
439                 dev_err(device, "%s: kmalloc failed\n", __func__);
440                 return ERR_PTR(-ENOMEM);
441         }
442
443         fw_priv->fw = firmware;
444         fw_priv->nowait = nowait;
445         strcpy(fw_priv->fw_id, fw_name);
446         init_completion(&fw_priv->completion);
447         setup_timer(&fw_priv->timeout,
448                     firmware_class_timeout, (u_long) fw_priv);
449
450         f_dev = &fw_priv->dev;
451
452         device_initialize(f_dev);
453         dev_set_name(f_dev, "%s", dev_name(device));
454         f_dev->parent = device;
455         f_dev->class = &firmware_class;
456
457         return fw_priv;
458 }
459
460 static struct firmware_priv *
461 _request_firmware_prepare(const struct firmware **firmware_p, const char *name,
462                           struct device *device, bool uevent, bool nowait)
463 {
464         struct firmware *firmware;
465         struct firmware_priv *fw_priv;
466
467         if (!firmware_p)
468                 return ERR_PTR(-EINVAL);
469
470         *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL);
471         if (!firmware) {
472                 dev_err(device, "%s: kmalloc(struct firmware) failed\n",
473                         __func__);
474                 return ERR_PTR(-ENOMEM);
475         }
476
477         if (fw_get_builtin_firmware(firmware, name)) {
478                 dev_dbg(device, "firmware: using built-in firmware %s\n", name);
479                 return NULL;
480         }
481
482         fw_priv = fw_create_instance(firmware, name, device, uevent, nowait);
483         if (IS_ERR(fw_priv)) {
484                 release_firmware(firmware);
485                 *firmware_p = NULL;
486         }
487         return fw_priv;
488 }
489
490 static void _request_firmware_cleanup(const struct firmware **firmware_p)
491 {
492         release_firmware(*firmware_p);
493         *firmware_p = NULL;
494 }
495
496 /* transfer the ownership of pages to firmware */
497 static int fw_set_page_data(struct firmware_priv *fw_priv)
498 {
499         struct firmware *fw = fw_priv->fw;
500
501         fw_priv->data = vmap(fw_priv->pages, fw_priv->nr_pages,
502                                 0, PAGE_KERNEL_RO);
503         if (!fw_priv->data)
504                 return -ENOMEM;
505
506         fw->data = fw_priv->data;
507         fw->pages = fw_priv->pages;
508         fw->size = fw_priv->size;
509
510         WARN_ON(PFN_UP(fw->size) != fw_priv->nr_pages);
511
512         fw_priv->nr_pages = 0;
513         fw_priv->pages = NULL;
514         fw_priv->data = NULL;
515
516         return 0;
517 }
518
519 static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent,
520                                   long timeout)
521 {
522         int retval = 0;
523         struct device *f_dev = &fw_priv->dev;
524
525         dev_set_uevent_suppress(f_dev, true);
526
527         /* Need to pin this module until class device is destroyed */
528         __module_get(THIS_MODULE);
529
530         retval = device_add(f_dev);
531         if (retval) {
532                 dev_err(f_dev, "%s: device_register failed\n", __func__);
533                 goto err_put_dev;
534         }
535
536         retval = device_create_bin_file(f_dev, &firmware_attr_data);
537         if (retval) {
538                 dev_err(f_dev, "%s: sysfs_create_bin_file failed\n", __func__);
539                 goto err_del_dev;
540         }
541
542         retval = device_create_file(f_dev, &dev_attr_loading);
543         if (retval) {
544                 dev_err(f_dev, "%s: device_create_file failed\n", __func__);
545                 goto err_del_bin_attr;
546         }
547
548         if (uevent) {
549                 dev_set_uevent_suppress(f_dev, false);
550                 dev_dbg(f_dev, "firmware: requesting %s\n", fw_priv->fw_id);
551                 if (timeout != MAX_SCHEDULE_TIMEOUT)
552                         mod_timer(&fw_priv->timeout,
553                                   round_jiffies_up(jiffies + timeout));
554
555                 kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD);
556         }
557
558         wait_for_completion(&fw_priv->completion);
559
560         set_bit(FW_STATUS_DONE, &fw_priv->status);
561         del_timer_sync(&fw_priv->timeout);
562
563         mutex_lock(&fw_lock);
564         if (!fw_priv->size || test_bit(FW_STATUS_ABORT, &fw_priv->status))
565                 retval = -ENOENT;
566
567         /* transfer pages ownership at the last minute */
568         if (!retval)
569                 retval = fw_set_page_data(fw_priv);
570         fw_priv->fw = NULL;
571         mutex_unlock(&fw_lock);
572
573         device_remove_file(f_dev, &dev_attr_loading);
574 err_del_bin_attr:
575         device_remove_bin_file(f_dev, &firmware_attr_data);
576 err_del_dev:
577         device_del(f_dev);
578 err_put_dev:
579         put_device(f_dev);
580         return retval;
581 }
582
583 /**
584  * request_firmware: - send firmware request and wait for it
585  * @firmware_p: pointer to firmware image
586  * @name: name of firmware file
587  * @device: device for which firmware is being loaded
588  *
589  *      @firmware_p will be used to return a firmware image by the name
590  *      of @name for device @device.
591  *
592  *      Should be called from user context where sleeping is allowed.
593  *
594  *      @name will be used as $FIRMWARE in the uevent environment and
595  *      should be distinctive enough not to be confused with any other
596  *      firmware image for this or any other device.
597  **/
598 int
599 request_firmware(const struct firmware **firmware_p, const char *name,
600                  struct device *device)
601 {
602         struct firmware_priv *fw_priv;
603         int ret;
604
605         fw_priv = _request_firmware_prepare(firmware_p, name, device, true,
606                                             false);
607         if (IS_ERR_OR_NULL(fw_priv))
608                 return PTR_RET(fw_priv);
609
610         ret = usermodehelper_read_trylock();
611         if (WARN_ON(ret)) {
612                 dev_err(device, "firmware: %s will not be loaded\n", name);
613         } else {
614                 ret = _request_firmware_load(fw_priv, true,
615                                         firmware_loading_timeout());
616                 usermodehelper_read_unlock();
617         }
618         if (ret)
619                 _request_firmware_cleanup(firmware_p);
620
621         return ret;
622 }
623
624 /**
625  * release_firmware: - release the resource associated with a firmware image
626  * @fw: firmware resource to release
627  **/
628 void release_firmware(const struct firmware *fw)
629 {
630         if (fw) {
631                 if (!fw_is_builtin_firmware(fw))
632                         firmware_free_data(fw);
633                 kfree(fw);
634         }
635 }
636
637 /* Async support */
638 struct firmware_work {
639         struct work_struct work;
640         struct module *module;
641         const char *name;
642         struct device *device;
643         void *context;
644         void (*cont)(const struct firmware *fw, void *context);
645         bool uevent;
646 };
647
648 static void request_firmware_work_func(struct work_struct *work)
649 {
650         struct firmware_work *fw_work;
651         const struct firmware *fw;
652         struct firmware_priv *fw_priv;
653         long timeout;
654         int ret;
655
656         fw_work = container_of(work, struct firmware_work, work);
657         fw_priv = _request_firmware_prepare(&fw, fw_work->name, fw_work->device,
658                         fw_work->uevent, true);
659         if (IS_ERR_OR_NULL(fw_priv)) {
660                 ret = PTR_RET(fw_priv);
661                 goto out;
662         }
663
664         timeout = usermodehelper_read_lock_wait(firmware_loading_timeout());
665         if (timeout) {
666                 ret = _request_firmware_load(fw_priv, fw_work->uevent, timeout);
667                 usermodehelper_read_unlock();
668         } else {
669                 dev_dbg(fw_work->device, "firmware: %s loading timed out\n",
670                         fw_work->name);
671                 ret = -EAGAIN;
672         }
673         if (ret)
674                 _request_firmware_cleanup(&fw);
675
676  out:
677         fw_work->cont(fw, fw_work->context);
678
679         module_put(fw_work->module);
680         kfree(fw_work);
681 }
682
683 /**
684  * request_firmware_nowait - asynchronous version of request_firmware
685  * @module: module requesting the firmware
686  * @uevent: sends uevent to copy the firmware image if this flag
687  *      is non-zero else the firmware copy must be done manually.
688  * @name: name of firmware file
689  * @device: device for which firmware is being loaded
690  * @gfp: allocation flags
691  * @context: will be passed over to @cont, and
692  *      @fw may be %NULL if firmware request fails.
693  * @cont: function will be called asynchronously when the firmware
694  *      request is over.
695  *
696  *      Asynchronous variant of request_firmware() for user contexts where
697  *      it is not possible to sleep for long time. It can't be called
698  *      in atomic contexts.
699  **/
700 int
701 request_firmware_nowait(
702         struct module *module, bool uevent,
703         const char *name, struct device *device, gfp_t gfp, void *context,
704         void (*cont)(const struct firmware *fw, void *context))
705 {
706         struct firmware_work *fw_work;
707
708         fw_work = kzalloc(sizeof (struct firmware_work), gfp);
709         if (!fw_work)
710                 return -ENOMEM;
711
712         fw_work->module = module;
713         fw_work->name = name;
714         fw_work->device = device;
715         fw_work->context = context;
716         fw_work->cont = cont;
717         fw_work->uevent = uevent;
718
719         if (!try_module_get(module)) {
720                 kfree(fw_work);
721                 return -EFAULT;
722         }
723
724         INIT_WORK(&fw_work->work, request_firmware_work_func);
725         schedule_work(&fw_work->work);
726         return 0;
727 }
728
729 static int __init firmware_class_init(void)
730 {
731         return class_register(&firmware_class);
732 }
733
734 static void __exit firmware_class_exit(void)
735 {
736         class_unregister(&firmware_class);
737 }
738
739 fs_initcall(firmware_class_init);
740 module_exit(firmware_class_exit);
741
742 EXPORT_SYMBOL(release_firmware);
743 EXPORT_SYMBOL(request_firmware);
744 EXPORT_SYMBOL(request_firmware_nowait);