All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Andre Guedes <andre.guedes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v5 03/15] Bluetooth: Check pending command in start_discovery()
Date: Sat, 15 Oct 2011 11:30:48 -0700	[thread overview]
Message-ID: <1318703467.15441.66.camel@aeonflux> (raw)
In-Reply-To: <1317856847-28167-4-git-send-email-andre.guedes@openbossa.org>

Hi Andre,

> If discovery procedure is already running then EINPROGRESS command
> status should be returned.
> 
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
>  net/bluetooth/mgmt.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index cc0c204..d8333e0 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -1622,6 +1622,12 @@ static int start_discovery(struct sock *sk, u16 index)
>  
>  	hci_dev_lock_bh(hdev);
>  
> +	if (mgmt_pending_find(MGMT_OP_START_DISCOVERY, index)) {
> +		err = cmd_status(sk, index, MGMT_OP_START_DISCOVERY,
> +								EINPROGRESS);
> +		goto failed;
> +	}
> +

I still do not like this at all. There should be a flag that clearly
identifies if we are doing a discovery right now or not.

We need a flag on per controller to know if currently a discovery is
going on. And going through all controllers and all pending commands to
figure this out seems not a good idea. Even with a low amount of pending
commands, then mgmt_pending_find is an expensive operation.

>  	cmd = mgmt_pending_add(sk, MGMT_OP_START_DISCOVERY, index, NULL, 0);
>  	if (!cmd) {
>  		err = -ENOMEM;

The other question I have is why we have to duplicate the parameters
when adding a command to the list. Why not keep a reference of the SKB?

Regards

Marcel




  reply	other threads:[~2011-10-15 18:30 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05 23:20 [PATCH v5 00/15] Discovery procedure support Andre Guedes
2011-10-05 23:20 ` [PATCH v5 01/15] Bluetooth: Periodic Inquiry and mgmt discovering event Andre Guedes
2011-10-05 23:20 ` [PATCH v5 02/15] Bluetooth: Add mgmt_discovery_complete() Andre Guedes
2011-10-05 23:20 ` [PATCH v5 03/15] Bluetooth: Check pending command in start_discovery() Andre Guedes
2011-10-15 18:30   ` Marcel Holtmann [this message]
2011-10-17 12:59     ` Andre Guedes
2011-10-05 23:20 ` [PATCH v5 04/15] Bluetooth: Check pending commands in stop_discovery() Andre Guedes
2011-10-15 18:33   ` Marcel Holtmann
2011-10-05 23:20 ` [PATCH v5 05/15] Bluetooth: Create hci_do_inquiry() Andre Guedes
2011-10-05 23:20 ` [PATCH v5 06/15] Bluetooth: Create hci_cancel_inquiry() Andre Guedes
2011-10-05 23:20 ` [PATCH v5 07/15] Bluetooth: Handle race condition in Discovery Andre Guedes
2011-10-05 23:20 ` [PATCH v5 08/15] Bluetooth: Prepare for full support discovery procedures Andre Guedes
2011-10-06 18:50   ` Gustavo Padovan
2011-10-06 20:30     ` Andre Guedes
2011-10-07 19:51       ` Gustavo Padovan
2011-10-10 16:47         ` Andre Guedes
2011-10-05 23:20 ` [PATCH v5 09/15] Bluetooth: Send mgmt_discovering events Andre Guedes
2011-10-05 23:20 ` [PATCH v5 10/15] Bluetooth: Add 'eir_len' param to mgmt_device_found() Andre Guedes
2011-10-05 23:20 ` [PATCH v5 11/15] Bluetooth: Report LE devices Andre Guedes
2011-10-05 23:20 ` [PATCH v5 12/15] Bluetooth: Add LE Set Scan Parameter Command Andre Guedes
2011-10-05 23:20 ` [PATCH v5 13/15] Bluetooth: LE scan infra-structure Andre Guedes
2011-10-06 19:06   ` Gustavo Padovan
2011-10-06 20:31     ` Andre Guedes
2011-10-07 20:12       ` Gustavo Padovan
2011-10-07 20:31         ` Johan Hedberg
2011-10-10 16:48         ` Andre Guedes
2011-10-15 18:18           ` Marcel Holtmann
2011-10-17 12:50             ` Andre Guedes
2011-10-05 23:20 ` [PATCH v5 14/15] Bluetooth: Support LE-Only discovery procedure Andre Guedes
2011-10-05 23:20 ` [PATCH v5 15/15] Bluetooth: Support BR/EDR/LE " Andre Guedes

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=1318703467.15441.66.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=andre.guedes@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /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.