@@ -254,7 +254,7 @@ static int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t)
* Drivers can provide word-at-a-time i/o primitives, or provide
* transfer-at-a-time ones to leverage dma or fifo hardware.
*/
-static void bitbang_work(struct work_struct *work)
+static void bitbang_work(struct kthread_work *work)
{
struct spi_bitbang *bitbang =
container_of(work, struct spi_bitbang, work);
@@ -396,7 +396,7 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m)
status = -ENETDOWN;
else {
list_add_tail(&m->queue, &bitbang->queue);
- queue_work(bitbang->workqueue, &bitbang->work);
+ queue_kthread_work(&bitbang->worker, &bitbang->work);
}
spin_unlock_irqrestore(&bitbang->lock, flags);
@@ -432,11 +432,12 @@ EXPORT_SYMBOL_GPL(spi_bitbang_transfer);
int spi_bitbang_start(struct spi_bitbang *bitbang)
{
int status;
+ struct sched_param param = { .sched_priority = 49 };
if (!bitbang->master || !bitbang->chipselect)
return -EINVAL;
- INIT_WORK(&bitbang->work, bitbang_work);
+ init_kthread_work(&bitbang->work, bitbang_work);
spin_lock_init(&bitbang->lock);
INIT_LIST_HEAD(&bitbang->queue);
@@ -463,12 +464,14 @@ int spi_bitbang_start(struct spi_bitbang *bitbang)
/* this task is the only thing to touch the SPI bits */
bitbang->busy = 0;
- bitbang->workqueue = create_singlethread_workqueue(
+ init_kthread_worker(&bitbang->worker);
+ bitbang->worker_task = kthread_run(kthread_worker_fn, &bitbang->worker,
dev_name(bitbang->master->dev.parent));
- if (bitbang->workqueue == NULL) {
+ if (bitbang->worker_task == NULL) {
status = -EBUSY;
goto err1;
}
+ sched_setscheduler(bitbang->worker_task, SCHED_FIFO, ¶m);
/* driver may get busy before register() returns, especially
* if someone registered boardinfo for devices
@@ -480,7 +483,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang)
return status;
err2:
- destroy_workqueue(bitbang->workqueue);
+ kthread_stop(bitbang->worker_task);
err1:
return status;
}
@@ -495,7 +498,7 @@ int spi_bitbang_stop(struct spi_bitbang *bitbang)
WARN_ON(!list_empty(&bitbang->queue));
- destroy_workqueue(bitbang->workqueue);
+ kthread_stop(bitbang->worker_task);
return 0;
}
@@ -1,11 +1,12 @@
#ifndef __SPI_BITBANG_H
#define __SPI_BITBANG_H
-#include <linux/workqueue.h>
+#include <linux/kthread.h>
struct spi_bitbang {
- struct workqueue_struct *workqueue;
- struct work_struct work;
+ struct kthread_worker worker;
+ struct task_struct *worker_task;
+ struct kthread_work work;
spinlock_t lock;
struct list_head queue;