From: Stephen Boyd <stephen.boyd@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: Vikram Mulukutla <markivx@codeaurora.org>,
linux-arm@lists.infradead.org,
Mimi Zohar <zohar@linux.vnet.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mark Brown <broonie@kernel.org>,
Ming Lei <ming.lei@canonical.com>
Subject: [RFC/PATCHv3 v3 2/3] firmware: Provide infrastructure to make fw caching optional
Date: Tue, 10 May 2016 15:26:02 -0700 [thread overview]
Message-ID: <1462919163-2503-3-git-send-email-stephen.boyd@linaro.org> (raw)
In-Reply-To: <1462919163-2503-1-git-send-email-stephen.boyd@linaro.org>
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.
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 01d55723d82c..45ed20cefa10 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -112,6 +112,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 */
@@ -1065,14 +1066,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.8.0.rc4
next prev parent reply other threads:[~2016-05-10 22:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-10 22:26 [RFC/PATCHv3 v3 0/3] request_firmware() into pre-allocated buffers Stephen Boyd
2016-05-10 22:26 ` [RFC/PATCHv3 v3 1/3] firmware: Consolidate kmap/read/write logic Stephen Boyd
2016-05-10 22:26 ` Stephen Boyd [this message]
2016-05-10 22:26 ` [RFC/PATCHv3 v3 3/3] firmware: Support loading into a pre-allocated buffer Stephen Boyd
2016-05-11 12:41 ` Mimi Zohar
[not found] ` <20160511202231.8857.86068@sboyd-linaro>
2016-05-11 20:46 ` Mimi Zohar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462919163-2503-3-git-send-email-stephen.boyd@linaro.org \
--to=stephen.boyd@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=broonie@kernel.org \
--cc=linux-arm@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markivx@codeaurora.org \
--cc=ming.lei@canonical.com \
--cc=zohar@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®