Search Linux Wireless

Re: [PATCH v5 1/2] Bluetooth: btmrvl: add setup handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bing,

> Move initialization code to hdev's setup handler. New flag
> setup_done is added to make sure that initialization is done only
> during driver load time. Our firmware doesn't expect
> re-initialization later when interface is re-enabled.
> 
> Signed-off-by: Amitkumar Karwar <akarwar@xxxxxxxxxxx>
> Signed-off-by: Bing Zhao <bzhao@xxxxxxxxxxx>
> ---
> v5: make use of hdev's setup handler (Marcel Holtmann)
> 
> drivers/bluetooth/btmrvl_drv.h  |    1 +
> drivers/bluetooth/btmrvl_main.c |   23 +++++++++++++++++++++--
> drivers/bluetooth/btmrvl_sdio.c |    6 ------
> 3 files changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h
> index 27068d1..e776b8b 100644
> --- a/drivers/bluetooth/btmrvl_drv.h
> +++ b/drivers/bluetooth/btmrvl_drv.h
> @@ -68,6 +68,7 @@ struct btmrvl_adapter {
> 	wait_queue_head_t cmd_wait_q;
> 	u8 cmd_complete;
> 	bool is_suspended;
> +	bool setup_done;
> };
> 
> struct btmrvl_private {
> diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
> index 9a9f518..e352f8e 100644
> --- a/drivers/bluetooth/btmrvl_main.c
> +++ b/drivers/bluetooth/btmrvl_main.c
> @@ -479,6 +479,27 @@ static int btmrvl_open(struct hci_dev *hdev)
> 	return 0;
> }
> 
> +static int btmrvl_setup(struct hci_dev *hdev)
> +{
> +	struct btmrvl_private *priv = hci_get_drvdata(hdev);
> +	struct btmrvl_adapter *adapter = priv->adapter;
> +
> +	if (adapter->setup_done)
> +		return 0;
> +
> +	btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
> +
> +	priv->btmrvl_dev.psmode = 1;
> +	btmrvl_enable_ps(priv);
> +
> +	priv->btmrvl_dev.gpio_gap = 0xffff;
> +	btmrvl_send_hscfg_cmd(priv);
> +
> +	adapter->setup_done = true;
> +
> +	return 0;
> +}
> +
> /*
>  * This function handles the event generated by firmware, rx data
>  * received from firmware, and tx data sent from kernel.
> @@ -572,8 +592,7 @@ int btmrvl_register_hdev(struct btmrvl_private *priv)
> 	hdev->flush = btmrvl_flush;
> 	hdev->send = btmrvl_send_frame;
> 	hdev->ioctl = btmrvl_ioctl;
> -
> -	btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
> +	hdev->setup = btmrvl_setup;

just to make sure you guys understand how ->setup() works. It is only called once. Bringing the adapter down and up again does not call ->setup() a second time. So do you guys need this setup_done variable and if so, then you need to be a bit more verbose and help me understand why.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux