netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
To: Pkshih <pkshih@realtek.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"tony0620emma@gmail.com" <tony0620emma@gmail.com>,
	"kvalo@codeaurora.org" <kvalo@codeaurora.org>,
	"johannes@sipsolutions.net" <johannes@sipsolutions.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Neo Jou <neojou@gmail.com>,
	Jernej Skrabec <jernej.skrabec@gmail.com>
Subject: Re: [PATCH 3/9] rtw88: Move rtw_update_sta_info() out of rtw_ra_mask_info_update_iter()
Date: Fri, 7 Jan 2022 22:44:13 +0100	[thread overview]
Message-ID: <CAFBinCBUJHWb+VpLdqDh49RSX9oMPjCxU1hzzqsCL31ouG=zmw@mail.gmail.com> (raw)
In-Reply-To: <1e9ed12ac55e42beb2197524c524e69f@realtek.com>

Hi Ping-Ke,

On Fri, Jan 7, 2022 at 9:42 AM Pkshih <pkshih@realtek.com> wrote:
[...]
>
> > @@ -699,11 +702,20 @@ static void rtw_ra_mask_info_update(struct rtw_dev *rtwdev,
> >                                   const struct cfg80211_bitrate_mask *mask)
> >  {
> >       struct rtw_iter_bitrate_mask_data br_data;
> > +     unsigned int i;
> > +
> > +     mutex_lock(&rtwdev->mutex);
>
> I think this lock is used to protect br_data.si[i], right?
Correct, I chose this lock because it's also used in
rtw_ops_sta_remove() and rtw_ops_sta_add() (which could modify the
data in br_data.si[i]).

> And, I prefer to move mutex lock to caller, like:
>
> @@ -734,7 +734,9 @@ static int rtw_ops_set_bitrate_mask(struct ieee80211_hw *hw,
>  {
>         struct rtw_dev *rtwdev = hw->priv;
>
> +       mutex_lock(&rtwdev->mutex);
>         rtw_ra_mask_info_update(rtwdev, vif, mask);
> +       mutex_unlock(&rtwdev->mutex);
>
>         return 0;
>  }
Thank you for this hint - if I do it like you suggest then the locking
will be consistent with other functions.
I'll send a v3 with this fixed.


Best regards,
Martin

  reply	other threads:[~2022-01-07 21:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-28 21:14 [PATCH 0/9] rtw88: prepare locking for SDIO support Martin Blumenstingl
2021-12-28 21:14 ` [PATCH 1/9] mac80211: Add stations iterator where the iterator function may sleep Martin Blumenstingl
2021-12-28 21:14 ` [PATCH 2/9] rtw88: Move rtw_chip_cfg_csi_rate() out of rtw_vif_watch_dog_iter() Martin Blumenstingl
2021-12-28 21:14 ` [PATCH 3/9] rtw88: Move rtw_update_sta_info() out of rtw_ra_mask_info_update_iter() Martin Blumenstingl
2022-01-07  8:42   ` Pkshih
2022-01-07 21:44     ` Martin Blumenstingl [this message]
2021-12-28 21:14 ` [PATCH 4/9] rtw88: Use rtw_iterate_vifs where the iterator reads or writes registers Martin Blumenstingl
2021-12-28 21:14 ` [PATCH 5/9] rtw88: Use rtw_iterate_stas " Martin Blumenstingl
2021-12-28 21:14 ` [PATCH 6/9] rtw88: Replace usage of rtw_iterate_keys_rcu() with rtw_iterate_keys() Martin Blumenstingl
2021-12-28 21:14 ` [PATCH 7/9] rtw88: Configure the registers from rtw_bf_assoc() outside the RCU lock Martin Blumenstingl
2021-12-28 21:15 ` [PATCH 8/9] rtw88: hci: Convert rf_lock from a spinlock to a mutex Martin Blumenstingl
2021-12-28 21:15 ` [PATCH 9/9] rtw88: fw: Convert h2c.lock " Martin Blumenstingl
2022-01-07  9:19 ` [PATCH 0/9] rtw88: prepare locking for SDIO support Pkshih
2022-01-07 21:49   ` Martin Blumenstingl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFBinCBUJHWb+VpLdqDh49RSX9oMPjCxU1hzzqsCL31ouG=zmw@mail.gmail.com' \
    --to=martin.blumenstingl@googlemail.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=neojou@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=tony0620emma@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).