All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: "Gustavo F. Padovan" <padovan@profusion.mobi>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [RFC 17/22] Bluetooth: remove power_on work_struct
Date: Sat, 17 Dec 2011 14:13:37 -0800	[thread overview]
Message-ID: <1324160017.1965.90.camel@aeonflux> (raw)
In-Reply-To: <1324157382-1815-18-git-send-email-padovan@profusion.mobi>

Hi Gustavo,

> Since now we run in process context, we can now call hci_power_on
> directly.
> 
> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
> ---
>  include/net/bluetooth/hci_core.h |    2 +-
>  net/bluetooth/hci_core.c         |    7 ++-----
>  net/bluetooth/mgmt.c             |    2 +-
>  3 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index 5d1bb51..662877a 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -187,7 +187,6 @@ struct hci_dev {
>  
>  	struct workqueue_struct	*workqueue;
>  
> -	struct work_struct	power_on;
>  	struct delayed_work	power_off;
>  
>  	__u16			discov_timeout;
> @@ -597,6 +596,7 @@ int hci_register_dev(struct hci_dev *hdev);
>  void hci_unregister_dev(struct hci_dev *hdev);
>  int hci_suspend_dev(struct hci_dev *hdev);
>  int hci_resume_dev(struct hci_dev *hdev);
> +void hci_power_on(struct hci_dev *hdev);
>  int hci_dev_open(__u16 dev);
>  int hci_dev_close(__u16 dev);
>  int hci_dev_reset(__u16 dev);
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index fbc7968..5c7fec8 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -928,10 +928,8 @@ void hci_free_dev(struct hci_dev *hdev)
>  }
>  EXPORT_SYMBOL(hci_free_dev);
>  
> -static void hci_power_on(struct work_struct *work)
> +void hci_power_on(struct hci_dev *hdev)
>  {
> -	struct hci_dev *hdev = container_of(work, struct hci_dev, power_on);
> -
>  	BT_DBG("%s", hdev->name);
>  
>  	if (hci_dev_open(hdev->id) < 0)
> @@ -1490,7 +1488,6 @@ int hci_register_dev(struct hci_dev *hdev)
>  	INIT_LIST_HEAD(&hdev->adv_entries);
>  
>  	INIT_DELAYED_WORK(&hdev->adv_work, hci_clear_adv_cache);
> -	INIT_WORK(&hdev->power_on, hci_power_on);
>  	INIT_DELAYED_WORK(&hdev->power_off, hci_power_off);
>  
>  	INIT_DELAYED_WORK(&hdev->discov_off, hci_discov_off);
> @@ -1522,7 +1519,7 @@ int hci_register_dev(struct hci_dev *hdev)
>  
>  	set_bit(HCI_AUTO_OFF, &hdev->flags);
>  	set_bit(HCI_SETUP, &hdev->flags);
> -	queue_work(hdev->workqueue, &hdev->power_on);
> +	hci_power_on(hdev);
>  
>  	hci_notify(hdev, HCI_DEV_REG);
>  
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index ad4817c..30cbdd7 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -415,7 +415,7 @@ static int set_powered(struct sock *sk, u16 index, unsigned char *data, u16 len)
>  	}
>  
>  	if (cp->val)
> -		queue_work(hdev->workqueue, &hdev->power_on);
> +		hci_power_on(hdev);
>  	else
>  		queue_work(hdev->workqueue, &hdev->power_off.work);

this is a bad idea. We are running with the hdev->workqueue now here we
do not wanna interrupt this. So I would rather leave this one out for
now. At least until we figured out on what is the best solution.

Obviously we should push it onto the system workqueue instead of
hdev->workqueue.

Regards

Marcel



  parent reply	other threads:[~2011-12-17 22:13 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-17 21:29 [RFC 00/22] Bluetooth: change tasklets to workqueue Gustavo F. Padovan
2011-12-17 21:29 ` [RFC 01/22] Bluetooth: Process recv path in a workqueue instead of a tasklet Gustavo F. Padovan
2011-12-17 21:29   ` [RFC 02/22] Bluetooth: Replace spin_lock by mutex in hci_dev Gustavo F. Padovan
2011-12-17 21:29     ` [RFC 03/22] Bluetooth: Use delayed_work for connection timeout Gustavo F. Padovan
2011-12-17 21:29       ` [RFC 04/22] Bluetooth: Use delayed work for advertisiment cache timeout Gustavo F. Padovan
2011-12-17 21:29         ` [RFC 05/22] Bluetooth: hci_conn_auto_accept() doesn't need locking Gustavo F. Padovan
2011-12-17 21:29           ` [RFC 06/22] Bluetooth: Move L2CAP timers to workqueue Gustavo F. Padovan
2011-12-17 21:29             ` [RFC 07/22] Bluetooth: Don't use spin_lock socket lock anymore Gustavo F. Padovan
2011-12-17 21:29               ` [RFC 08/22] Bluetooth: Remove sk_backlog usage from L2CAP Gustavo F. Padovan
2011-12-17 21:29                 ` [RFC 09/22] Bluetooth: move hci_task_lock to mutex Gustavo F. Padovan
2011-12-17 21:29                   ` [RFC 10/22] Bluetooth: convert chan_lock " Gustavo F. Padovan
2011-12-17 21:29                     ` [RFC 11/22] Bluetooth: Use RCU to manipulate chan_list Gustavo F. Padovan
2011-12-17 21:29                       ` [RFC 12/22] Bluetooth: convert conn hash to RCU Gustavo F. Padovan
2011-12-17 21:29                         ` [RFC 13/22] Bluetooth: Don't disable tasklets to call hdev->notify() Gustavo F. Padovan
2011-12-17 21:29                           ` [RFC 14/22] Bluetooth: Move command task to workqueue Gustavo F. Padovan
2011-12-17 21:29                             ` [RFC 15/22] Bluetooth: convert tx_task " Gustavo F. Padovan
2011-12-17 21:29                               ` [RFC 16/22] Bluetooth: convert info timer to delayed_work Gustavo F. Padovan
2011-12-17 21:29                                 ` [RFC 17/22] Bluetooth: remove power_on work_struct Gustavo F. Padovan
2011-12-17 21:29                                   ` [RFC 18/22] Bluetooth: invert locking order in connect path Gustavo F. Padovan
2011-12-17 21:29                                     ` [RFC 19/22] Bluetooth: Change l2cap chan_list to use RCU Gustavo F. Padovan
2011-12-17 21:29                                       ` [RFC 20/22] Bluetooth: move power_off to system workqueue Gustavo F. Padovan
2011-12-17 21:29                                         ` [RFC 21/22] Bluetooth: Use new alloc_workqueue() Gustavo F. Padovan
2011-12-17 21:29                                           ` [RFC 22/22] Bluetooth: Remove work_add and work_del from hci_sysfs Gustavo F. Padovan
2011-12-17 22:15                                       ` [RFC 19/22] Bluetooth: Change l2cap chan_list to use RCU Marcel Holtmann
2011-12-19 10:42                                       ` Andrei Emeltchenko
2011-12-19 13:53                                         ` Gustavo Padovan
2011-12-17 22:13                                   ` Marcel Holtmann [this message]
2012-01-26 13:20                       ` [RFC 11/22] Bluetooth: Use RCU to manipulate chan_list Andrei Emeltchenko
2011-12-19  9:58                     ` [RFC 10/22] Bluetooth: convert chan_lock to mutex Andrei Emeltchenko
2011-12-19  9:53               ` [RFC 07/22] Bluetooth: Don't use spin_lock socket lock anymore Andrei Emeltchenko
2011-12-19 11:05             ` [RFC 06/22] Bluetooth: Move L2CAP timers to workqueue Andrei Emeltchenko
2011-12-19 12:59               ` Ulisses Furquim
2011-12-17 21:34 ` [RFC 00/22] Bluetooth: change tasklets " Gustavo Padovan
2011-12-17 22:17 ` Marcel Holtmann

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=1324160017.1965.90.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=padovan@profusion.mobi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.