aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBhaktipriya Shridhar <bhaktipriya96@gmail.com>2016-07-02 04:42:00 -0400
committerMark Brown <broonie@kernel.org>2016-07-03 08:14:31 -0400
commit9b96f0704b5ad75ef26085d03934bee21d3362f0 (patch)
tree389f012c48915ece909c55ff6731dd2855b61f4b
parent1a695a905c18548062509178b98bc91e67510864 (diff)
spi: spi-bfin5xx: Remove deprecated create_singlethread_workqueue
The workqueue "workqueue" serves as a driver message queue. It has a single work item(&drv_data->pump_messages) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in bfin_spi_destroy_queue() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-bfin5xx.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c
index 1e91325bf39c..249c7a3677c9 100644
--- a/drivers/spi/spi-bfin5xx.c
+++ b/drivers/spi/spi-bfin5xx.c
@@ -67,8 +67,6 @@ struct bfin_spi_master_data {
67 /* BFIN hookup */ 67 /* BFIN hookup */
68 struct bfin5xx_spi_master *master_info; 68 struct bfin5xx_spi_master *master_info;
69 69
70 /* Driver message queue */
71 struct workqueue_struct *workqueue;
72 struct work_struct pump_messages; 70 struct work_struct pump_messages;
73 spinlock_t lock; 71 spinlock_t lock;
74 struct list_head queue; 72 struct list_head queue;
@@ -359,7 +357,7 @@ static void bfin_spi_giveback(struct bfin_spi_master_data *drv_data)
359 drv_data->cur_msg = NULL; 357 drv_data->cur_msg = NULL;
360 drv_data->cur_transfer = NULL; 358 drv_data->cur_transfer = NULL;
361 drv_data->cur_chip = NULL; 359 drv_data->cur_chip = NULL;
362 queue_work(drv_data->workqueue, &drv_data->pump_messages); 360 schedule_work(&drv_data->pump_messages);
363 spin_unlock_irqrestore(&drv_data->lock, flags); 361 spin_unlock_irqrestore(&drv_data->lock, flags);
364 362
365 msg->state = NULL; 363 msg->state = NULL;
@@ -946,7 +944,7 @@ static int bfin_spi_transfer(struct spi_device *spi, struct spi_message *msg)
946 list_add_tail(&msg->queue, &drv_data->queue); 944 list_add_tail(&msg->queue, &drv_data->queue);
947 945
948 if (drv_data->running && !drv_data->busy) 946 if (drv_data->running && !drv_data->busy)
949 queue_work(drv_data->workqueue, &drv_data->pump_messages); 947 schedule_work(&drv_data->pump_messages);
950 948
951 spin_unlock_irqrestore(&drv_data->lock, flags); 949 spin_unlock_irqrestore(&drv_data->lock, flags);
952 950
@@ -1177,12 +1175,7 @@ static int bfin_spi_init_queue(struct bfin_spi_master_data *drv_data)
1177 tasklet_init(&drv_data->pump_transfers, 1175 tasklet_init(&drv_data->pump_transfers,
1178 bfin_spi_pump_transfers, (unsigned long)drv_data); 1176 bfin_spi_pump_transfers, (unsigned long)drv_data);
1179 1177
1180 /* init messages workqueue */
1181 INIT_WORK(&drv_data->pump_messages, bfin_spi_pump_messages); 1178 INIT_WORK(&drv_data->pump_messages, bfin_spi_pump_messages);
1182 drv_data->workqueue = create_singlethread_workqueue(
1183 dev_name(drv_data->master->dev.parent));
1184 if (drv_data->workqueue == NULL)
1185 return -EBUSY;
1186 1179
1187 return 0; 1180 return 0;
1188} 1181}
@@ -1204,7 +1197,7 @@ static int bfin_spi_start_queue(struct bfin_spi_master_data *drv_data)
1204 drv_data->cur_chip = NULL; 1197 drv_data->cur_chip = NULL;
1205 spin_unlock_irqrestore(&drv_data->lock, flags); 1198 spin_unlock_irqrestore(&drv_data->lock, flags);
1206 1199
1207 queue_work(drv_data->workqueue, &drv_data->pump_messages); 1200 schedule_work(&drv_data->pump_messages);
1208 1201
1209 return 0; 1202 return 0;
1210} 1203}
@@ -1246,7 +1239,7 @@ static int bfin_spi_destroy_queue(struct bfin_spi_master_data *drv_data)
1246 if (status != 0) 1239 if (status != 0)
1247 return status; 1240 return status;
1248 1241
1249 destroy_workqueue(drv_data->workqueue); 1242 flush_work(&drv_data->pump_messages);
1250 1243
1251 return 0; 1244 return 0;
1252} 1245}