Re: [PATCH v4 2/4] Bluetooth: btusb: add callback function in btusb suspend/resume

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

 



Hi Chris,

On Thu, Jun 6, 2024 at 7:43 AM Chris Lu <chris.lu@xxxxxxxxxxxx> wrote:
>
> Add new function: dev_suspend/dev_resume in btusb_data which are reserved
> for vendor specific usage during suspend/resume. dev_suspend will be
> added before stop traffic in btusb_suspend and dev_resume will be
> added after resubmit urb in btusb_resuem.
>
> Signed-off-by: Chris Lu <chris.lu@xxxxxxxxxxxx>
> Signed-off-by: Sean Wang <sean.wang@xxxxxxxxxxxx>
> ---
>  drivers/bluetooth/btusb.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 79aefdb3324d..83765c0c14b4 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -891,6 +891,9 @@ struct btusb_data {
>
>         int (*setup_on_usb)(struct hci_dev *hdev);
>
> +       int (*dev_suspend)(struct hci_dev *hdev);
> +       int (*dev_resume)(struct hci_dev *hdev);

I'd name these suspend, resume respectively.

>         int oob_wake_irq;   /* irq for out-of-band wake-on-bt */
>         unsigned cmd_timeout_cnt;
>
> @@ -4715,6 +4718,9 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
>
>         cancel_work_sync(&data->work);
>
> +       if (data->dev_suspend)
> +               data->dev_suspend(data->hdev);
> +
>         btusb_stop_traffic(data);
>         usb_kill_anchored_urbs(&data->tx_anchor);
>
> @@ -4818,6 +4824,9 @@ static int btusb_resume(struct usb_interface *intf)
>                         btusb_submit_isoc_urb(hdev, GFP_NOIO);
>         }
>
> +       if (data->dev_resume)
> +               data->dev_resume(hdev);
> +
>         spin_lock_irq(&data->txlock);
>         play_deferred(data);
>         clear_bit(BTUSB_SUSPENDING, &data->flags);
> --
> 2.18.0
>


-- 
Luiz Augusto von Dentz





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux