[PRE-REVIEW PATCH 02/16] crypto: ccp - Prepare to use the new tasklet API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently, the tasklet and its "tdata" has no relationship. The future
tasklet API, will no longer allow to pass an arbitrary "unsigned long"
data parameter. The tasklet data structure will need to be embedded into
a data structure that will be retrieved from the tasklet handler (most
of the time, it is the driver data structure). This commit prepares the
driver to this change. For doing so, it embeds "tasklet" into "tdata".
Then, "tdata" will be recoverable from its "tasklet" field, with the
tasklet API.

Signed-off-by: Romain Perier <romain.perier@xxxxxxxxx>
---
 drivers/crypto/ccp/ccp-dev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
index 73acf0fdb793..d0d180176f45 100644
--- a/drivers/crypto/ccp/ccp-dev.c
+++ b/drivers/crypto/ccp/ccp-dev.c
@@ -44,6 +44,7 @@ MODULE_PARM_DESC(max_devs, "Maximum number of CCPs to enable (default: all; 0 di
 struct ccp_tasklet_data {
 	struct completion completion;
 	struct ccp_cmd *cmd;
+	struct tasklet_struct tasklet;
 };
 
 /* Human-readable error strings */
@@ -436,9 +437,8 @@ int ccp_cmd_queue_thread(void *data)
 	struct ccp_cmd_queue *cmd_q = (struct ccp_cmd_queue *)data;
 	struct ccp_cmd *cmd;
 	struct ccp_tasklet_data tdata;
-	struct tasklet_struct tasklet;
 
-	tasklet_init(&tasklet, ccp_do_cmd_complete, (unsigned long)&tdata);
+	tasklet_init(&tdata.tasklet, ccp_do_cmd_complete, (unsigned long)&tdata);
 
 	set_current_state(TASK_INTERRUPTIBLE);
 	while (!kthread_should_stop()) {
@@ -458,7 +458,7 @@ int ccp_cmd_queue_thread(void *data)
 		/* Schedule the completion callback */
 		tdata.cmd = cmd;
 		init_completion(&tdata.completion);
-		tasklet_schedule(&tasklet);
+		tasklet_schedule(&tdata.tasklet);
 		wait_for_completion(&tdata.completion);
 	}
 
-- 
2.23.0




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux