linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: wireless: marvell: libertas: Remove create_workqueue
@ 2016-06-04 13:59 Bhaktipriya Shridhar
  2016-06-04 14:29 ` Kalle Valo
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bhaktipriya Shridhar @ 2016-06-04 13:59 UTC (permalink / raw)
  To: Kalle Valo, Andreas Kemnade, Dan Carpenter, Bhaktipriya Shridhar,
	Andrew F. Davis, Jonathan Cameron, Mark Brown
  Cc: Tejun Heo, libertas-dev, linux-wireless, netdev, linux-kernel

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>
---
 drivers/net/wireless/marvell/libertas/if_sdio.c | 3 +--
 drivers/net/wireless/marvell/libertas/if_spi.c  | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/marvell/libertas/if_sdio.c b/drivers/net/wireless/marvell/libertas/if_sdio.c
index 13eae9f..47f4a14 100644
--- a/drivers/net/wireless/marvell/libertas/if_sdio.c
+++ b/drivers/net/wireless/marvell/libertas/if_sdio.c
@@ -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) {
diff --git a/drivers/net/wireless/marvell/libertas/if_spi.c b/drivers/net/wireless/marvell/libertas/if_spi.c
index 82c0796..c3a53cd 100644
--- a/drivers/net/wireless/marvell/libertas/if_spi.c
+++ b/drivers/net/wireless/marvell/libertas/if_spi.c
@@ -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);
--
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: wireless: marvell: libertas: Remove create_workqueue
  2016-06-04 13:59 [PATCH] net: wireless: marvell: libertas: Remove create_workqueue Bhaktipriya Shridhar
@ 2016-06-04 14:29 ` Kalle Valo
  2016-06-04 14:32   ` Bhaktipriya Shridhar
  2016-06-05 10:22 ` Tejun Heo
  2016-06-16 15:22 ` Kalle Valo
  2 siblings, 1 reply; 5+ messages in thread
From: Kalle Valo @ 2016-06-04 14:29 UTC (permalink / raw)
  To: Bhaktipriya Shridhar
  Cc: Andreas Kemnade, Dan Carpenter, Andrew F. Davis,
	Jonathan Cameron, Mark Brown, Tejun Heo, libertas-dev,
	linux-wireless, netdev, linux-kernel

Bhaktipriya Shridhar <bhaktipriya96@gmail.com> writes:

> 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>

"libertas:" as a prefix is enough, no need to put the full path to the
title. I can fix that this time.

You can actually check yourself what prefix is commonly used in a
particular file or directory:

$ git log --oneline --no-merges -10 drivers/net/wireless/marvell/libertas/
57fbcce37be7 cfg80211: remove enum ieee80211_band
3691ac4a9c95 libertas: fix an error code in probe
143e49458424 libertas: add an cfg80211 interface for powersaving
0b8802dc5f59 libertas: fix ps-mode related removal problems
fada24a54770 libertas: go back to ps mode without commands pending
57954b94cad7 libertas: do not confirm sleep if commands are pending
fae4f9f78ab1 libertas: check whether bus can do more than polling
0a7701b4defc libertas: fix pointer bugs for PS_MODE commands
6d91ff7acc90 libertas: cleanup a variable name
0a38c8e1b592 libertas: check for NULL before use
$
-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: wireless: marvell: libertas: Remove create_workqueue
  2016-06-04 14:29 ` Kalle Valo
@ 2016-06-04 14:32   ` Bhaktipriya Shridhar
  0 siblings, 0 replies; 5+ messages in thread
From: Bhaktipriya Shridhar @ 2016-06-04 14:32 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Andreas Kemnade, Dan Carpenter, Andrew F. Davis,
	Jonathan Cameron, Mark Brown, Tejun Heo, libertas-dev,
	linux-wireless, netdev, Linux-Kernel@Vger. Kernel. Org

On Sat, Jun 4, 2016 at 7:59 PM, Kalle Valo <kvalo@codeaurora.org> wrote:
>
> $ git log --oneline --no-merges -10

Sure. Will keep that in mind.

Thanks,
Bhaktipriya

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: wireless: marvell: libertas: Remove create_workqueue
  2016-06-04 13:59 [PATCH] net: wireless: marvell: libertas: Remove create_workqueue Bhaktipriya Shridhar
  2016-06-04 14:29 ` Kalle Valo
@ 2016-06-05 10:22 ` Tejun Heo
  2016-06-16 15:22 ` Kalle Valo
  2 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2016-06-05 10:22 UTC (permalink / raw)
  To: Bhaktipriya Shridhar
  Cc: Kalle Valo, Andreas Kemnade, Dan Carpenter, Andrew F. Davis,
	Jonathan Cameron, Mark Brown, libertas-dev, linux-wireless,
	netdev, linux-kernel

On Sat, Jun 04, 2016 at 07:29:01PM +0530, Bhaktipriya Shridhar wrote:
> 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>

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libertas: Remove create_workqueue
  2016-06-04 13:59 [PATCH] net: wireless: marvell: libertas: Remove create_workqueue Bhaktipriya Shridhar
  2016-06-04 14:29 ` Kalle Valo
  2016-06-05 10:22 ` Tejun Heo
@ 2016-06-16 15:22 ` Kalle Valo
  2 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2016-06-16 15:22 UTC (permalink / raw)
  To: Bhaktipriya Shridhar
  Cc: Andreas Kemnade, Dan Carpenter, Bhaktipriya Shridhar,
	Andrew F. Davis, Jonathan Cameron, Mark Brown, Tejun Heo,
	libertas-dev, linux-wireless, netdev, linux-kernel

Bhaktipriya Shridhar <bhaktipriya96@gmail.com> wrote:
> 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>

Thanks, 1 patch applied to wireless-drivers-next.git:

f9f905b00b87 libertas: Remove create_workqueue

-- 
Sent by pwcli
https://patchwork.kernel.org/patch/9154703/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-16 15:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-04 13:59 [PATCH] net: wireless: marvell: libertas: Remove create_workqueue Bhaktipriya Shridhar
2016-06-04 14:29 ` Kalle Valo
2016-06-04 14:32   ` Bhaktipriya Shridhar
2016-06-05 10:22 ` Tejun Heo
2016-06-16 15:22 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).