Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932782AbcCHJWz (ORCPT ); Tue, 8 Mar 2016 04:22:55 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34965 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932698AbcCHJWi (ORCPT ); Tue, 8 Mar 2016 04:22:38 -0500 From: Stephen Boyd To: linux-kernel@vger.kernel.org Cc: Vikram Mulukutla , linux-arm@lists.infradead.org, Robin Murphy , Laura Abbott , Arnd Bergmann , Marek Szyprowski , Mimi Zohar , Andrew Morton , Mark Brown , Catalin Marinas , Will Deacon , Greg Kroah-Hartman Subject: [RFC/PATCH 3/4] firmware_class: Provide infrastructure to make fw caching optional Date: Tue, 8 Mar 2016 16:22:18 +0700 Message-Id: <1457428939-26659-4-git-send-email-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.7.0.25.gfc10eb5 In-Reply-To: <1457428939-26659-1-git-send-email-stephen.boyd@linaro.org> References: <1457428939-26659-1-git-send-email-stephen.boyd@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1897 Lines: 50 From: Vikram Mulukutla 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 Signed-off-by: Vikram Mulukutla [stephen.boyd@linaro.org: Drop firmware_desc design and use flags] Signed-off-by: Stephen Boyd --- 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