All of lore.kernel.org
 help / color / mirror / Atom feed
From: yi1.li@linux.intel.com
To: mcgrof@kernel.org, atull@kernel.org, gregkh@linuxfoundation.org,
	wagi@monom.org, dwmw2@infradead.org, rafal@milecki.pl,
	arend.vanspriel@broadcom.com, rjw@rjwysocki.net,
	moritz.fischer@ettus.com, pmladek@suse.com,
	johannes.berg@intel.com, emmanuel.grumbach@intel.com,
	luciano.coelho@intel.com, kvalo@codeaurora.org, luto@kernel.org,
	takahiro.akashi@linaro.org, dhowells@redhat.com,
	pjones@redhat.com
Cc: linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org,
	Yi Li <yi1.li@linux.intel.com>
Subject: [PATCHv2 1/3] firmware_class: move NO_CACHE from private to driver_data_req_params
Date: Sat, 20 May 2017 01:46:57 -0500	[thread overview]
Message-ID: <1495262819-981-2-git-send-email-yi1.li@linux.intel.com> (raw)
In-Reply-To: <1495262819-981-1-git-send-email-yi1.li@linux.intel.com>

From: Yi Li <yi1.li@linux.intel.com>

This adds DRIVER_DATA_REQ_NO_CACHE flag with .req flag under struct
driver_data_req_params. When this flag is set, the driver_data driver
will bypass the internal caching mechanism, its used by streaming
case and other drivers which implement their own cache thing.

Signed-off-by: Yi Li <yi1.li@linux.intel.com>
---
 drivers/base/firmware_class.c | 16 +++++++---------
 include/linux/driver_data.h   |  4 ++++
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 7af430a..444c9a8 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -72,14 +72,10 @@ enum driver_data_mode {
  * 	issue a uevent to userspace. Userspace in turn is expected to be
  * 	monitoring for uevents for the firmware_class and will use the
  * 	exposted sysfs interface to upload the driver data for the caller.
- * @DRIVER_DATA_PRIV_REQ_NO_CACHE: indicates that the driver data request
- * 	should not set up and use the internal caching mechanism to assist
- * 	drivers from fetching driver data at resume time after suspend.
  */
 enum driver_data_priv_reqs {
 	DRIVER_DATA_PRIV_REQ_FALLBACK			= 1 << 0,
 	DRIVER_DATA_PRIV_REQ_FALLBACK_UEVENT		= 1 << 1,
-	DRIVER_DATA_PRIV_REQ_NO_CACHE			= 1 << 2,
 };
 
 /**
@@ -151,10 +147,12 @@ struct driver_data_params {
 	}
 
 #define __DATA_REQ_FIRMWARE_BUF(buf, size)				\
+	.req_params = {							\
+		.reqs = DRIVER_DATA_REQ_NO_CACHE,			\
+	},								\
 	.priv_params = {						\
 		.priv_reqs = DRIVER_DATA_PRIV_REQ_FALLBACK |		\
-			     DRIVER_DATA_PRIV_REQ_FALLBACK_UEVENT |	\
-			     DRIVER_DATA_PRIV_REQ_NO_CACHE,		\
+			     DRIVER_DATA_PRIV_REQ_FALLBACK_UEVENT,	\
 		.alloc_buf = buf,					\
 		.alloc_buf_size = size,					\
 	}
@@ -186,7 +184,7 @@ struct driver_data_params {
 #define driver_data_param_uevent(params)	\
 	(!!((params)->priv_reqs & DRIVER_DATA_PRIV_REQ_FALLBACK_UEVENT))
 #define driver_data_param_nocache(params)	\
-	(!!((params)->priv_reqs & DRIVER_DATA_PRIV_REQ_NO_CACHE))
+	(!!((params)->reqs & DRIVER_DATA_REQ_NO_CACHE))
 
 #define driver_data_param_optional(params)	\
 	(!!((params)->reqs & DRIVER_DATA_REQ_OPTIONAL))
@@ -793,14 +791,14 @@ static int assign_firmware_buf(struct firmware *fw, struct device *device,
 	/* don't cache firmware handled without uevent */
 	if (device &&
 	    driver_data_param_uevent(&data_params->priv_params) &&
-	    !driver_data_param_nocache(&data_params->priv_params))
+	    !driver_data_param_nocache(&data_params->req_params))
 		fw_add_devm_name(device, buf->fw_id);
 
 	/*
 	 * After caching firmware image is started, let it piggyback
 	 * on request firmware.
 	 */
-	if (!driver_data_param_nocache(&data_params->priv_params) &&
+	if (!driver_data_param_nocache(&data_params->req_params) &&
 	    buf->fwc->state == FW_LOADER_START_CACHE) {
 		if (fw_cache_piggyback_on_request(buf->fw_id))
 			kref_get(&buf->ref);
diff --git a/include/linux/driver_data.h b/include/linux/driver_data.h
index bf51e0b..b6ef5ee 100644
--- a/include/linux/driver_data.h
+++ b/include/linux/driver_data.h
@@ -117,11 +117,15 @@ union driver_data_cbs {
  *	file to be present given the API range, it is only required for one
  *	file in the API range to be present.  If the %DRIVER_DATA_REQ_OPTIONAL
  *	flag is also enabled then all files are treated as optional.
+ * @DRIVER_DATA_REQ_NO_CACHE: indicates that the driver data request
+ *	should not set up and use the internal caching mechanism to assist
+ *	drivers from fetching driver data at resume time after suspend.
  */
 enum driver_data_reqs {
 	DRIVER_DATA_REQ_OPTIONAL			= 1 << 0,
 	DRIVER_DATA_REQ_KEEP				= 1 << 1,
 	DRIVER_DATA_REQ_USE_API_VERSIONING		= 1 << 2,
+	DRIVER_DATA_REQ_NO_CACHE			= 1 << 3,
 };
 
 /**
-- 
2.7.4

  reply	other threads:[~2017-05-20  6:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-20  6:46 [PATCHv2 0/3] Enable no_cache flag to driver_data yi1.li
2017-05-20  6:46 ` yi1.li [this message]
2017-05-20  6:46 ` [PATCHv2 2/3] iwlwifi: use DRIVER_DATA_REQ_NO_CACHE for driver_data yi1.li
2017-05-20  6:46 ` [PATCHv2 3/3] test: add no_cache to driver_data load tester yi1.li
2017-05-24 19:03 ` [PATCHv2 0/3] Enable no_cache flag to driver_data Luis R. Rodriguez
2017-05-24 20:32   ` Luis R. Rodriguez
2017-05-25 22:30   ` Li, Yi
2017-05-25 22:43     ` Luis R. Rodriguez
2017-05-26 21:05       ` Li, Yi
2017-05-26 21:13         ` Luis R. Rodriguez
2017-06-06 19:31   ` Li, Yi
2017-06-07 17:59     ` Luis R. Rodriguez
2017-06-07 21:00       ` Li, Yi
2017-06-07 23:02         ` Luis R. Rodriguez

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=1495262819-981-2-git-send-email-yi1.li@linux.intel.com \
    --to=yi1.li@linux.intel.com \
    --cc=arend.vanspriel@broadcom.com \
    --cc=atull@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=emmanuel.grumbach@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johannes.berg@intel.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    --cc=luto@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=moritz.fischer@ettus.com \
    --cc=pjones@redhat.com \
    --cc=pmladek@suse.com \
    --cc=rafal@milecki.pl \
    --cc=rjw@rjwysocki.net \
    --cc=takahiro.akashi@linaro.org \
    --cc=wagi@monom.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.