aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/firmware_class.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/firmware_class.c')
-rw-r--r--drivers/base/firmware_class.c69
1 files changed, 41 insertions, 28 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 4acb2c5733c3..98f6c02d6790 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -62,14 +62,16 @@ firmware_timeout_show(struct class *class, char *buf)
62} 62}
63 63
64/** 64/**
65 * firmware_timeout_store: 65 * firmware_timeout_store - set number of seconds to wait for firmware
66 * Description: 66 * @class: device class pointer
67 * @buf: buffer to scan for timeout value
68 * @count: number of bytes in @buf
69 *
67 * Sets the number of seconds to wait for the firmware. Once 70 * Sets the number of seconds to wait for the firmware. Once
68 * this expires an error will be return to the driver and no 71 * this expires an error will be returned to the driver and no
69 * firmware will be provided. 72 * firmware will be provided.
70 * 73 *
71 * Note: zero means 'wait for ever' 74 * Note: zero means 'wait forever'.
72 *
73 **/ 75 **/
74static ssize_t 76static ssize_t
75firmware_timeout_store(struct class *class, const char *buf, size_t count) 77firmware_timeout_store(struct class *class, const char *buf, size_t count)
@@ -123,12 +125,15 @@ firmware_loading_show(struct class_device *class_dev, char *buf)
123} 125}
124 126
125/** 127/**
126 * firmware_loading_store: - loading control file 128 * firmware_loading_store - set value in the 'loading' control file
127 * Description: 129 * @class_dev: class_device pointer
130 * @buf: buffer to scan for loading control value
131 * @count: number of bytes in @buf
132 *
128 * The relevant values are: 133 * The relevant values are:
129 * 134 *
130 * 1: Start a load, discarding any previous partial load. 135 * 1: Start a load, discarding any previous partial load.
131 * 0: Conclude the load and handle the data to the driver code. 136 * 0: Conclude the load and hand the data to the driver code.
132 * -1: Conclude the load with an error and discard any written data. 137 * -1: Conclude the load with an error and discard any written data.
133 **/ 138 **/
134static ssize_t 139static ssize_t
@@ -201,6 +206,7 @@ out:
201 up(&fw_lock); 206 up(&fw_lock);
202 return ret_count; 207 return ret_count;
203} 208}
209
204static int 210static int
205fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size) 211fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size)
206{ 212{
@@ -227,11 +233,13 @@ fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size)
227} 233}
228 234
229/** 235/**
230 * firmware_data_write: 236 * firmware_data_write - write method for firmware
237 * @kobj: kobject for the class_device
238 * @buffer: buffer being written
239 * @offset: buffer offset for write in total data store area
240 * @count: buffer size
231 * 241 *
232 * Description: 242 * Data written to the 'data' attribute will be later handed to
233 *
234 * Data written to the 'data' attribute will be later handled to
235 * the driver as a firmware image. 243 * the driver as a firmware image.
236 **/ 244 **/
237static ssize_t 245static ssize_t
@@ -264,6 +272,7 @@ out:
264 up(&fw_lock); 272 up(&fw_lock);
265 return retval; 273 return retval;
266} 274}
275
267static struct bin_attribute firmware_attr_data_tmpl = { 276static struct bin_attribute firmware_attr_data_tmpl = {
268 .attr = {.name = "data", .mode = 0644, .owner = THIS_MODULE}, 277 .attr = {.name = "data", .mode = 0644, .owner = THIS_MODULE},
269 .size = 0, 278 .size = 0,
@@ -448,13 +457,16 @@ out:
448 457
449/** 458/**
450 * request_firmware: - request firmware to hotplug and wait for it 459 * request_firmware: - request firmware to hotplug and wait for it
451 * Description: 460 * @firmware_p: pointer to firmware image
452 * @firmware will be used to return a firmware image by the name 461 * @name: name of firmware file
462 * @device: device for which firmware is being loaded
463 *
464 * @firmware_p will be used to return a firmware image by the name
453 * of @name for device @device. 465 * of @name for device @device.
454 * 466 *
455 * Should be called from user context where sleeping is allowed. 467 * Should be called from user context where sleeping is allowed.
456 * 468 *
457 * @name will be use as $FIRMWARE in the hotplug environment and 469 * @name will be used as $FIRMWARE in the hotplug environment and
458 * should be distinctive enough not to be confused with any other 470 * should be distinctive enough not to be confused with any other
459 * firmware image for this or any other device. 471 * firmware image for this or any other device.
460 **/ 472 **/
@@ -468,6 +480,7 @@ request_firmware(const struct firmware **firmware_p, const char *name,
468 480
469/** 481/**
470 * release_firmware: - release the resource associated with a firmware image 482 * release_firmware: - release the resource associated with a firmware image
483 * @fw: firmware resource to release
471 **/ 484 **/
472void 485void
473release_firmware(const struct firmware *fw) 486release_firmware(const struct firmware *fw)
@@ -480,8 +493,10 @@ release_firmware(const struct firmware *fw)
480 493
481/** 494/**
482 * register_firmware: - provide a firmware image for later usage 495 * register_firmware: - provide a firmware image for later usage
496 * @name: name of firmware image file
497 * @data: buffer pointer for the firmware image
498 * @size: size of the data buffer area
483 * 499 *
484 * Description:
485 * Make sure that @data will be available by requesting firmware @name. 500 * Make sure that @data will be available by requesting firmware @name.
486 * 501 *
487 * Note: This will not be possible until some kind of persistence 502 * Note: This will not be possible until some kind of persistence
@@ -526,21 +541,19 @@ request_firmware_work_func(void *arg)
526} 541}
527 542
528/** 543/**
529 * request_firmware_nowait: 544 * request_firmware_nowait: asynchronous version of request_firmware
545 * @module: module requesting the firmware
546 * @hotplug: invokes hotplug event to copy the firmware image if this flag
547 * is non-zero else the firmware copy must be done manually.
548 * @name: name of firmware file
549 * @device: device for which firmware is being loaded
550 * @context: will be passed over to @cont, and
551 * @fw may be %NULL if firmware request fails.
552 * @cont: function will be called asynchronously when the firmware
553 * request is over.
530 * 554 *
531 * Description:
532 * Asynchronous variant of request_firmware() for contexts where 555 * Asynchronous variant of request_firmware() for contexts where
533 * it is not possible to sleep. 556 * it is not possible to sleep.
534 *
535 * @hotplug invokes hotplug event to copy the firmware image if this flag
536 * is non-zero else the firmware copy must be done manually.
537 *
538 * @cont will be called asynchronously when the firmware request is over.
539 *
540 * @context will be passed over to @cont.
541 *
542 * @fw may be %NULL if firmware request fails.
543 *
544 **/ 557 **/
545int 558int
546request_firmware_nowait( 559request_firmware_nowait(