Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1633811

Re: [PATCH v2 1/2] mwifiex: initiate card-specific work atomically

From Brian Norris <briannorris@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/2] mwifiex: initiate card-specific work atomically
Date 2017-05-01 20:50 +0200
Message-ID <tCoyu-4dM-13@gated-at.bofh.it> (permalink)
References <tCoyu-4dM-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, May 01, 2017 at 11:45:48AM -0700, Brian Norris wrote:
> The non-atomic test + set is a little awkward here, and it technically
> means we might double-schedule work unnecessarily. AFAICT, this is not
> really a problem, since the extra "work" will be a no-op (the flag(s)
> will be cleared by then), but it's still an anti-pattern.
> 
> Rewrite this to use the atomic test_and_set_bit() helper instead.
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---
> new in v2
> ---
>  drivers/net/wireless/marvell/mwifiex/pcie.c | 13 +++++++++----
>  drivers/net/wireless/marvell/mwifiex/sdio.c | 16 +++++-----------
>  2 files changed, 14 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
> index ac62bce50e96..8e7d6f41a952 100644
> --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
> +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
> @@ -2837,12 +2837,17 @@ static void mwifiex_pcie_device_dump(struct mwifiex_adapter *adapter)
>  {
>  	struct pcie_service_card *card = adapter->card;
>  
> -	if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags))
> -		return;
> +	if (!test_and_set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
> +			      &card->work_flags))
> +		schedule_work(&card->work);
> +}
>  
> -	set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags);
> +static void mwifiex_pcie_card_reset(struct mwifiex_adapter *adapter)
> +{
> +	struct pcie_service_card *card = adapter->card;
>  
> -	schedule_work(&card->work);
> +	if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags))
> +		schedule_work(&card->work);
>  }
>  
>  static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter)

Ooops, mis-split on patch 1 vs. 2. This won't be bisectable! Sorry,
please ignore! Will send v3 soon.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/2] mwifiex: initiate card-specific work atomically Brian Norris <briannorris@chromium.org> - 2017-05-01 20:50 +0200
  [PATCH v2 2/2] mwifiex: pcie: add card_reset() support Brian Norris <briannorris@chromium.org> - 2017-05-01 20:50 +0200
  Re: [PATCH v2 1/2] mwifiex: initiate card-specific work atomically Brian Norris <briannorris@chromium.org> - 2017-05-01 20:50 +0200

csiph-web