--- zzzz-none-000/linux-2.6.39.4/drivers/mtd/mtd_blkdevs.c 2011-08-03 19:43:28.000000000 +0000 +++ puma6-atom-6490-729/linux-2.6.39.4/drivers/mtd/mtd_blkdevs.c 2021-11-10 13:38:15.000000000 +0000 @@ -136,6 +136,9 @@ struct request *req = NULL; int background_done = 0; +#ifdef CONFIG_ARCH_GEN3 + down(&dev->thread_sem); +#endif spin_lock_irq(rq->queue_lock); while (!kthread_should_stop()) { @@ -162,7 +165,13 @@ set_current_state(TASK_RUNNING); spin_unlock_irq(rq->queue_lock); +#ifdef CONFIG_ARCH_GEN3 + up(&dev->thread_sem); +#endif schedule(); +#ifdef CONFIG_ARCH_GEN3 + down(&dev->thread_sem); +#endif spin_lock_irq(rq->queue_lock); continue; } @@ -185,6 +194,9 @@ __blk_end_request_all(req, -EIO); spin_unlock_irq(rq->queue_lock); +#ifdef CONFIG_ARCH_GEN3 + up(&dev->thread_sem); +#endif return 0; } @@ -417,6 +429,9 @@ /* Create processing thread */ /* TODO: workqueue ? */ +#ifdef CONFIG_ARCH_GEN3 + sema_init(&new->thread_sem, 1); +#endif new->thread = kthread_run(mtd_blktrans_thread, new, "%s%d", tr->name, new->mtd->index); if (IS_ERR(new->thread)) {