diff options
author | Tien Fong Chee <tien.fong.chee@intel.com> | 2018-12-10 21:29:44 +0800 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-01-15 15:28:54 -0500 |
commit | 31a2cf1ca4968dcaf78aef222b6683fea4f2c72d (patch) | |
tree | 930f867931e7b64be15f5b11ad71e369c952e896 /doc | |
parent | 9652cfd9ee5679b72f28d581d7d48916f8031937 (diff) | |
download | u-boot-31a2cf1ca4968dcaf78aef222b6683fea4f2c72d.tar.gz u-boot-31a2cf1ca4968dcaf78aef222b6683fea4f2c72d.tar.bz2 u-boot-31a2cf1ca4968dcaf78aef222b6683fea4f2c72d.zip |
misc: fs_loader: Switching private data allocation to DM auto allocation
Switching private data manual allocation to driver model auto allocation
so users no longer need to deallocate themself because this would be
deallocated by driver model when the device is no longer required.
Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/driver-model/fs_firmware_loader.txt | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/doc/driver-model/fs_firmware_loader.txt b/doc/driver-model/fs_firmware_loader.txt index 290915a959..b9aee848cc 100644 --- a/doc/driver-model/fs_firmware_loader.txt +++ b/doc/driver-model/fs_firmware_loader.txt @@ -74,17 +74,16 @@ Firmware storage device described in device tree source File system firmware Loader API ------------------------------- -int request_firmware_into_buf(struct device_platdata *plat, +int request_firmware_into_buf(struct udevice *dev, const char *name, - void *buf, size_t size, u32 offset, - struct firmware **firmwarep) + void *buf, size_t size, u32 offset) -------------------------------------------------------------------- Load firmware into a previously allocated buffer Parameters: -1. struct device_platdata *plat - Platform data such as storage and partition firmware loading from +1. struct udevice *dev + An instance of a driver 2. const char *name name of firmware file @@ -98,36 +97,16 @@ Parameters: 5. u32 offset offset of a file for start reading into buffer -6. struct firmware **firmwarep - pointer to firmware image - return: size of total read -ve when error Description: - The firmware is loaded directly into the buffer pointed to by buf and - the @firmwarep data member is pointed at buf - -Note: Memory would be allocated for firmware image, hence user should - free() *firmwarep and *firmwarep->priv structs after usage of - request_firmware_into_buf(), otherwise it will always leak memory - while subsequent calls of request_firmware_into_buf() with the same - *firmwarep argument. Those arguments can be free through calling API - below release_firmware(); + The firmware is loaded directly into the buffer pointed to by buf Example of creating firmware loader instance and calling request_firmware_into_buf API: if (uclass_get_device(UCLASS_FS_FIRMWARE_LOADER, 0, &dev)) { - request_firmware_into_buf(dev->plat, filename, buffer_location, - buffer_size, offset_ofreading, &fw); + request_firmware_into_buf(dev, filename, buffer_location, + buffer_size, offset_ofreading); } - -void release_firmware(struct firmware *firmware) ------------------------------------------------- -Release the resource associated with a firmware image - -Parameters: - -1. struct firmware *firmware - Firmware resource to release |