Use kthread_create_worker() helper to simplify the code. It uses the kthread worker API the right way. It will eventually allow to remove the FIXME in kthread_worker_fn() and add more consistency checks in the future.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -358,8 +358,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 357 unmodified lines | |||
| 358 | * @cleanup: frees controller-specific state | 358 | * @cleanup: frees controller-specific state |
| 359 | * @can_dma: determine whether this controller supports DMA | 359 | * @can_dma: determine whether this controller supports DMA |
| 360 | * @queued: whether this controller is providing an internal message queue | 360 | * @queued: whether this controller is providing an internal message queue |
| 361 | * @kworker: thread struct for message pump | 361 | * @kworker: pointer to thread struct for message pump |
| 362 | * @kworker_task: pointer to task for message pump kworker thread | ||
| 363 | * @pump_messages: work struct for scheduling work to the message pump | 362 | * @pump_messages: work struct for scheduling work to the message pump |
| 364 | * @queue_lock: spinlock to syncronise access to message queue | 363 | * @queue_lock: spinlock to syncronise access to message queue |
| 365 | * @queue: message queue | 364 | * @queue: message queue |
| @@ -593,8 +592,7 @@ struct spi_controller { · 227 unmodified lines | |||
| 593 | * Over time we expect SPI drivers to be phased over to this API. | 592 | * Over time we expect SPI drivers to be phased over to this API. |
| 594 | */ | 593 | */ |
| 595 | bool queued; | 594 | bool queued; |
| 596 | struct kthread_worker kworker; | 595 | struct kthread_worker *kworker; |
| 597 | struct task_struct *kworker_task; | ||
| 598 | struct kthread_work pump_messages; | 596 | struct kthread_work pump_messages; |
| 599 | spinlock_t queue_lock; | 597 | spinlock_t queue_lock; |
| 600 | struct list_head queue; | 598 | struct list_head queue; |