mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
kthread: kthread worker API cleanup
A good practice is to prefix the names of functions by the name
of the subsystem.
The kthread worker API is a mix of classic kthreads and workqueues. Each
worker has a dedicated kthread. It runs a generic function that process
queued works. It is implemented as part of the kthread subsystem.
This patch renames the existing kthread worker API to use
the corresponding name from the workqueues API prefixed by
kthread_:
__init_kthread_worker() -> __kthread_init_worker()
init_kthread_worker() -> kthread_init_worker()
init_kthread_work() -> kthread_init_work()
insert_kthread_work() -> kthread_insert_work()
queue_kthread_work() -> kthread_queue_work()
flush_kthread_work() -> kthread_flush_work()
flush_kthread_worker() -> kthread_flush_worker()
Note that the names of DEFINE_KTHREAD_WORK*() macros stay
as they are. It is common that the "DEFINE_" prefix has
precedence over the subsystem names.
Note that INIT() macros and init() functions use different
naming scheme. There is no good solution. There are several
reasons for this solution:
+ "init" in the function names stands for the verb "initialize"
aka "initialize worker". While "INIT" in the macro names
stands for the noun "INITIALIZER" aka "worker initializer".
+ INIT() macros are used only in DEFINE() macros
+ init() functions are used close to the other kthread()
functions. It looks much better if all the functions
use the same scheme.
+ There will be also kthread_destroy_worker() that will
be used close to kthread_cancel_work(). It is related
to the init() function. Again it looks better if all
functions use the same naming scheme.
+ there are several precedents for such init() function
names, e.g. amd_iommu_init_device(), free_area_init_node(),
jump_label_init_type(), regmap_init_mmio_clk(),
+ It is not an argument but it was inconsistent even before.
[[email protected]: fix linux-next merge conflict]
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Suggested-by: Andrew Morton <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Cc: Josh Triplett <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Jiri Kosina <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
e700591ae0
commit
3989144f86
18 changed files with 93 additions and 92 deletions
|
|
@ -338,7 +338,7 @@ static irqreturn_t sst_byt_irq_thread(int irq, void *context)
|
|||
spin_unlock_irqrestore(&sst->spinlock, flags);
|
||||
|
||||
/* continue to send any remaining messages... */
|
||||
queue_kthread_work(&ipc->kworker, &ipc->kwork);
|
||||
kthread_queue_work(&ipc->kworker, &ipc->kwork);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ static int ipc_tx_message(struct sst_generic_ipc *ipc, u64 header,
|
|||
list_add_tail(&msg->list, &ipc->tx_list);
|
||||
spin_unlock_irqrestore(&ipc->dsp->spinlock, flags);
|
||||
|
||||
queue_kthread_work(&ipc->kworker, &ipc->kwork);
|
||||
kthread_queue_work(&ipc->kworker, &ipc->kwork);
|
||||
|
||||
if (wait)
|
||||
return tx_wait_done(ipc, msg, rx_data);
|
||||
|
|
@ -281,7 +281,7 @@ int sst_ipc_init(struct sst_generic_ipc *ipc)
|
|||
return -ENOMEM;
|
||||
|
||||
/* start the IPC message thread */
|
||||
init_kthread_worker(&ipc->kworker);
|
||||
kthread_init_worker(&ipc->kworker);
|
||||
ipc->tx_thread = kthread_run(kthread_worker_fn,
|
||||
&ipc->kworker, "%s",
|
||||
dev_name(ipc->dev));
|
||||
|
|
@ -292,7 +292,7 @@ int sst_ipc_init(struct sst_generic_ipc *ipc)
|
|||
return ret;
|
||||
}
|
||||
|
||||
init_kthread_work(&ipc->kwork, ipc_tx_msgs);
|
||||
kthread_init_work(&ipc->kwork, ipc_tx_msgs);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sst_ipc_init);
|
||||
|
|
|
|||
|
|
@ -818,7 +818,7 @@ static irqreturn_t hsw_irq_thread(int irq, void *context)
|
|||
spin_unlock_irqrestore(&sst->spinlock, flags);
|
||||
|
||||
/* continue to send any remaining messages... */
|
||||
queue_kthread_work(&ipc->kworker, &ipc->kwork);
|
||||
kthread_queue_work(&ipc->kworker, &ipc->kwork);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context)
|
|||
skl_ipc_int_enable(dsp);
|
||||
|
||||
/* continue to send any remaining messages... */
|
||||
queue_kthread_work(&ipc->kworker, &ipc->kwork);
|
||||
kthread_queue_work(&ipc->kworker, &ipc->kwork);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue