Commit 00b3c118 authored by Allen Pais's avatar Allen Pais Committed by Jason Gunthorpe

RDMA/rxe: Convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the struct tasklet_struct
pointer to all tasklet callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Link: https://lore.kernel.org/r/20200903060637.424458-6-allen.lkml@gmail.comSigned-off-by: default avatarRomain Perier <romain.perier@gmail.com>
Signed-off-by: default avatarAllen Pais <allen.lkml@gmail.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent a23afb44
...@@ -39,9 +39,9 @@ int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq, ...@@ -39,9 +39,9 @@ int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq,
return -EINVAL; return -EINVAL;
} }
static void rxe_send_complete(unsigned long data) static void rxe_send_complete(struct tasklet_struct *t)
{ {
struct rxe_cq *cq = (struct rxe_cq *)data; struct rxe_cq *cq = from_tasklet(cq, t, comp_task);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&cq->cq_lock, flags); spin_lock_irqsave(&cq->cq_lock, flags);
...@@ -80,7 +80,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe, ...@@ -80,7 +80,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
cq->is_dying = false; cq->is_dying = false;
tasklet_init(&cq->comp_task, rxe_send_complete, (unsigned long)cq); tasklet_setup(&cq->comp_task, rxe_send_complete);
spin_lock_init(&cq->cq_lock); spin_lock_init(&cq->cq_lock);
cq->ibcq.cqe = cqe; cq->ibcq.cqe = cqe;
......
...@@ -28,12 +28,12 @@ int __rxe_do_task(struct rxe_task *task) ...@@ -28,12 +28,12 @@ int __rxe_do_task(struct rxe_task *task)
* a second caller finds the task already running * a second caller finds the task already running
* but looks just after the last call to func * but looks just after the last call to func
*/ */
void rxe_do_task(unsigned long data) void rxe_do_task(struct tasklet_struct *t)
{ {
int cont; int cont;
int ret; int ret;
unsigned long flags; unsigned long flags;
struct rxe_task *task = (struct rxe_task *)data; struct rxe_task *task = from_tasklet(task, t, tasklet);
spin_lock_irqsave(&task->state_lock, flags); spin_lock_irqsave(&task->state_lock, flags);
switch (task->state) { switch (task->state) {
...@@ -96,7 +96,7 @@ int rxe_init_task(void *obj, struct rxe_task *task, ...@@ -96,7 +96,7 @@ int rxe_init_task(void *obj, struct rxe_task *task,
snprintf(task->name, sizeof(task->name), "%s", name); snprintf(task->name, sizeof(task->name), "%s", name);
task->destroyed = false; task->destroyed = false;
tasklet_init(&task->tasklet, rxe_do_task, (unsigned long)task); tasklet_setup(&task->tasklet, rxe_do_task);
task->state = TASK_STATE_START; task->state = TASK_STATE_START;
spin_lock_init(&task->state_lock); spin_lock_init(&task->state_lock);
...@@ -132,7 +132,7 @@ void rxe_run_task(struct rxe_task *task, int sched) ...@@ -132,7 +132,7 @@ void rxe_run_task(struct rxe_task *task, int sched)
if (sched) if (sched)
tasklet_schedule(&task->tasklet); tasklet_schedule(&task->tasklet);
else else
rxe_do_task((unsigned long)task); rxe_do_task(&task->tasklet);
} }
void rxe_disable_task(struct rxe_task *task) void rxe_disable_task(struct rxe_task *task)
......
...@@ -53,7 +53,7 @@ int __rxe_do_task(struct rxe_task *task); ...@@ -53,7 +53,7 @@ int __rxe_do_task(struct rxe_task *task);
* work to do someone must reschedule the task before * work to do someone must reschedule the task before
* leaving * leaving
*/ */
void rxe_do_task(unsigned long data); void rxe_do_task(struct tasklet_struct *t);
/* run a task, else schedule it to run as a tasklet, The decision /* run a task, else schedule it to run as a tasklet, The decision
* to run or schedule tasklet is based on the parameter sched. * to run or schedule tasklet is based on the parameter sched.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment