linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: netdev@vger.kernel.org
Cc: "Aymen Sghaier" <aymen.sghaier@nxp.com>,
	"Madalin Bucur" <madalin.bucur@nxp.com>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Zhu Yanjun" <zyjzyj2000@gmail.com>,
	"Samuel Chessman" <chessman@tux.org>,
	"Ping-Ke Shih" <pkshih@realtek.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"Horia Geantă" <horia.geanta@nxp.com>,
	linux-rdma@vger.kernel.org,
	"Rain River" <rain.1986.08.12@gmail.com>,
	"Kalle Valo" <kvalo@codeaurora.org>,
	"Ulrich Kunitz" <kune@deine-taler.de>, "Jouni Malinen" <j@w1.fi>,
	"Daniel Drake" <dsd@gentoo.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	"Leon Romanovsky" <leon@kernel.org>,
	linuxppc-dev@lists.ozlabs.org, linux-wireless@vger.kernel.org,
	"Li Yang" <leoyang.li@nxp.com>,
	linux-crypto@vger.kernel.org, "Jon Mason" <jdmason@kudzu.us>,
	"Saeed Mahameed" <saeedm@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH net-next 12/15] net: rtlwifi: Remove in_interrupt() usage in halbtc_send_bt_mp_operation()
Date: Tue, 27 Oct 2020 23:54:51 +0100	[thread overview]
Message-ID: <20201027225454.3492351-13-bigeasy@linutronix.de> (raw)
In-Reply-To: <20201027225454.3492351-1-bigeasy@linutronix.de>

halbtc_send_bt_mp_operation() uses in_interrupt() to determine if it is
safe to invoke wait_for_completion().

The usage of in_interrupt() in drivers is phased out and Linus clearly
requested that code which changes behaviour depending on context should
either be separated or the context be conveyed in an argument passed by the
caller, which usually knows the context.

Aside of that in_interrupt() is not correct as it does not catch preempt
disabled regions which neither can sleep.

halbtc_send_bt_mp_operation() is called from:

 rtl_watchdog_wq_callback()
   rtl_btc_periodical()
     halbtc_get()
       case BTC_GET_U4_BT_PATCH_VER:
         halbtc_get_bt_patch_version()

 which is preemtible context.

   rtl_c2h_content_parsing()
     btc_ops->btc_btinfo_notify()
       rtl_btc_btinfo_notify()
         exhalbtc_bt_info_notify()
           ex_btc8723b1ant_bt_info_notify()
	   ex_btc8821a1ant_bt_info_notify()
	   ex_btc8821a2ant_bt_info_notify()
             btcoexist->btc_set_bt_reg()
               halbtc_set_bt_reg()

   rtl_c2h_content_parsing() is in turn called from:

   rtl_c2hcmd_wq_callback()
     rtl_c2hcmd_launcher()

   which is preemptible context and from:

   _rtl_pci_rx_interrupt
     rtl_c2hcmd_enqueue()

   which is obviously not preemptible but limited to C2H_BT_MP commands
   which does invoke rtl_c2h_content_parsing().

Aside of that it can be reached from:

     halbtc_get()
       case BTC_GET_U4_SUPPORTED_FEATURE:
         halbtc_get_bt_coex_supported_feature()
       case BTC_GET_U4_BT_FORBIDDEN_SLOT_VAL:
         halbtc_get_bt_forbidden_slot_val()
       case BTC_GET_U4_BT_DEVICE_INFO:
         halbtc_get_bt_device_info()
       case BTC_GET_U4_SUPPORTED_VERSION:
         halbtc_get_bt_coex_supported_version()
       case BTC_GET_U4_SUPPORTED_FEATURE:
         halbtc_get_bt_coex_supported_feature()

   btcoexist->btc_get_bt_afh_map_from_bt()
     halbtc_get_bt_afh_map_from_bt()

   btcoexist->btc_get_ble_scan_para_from_bt()
     halbtc_get_ble_scan_para_from_bt()

   btcoexist->btc_get_ble_scan_type_from_bt()
     halbtc_get_ble_scan_type_from_bt()

   btcoexist->btc_get_ant_det_val_from_bt()
     halbtc_get_ant_det_val_from_bt()

   btcoexist->btc_get_bt_coex_supported_version()
     halbtc_get_bt_coex_supported_version()

   btcoexist->btc_get_bt_coex_supported_feature()
     halbtc_get_bt_coex_supported_feature()

