libertas: Remove create_workqueue
authorBhaktipriya Shridhar <bhaktipriya96@gmail.com>
Sat, 4 Jun 2016 13:59:01 +0000 (19:29 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 16 Jun 2016 15:22:18 +0000 (18:22 +0300)
alloc_workqueue replaces deprecated create_workqueue().

In if_sdio.c, the workqueue card->workqueue has workitem
&card->packet_worker, which is mapped to if_sdio_host_to_card_worker.
The workitem is involved in sending packets to firmware.
Forward progress under memory pressure is a requirement here.

In if_spi.c, the workqueue card->workqueue has workitem
&card->packet_worker, which is mapped to if_spi_host_to_card_worker.
The workitem is involved in sending command packets from the host.
Forward progress under memory pressure is a requirement here.

Dedicated workqueues have been used in both cases since the workitems
on the workqueues are involved in normal device operation with
WQ_MEM_RECLAIM set to gurantee forward progress under memory pressure.
Since there are only a fixed number of work items, explicit concurrency
limit is unnecessary.

flush_workqueue is unnecessary since destroy_workqueue() itself calls
drain_workqueue() which flushes repeatedly till the workqueue
becomes empty. Hence the calls to flush_workqueue() before
destroy_workqueue() have been dropped.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/libertas/if_sdio.c
drivers/net/wireless/marvell/libertas/if_spi.c

index 13eae9ff8c354384a6c8a172f73b7d9da2bbddee..47f4a14c84fedb037bbbe12479e43f915829afaa 100644 (file)
@@ -1228,7 +1228,7 @@ static int if_sdio_probe(struct sdio_func *func,
        }
 
        spin_lock_init(&card->lock);
-       card->workqueue = create_workqueue("libertas_sdio");
+       card->workqueue = alloc_workqueue("libertas_sdio", WQ_MEM_RECLAIM, 0);
        INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker);
        init_waitqueue_head(&card->pwron_waitq);
 
@@ -1326,7 +1326,6 @@ static void if_sdio_remove(struct sdio_func *func)
        lbs_stop_card(card->priv);
        lbs_remove_card(card->priv);
 
-       flush_workqueue(card->workqueue);
        destroy_workqueue(card->workqueue);
 
        while (card->packets) {
index 82c0796377aa52b11e55462cd562f25ba1461805..c3a53cd6988e730ccddd13802672b7b863457e06 100644 (file)
@@ -1180,7 +1180,7 @@ static int if_spi_probe(struct spi_device *spi)
        priv->fw_ready = 1;
 
        /* Initialize interrupt handling stuff. */
-       card->workqueue = create_workqueue("libertas_spi");
+       card->workqueue = alloc_workqueue("libertas_spi", WQ_MEM_RECLAIM, 0);
        INIT_WORK(&card->packet_work, if_spi_host_to_card_worker);
        INIT_WORK(&card->resume_work, if_spi_resume_worker);
 
@@ -1208,7 +1208,6 @@ static int if_spi_probe(struct spi_device *spi)
 release_irq:
        free_irq(spi->irq, card);
 terminate_workqueue:
-       flush_workqueue(card->workqueue);
        destroy_workqueue(card->workqueue);
        lbs_remove_card(priv); /* will call free_netdev */
 free_card:
@@ -1235,7 +1234,6 @@ static int libertas_spi_remove(struct spi_device *spi)
        lbs_remove_card(priv); /* will call free_netdev */
 
        free_irq(spi->irq, card);
-       flush_workqueue(card->workqueue);
        destroy_workqueue(card->workqueue);
        if (card->pdata->teardown)
                card->pdata->teardown(spi);