diff mbox series

[2/5] rsi: add hci detach for hibernation and poweroff

Message ID 1548397802-12180-3-git-send-email-siva8118@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series rsi: wowlan debug support and fixes | expand

Commit Message

Siva Rebbagondla Jan. 25, 2019, 6:29 a.m. UTC
From: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>

As we missed to detach HCI, while entering power off or hibernation,
an extra hci interface gets created whenever system is woken up, to
avoid this we added hci_detach() in rsi_disconnect(), rsi_freeze(),
and rsi_shutdown() functions which are invoked for these tests.
This patch fixes the issue

Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
---
 drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 +++++++++++++++++++--
 drivers/net/wireless/rsi/rsi_91x_usb.c  |  6 ++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

Comments

Kalle Valo Jan. 28, 2019, 9:29 a.m. UTC | #1
Siva Rebbagondla <siva8118@gmail.com> writes:

> From: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
>
> As we missed to detach HCI, while entering power off or hibernation,
> an extra hci interface gets created whenever system is woken up, to
> avoid this we added hci_detach() in rsi_disconnect(), rsi_freeze(),
> and rsi_shutdown() functions which are invoked for these tests.
> This patch fixes the issue
>
> Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> ---
>  drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 +++++++++++++++++++--
>  drivers/net/wireless/rsi/rsi_91x_usb.c  |  6 ++++++
>  2 files changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> index b412b65e..59ff778 100644
> --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
> +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> @@ -1131,7 +1131,12 @@ static void rsi_disconnect(struct sdio_func *pfunction)
>  
>  	rsi_mac80211_detach(adapter);
>  	mdelay(10);
> -
> +#ifdef CONFIG_RSI_COEX
> +	if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
> +		rsi_bt_ops.detach(adapter->priv->bt_adapter);
> +		adapter->priv->bt_adapter = NULL;
> +	}
> +#endif

Ifdefs are ugly, avoid them as much as possible. Would this work:

        if (IS_ENABLED(CONFIG_RSI_COEX) &&
            adapter->priv->coex_mode > 1 &&
            adapter->priv->bt_adapter)

BTW, why do you need the ifdef anyway, isn't it enough to check for
coex_mode?
Siva Rebbagondla Jan. 28, 2019, 9:38 a.m. UTC | #2
Hi Kalle,
On Mon, Jan 28, 2019 at 2:59 PM Kalle Valo <kvalo@codeaurora.org> wrote:
>
> Siva Rebbagondla <siva8118@gmail.com> writes:
>
> > From: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> >
> > As we missed to detach HCI, while entering power off or hibernation,
> > an extra hci interface gets created whenever system is woken up, to
> > avoid this we added hci_detach() in rsi_disconnect(), rsi_freeze(),
> > and rsi_shutdown() functions which are invoked for these tests.
> > This patch fixes the issue
> >
> > Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
> > ---
> >  drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 +++++++++++++++++++--
> >  drivers/net/wireless/rsi/rsi_91x_usb.c  |  6 ++++++
> >  2 files changed, 25 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > index b412b65e..59ff778 100644
> > --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> > @@ -1131,7 +1131,12 @@ static void rsi_disconnect(struct sdio_func *pfunction)
> >
> >       rsi_mac80211_detach(adapter);
> >       mdelay(10);
> > -
> > +#ifdef CONFIG_RSI_COEX
> > +     if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
> > +             rsi_bt_ops.detach(adapter->priv->bt_adapter);
> > +             adapter->priv->bt_adapter = NULL;
> > +     }
> > +#endif
>
> Ifdefs are ugly, avoid them as much as possible. Would this work:
>
>         if (IS_ENABLED(CONFIG_RSI_COEX) &&
>             adapter->priv->coex_mode > 1 &&
>             adapter->priv->bt_adapter)
>
> BTW, why do you need the ifdef anyway, isn't it enough to check for
> coex_mode?
Agreed. It's enough to check coex_mode with above if condition. I will
make the changes and will submit v2.

Thanks,
Siva Rebbagondla
>
>
> --
> Kalle Valo
diff mbox series

Patch

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index b412b65e..59ff778 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -1131,7 +1131,12 @@  static void rsi_disconnect(struct sdio_func *pfunction)
 
 	rsi_mac80211_detach(adapter);
 	mdelay(10);
-
+#ifdef CONFIG_RSI_COEX
+	if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
+		rsi_bt_ops.detach(adapter->priv->bt_adapter);
+		adapter->priv->bt_adapter = NULL;
+	}
+#endif
 	/* Reset Chip */
 	rsi_reset_chip(adapter);
 
@@ -1308,6 +1313,13 @@  static int rsi_freeze(struct device *dev)
 		rsi_dbg(ERR_ZONE,
 			"##### Device can not wake up through WLAN\n");
 
+#ifdef CONFIG_RSI_COEX
+	if (common->coex_mode > 1 && common->bt_adapter) {
+		rsi_bt_ops.detach(common->bt_adapter);
+		common->bt_adapter = NULL;
+	}
+#endif
+
 	ret = rsi_sdio_disable_interrupts(pfunction);
 
 	if (sdev->write_fail)
@@ -1354,7 +1366,12 @@  static void rsi_shutdown(struct device *dev)
 
 	if (rsi_config_wowlan(adapter, wowlan))
 		rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n");
-
+#ifdef CONFIG_RSI_COEX
+	if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
+		rsi_bt_ops.detach(adapter->priv->bt_adapter);
+		adapter->priv->bt_adapter = NULL;
+	}
+#endif
 	rsi_sdio_disable_interrupts(sdev->pfunction);
 
 	if (sdev->write_fail)
diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c
index f360690..be20fd1 100644
--- a/drivers/net/wireless/rsi/rsi_91x_usb.c
+++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
@@ -816,6 +816,12 @@  static void rsi_disconnect(struct usb_interface *pfunction)
 		return;
 
 	rsi_mac80211_detach(adapter);
+#ifdef CONFIG_RSI_COEX
+	if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
+		rsi_bt_ops.detach(adapter->priv->bt_adapter);
+		adapter->priv->bt_adapter = NULL;
+	}
+#endif
 	rsi_reset_card(adapter);
 	rsi_deinit_usb_interface(adapter);
 	rsi_91x_deinit(adapter);