None of these have a caller. Welcome to the wonderful world of HALs and
onion layers.

Remove in_interrupt() check.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
---
 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
index 2155a6699ef8d..be4c0e60d44d1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -240,9 +240,6 @@ bool halbtc_send_bt_mp_operation(struct btc_coexist *btcoexist, u8 op_code,
 	rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
 		"btmpinfo wait req_num=%d wait=%ld\n", req_num, wait_ms);
 
-	if (in_interrupt())
-		return false;
-
 	if (wait_for_completion_timeout(&btcoexist->bt_mp_comp,
 					msecs_to_jiffies(wait_ms)) == 0) {
 		rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
-- 
2.28.0


  parent reply	other threads:[~2020-10-27 23:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 22:54 [PATCH net-next 00/15] in_interrupt() cleanup, part 2 Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 01/15] net: orinoco: Remove BUG_ON(in_interrupt/irq()) Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 02/15] net: neterion: s2io: Replace in_interrupt() for context detection Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 03/15] net: forcedeth: Replace context and lock check with a lockdep_assert() Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 04/15] net: mlx5: Replace in_irq() usage Sebastian Andrzej Siewior
2020-10-31 16:59   ` Jakub Kicinski
2020-11-02 21:41     ` Saeed Mahameed
2020-11-03 19:31     ` Saeed Mahameed
2020-10-27 22:54 ` [PATCH net-next 05/15] net: tlan: " Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 06/15] net: airo: Invoke airo_read_wireless_stats() directly Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 07/15] net: airo: Always use JOB_STATS and JOB_EVENT Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 08/15] net: airo: Replace in_atomic() usage Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 09/15] net: hostap: Remove in_atomic() check Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 10/15] net: zd1211rw: Remove in_atomic() usage Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 11/15] net: rtlwifi: Remove in_interrupt() usage in is_any_client_connect_to_ap() Sebastian Andrzej Siewior
2020-10-27 22:54 ` Sebastian Andrzej Siewior [this message]
2020-10-27 22:54 ` [PATCH net-next 13/15] soc/fsl/qbman: Add an argument to signal if NAPI processing is required Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 14/15] net: dpaa: Replace in_irq() usage Sebastian Andrzej Siewior
2020-10-31 17:12   ` Jakub Kicinski
2020-11-01 23:04     ` Sebastian Andrzej Siewior
2020-10-27 22:54 ` [PATCH net-next 15/15] crypto: caam: " Sebastian Andrzej Siewior
2020-10-30 18:29 ` [PATCH net-next 00/15] in_interrupt() cleanup, part 2 Jakub Kicinski
2020-10-31 17:08 ` Jakub Kicinski

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=20201027225454.3492351-13-bigeasy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=aymen.sghaier@nxp.com \
    --cc=chessman@tux.org \
    --cc=davem@davemloft.net \
    --cc=dsd@gentoo.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=horia.geanta@nxp.com \
    --cc=j@w1.fi \
    --cc=jdmason@kudzu.us \
    --cc=kuba@kernel.org \
    --cc=kune@deine-taler.de \
    --cc=kvalo@codeaurora.org \
    --cc=leon@kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=madalin.bucur@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=rain.1986.08.12@gmail.com \
    --cc=saeedm@nvidia.com \
    --cc=tglx@linutronix.de \
    --cc=zyjzyj2000@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).