Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1352793

[RFC/PATCH 3/4] firmware_class: Provide infrastructure to make fw caching optional

From Stephen Boyd <stephen.boyd@linaro.org>
Newsgroups linux.kernel
Subject [RFC/PATCH 3/4] firmware_class: Provide infrastructure to make fw caching optional
Date 2016-03-08 10:30 +0100
Message-ID <ram7N-7oJ-29@gated-at.bofh.it> (permalink)
References <ram7L-7oJ-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Vikram Mulukutla <markivx@codeaurora.org>

Some low memory systems with complex peripherals cannot afford to
have the relatively large firmware images taking up valuable
memory during suspend and resume. Change the internal
implementation of firmware_class to disallow caching based on a
configurable option. In the near future, variants of
request_firmware will take advantage of this feature.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
[stephen.boyd@linaro.org: Drop firmware_desc design and use flags]
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
---
 drivers/base/firmware_class.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index b9250e564ebf..9a616cf7ac9f 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -111,6 +111,7 @@ static inline long firmware_loading_timeout(void)
 #define FW_OPT_FALLBACK		0
 #endif
 #define FW_OPT_NO_WARN	(1U << 3)
+#define FW_OPT_NOCACHE	(1U << 4)
 
 struct firmware_cache {
 	/* firmware_buf instance will be added into the below list */
@@ -1095,14 +1096,16 @@ static int assign_firmware_buf(struct firmware *fw, struct device *device,
 	 * should be fixed in devres or driver core.
 	 */
 	/* don't cache firmware handled without uevent */
-	if (device && (opt_flags & FW_OPT_UEVENT))
+	if (device && (opt_flags & FW_OPT_UEVENT) &&
+	    !(opt_flags & FW_OPT_NOCACHE))
 		fw_add_devm_name(device, buf->fw_id);
 
 	/*
 	 * After caching firmware image is started, let it piggyback
 	 * on request firmware.
 	 */
-	if (buf->fwc->state == FW_LOADER_START_CACHE) {
+	if (!(opt_flags & FW_OPT_NOCACHE) &&
+	    buf->fwc->state == FW_LOADER_START_CACHE) {
 		if (fw_cache_piggyback_on_request(buf->fw_id))
 			kref_get(&buf->ref);
 	}
-- 
2.7.0.25.gfc10eb5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC/PATCH 0/4] request_firmware() on memory constrained devices Stephen Boyd <stephen.boyd@linaro.org> - 2016-03-08 10:30 +0100
  [RFC/PATCH 4/4] firmware: Support requesting firmware directly into DMA memory Stephen Boyd <stephen.boyd@linaro.org> - 2016-03-08 10:30 +0100
    Re: [RFC/PATCH 4/4] firmware: Support requesting firmware directly  into DMA memory Mimi Zohar <zohar@linux.vnet.ibm.com> - 2016-03-08 13:10 +0100
    Re: [RFC/PATCH 4/4] firmware: Support requesting firmware directly  into DMA memory Ming Lei <tom.leiming@gmail.com> - 2016-03-08 14:50 +0100
      Re: [RFC/PATCH 4/4] firmware: Support requesting firmware directly  into DMA memory Mark Brown <broonie@kernel.org> - 2016-03-09 03:30 +0100
  [PATCH 1/4] ARM64: dma: Add support for NO_KERNEL_MAPPING attribute Stephen Boyd <stephen.boyd@linaro.org> - 2016-03-08 10:30 +0100
    Re: [PATCH 1/4] ARM64: dma: Add support for NO_KERNEL_MAPPING  attribute Robin Murphy <robin.murphy@arm.com> - 2016-03-08 15:00 +0100
  [RFC/PATCH 2/4] dma-mapping: Add dma_remap() APIs Stephen Boyd <stephen.boyd@linaro.org> - 2016-03-08 10:30 +0100
  [RFC/PATCH 3/4] firmware_class: Provide infrastructure to make fw caching optional Stephen Boyd <stephen.boyd@linaro.org> - 2016-03-08 10:30 +0100
  Re: [RFC/PATCH 0/4] request_firmware() on memory constrained devices Alexander Stein <alexander.stein@systec-electronic.com> - 2016-03-08 10:40 +0100
    Re: [RFC/PATCH 0/4] request_firmware() on memory constrained devices Stephen Boyd <stephen.boyd@linaro.org> - 2016-03-08 11:10 +0100

csiph-web