Linux bluetooth development
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 4/8] Bluetooth: Add support for user data in hci_request
Date: Fri, 9 May 2014 13:27:48 +0300	[thread overview]
Message-ID: <20140509102748.GA31552@t440s.lan> (raw)
In-Reply-To: <5725B981-E83A-467E-80ED-18B9C8FE285F@holtmann.org>

Hi Marcel,

On Thu, May 08, 2014, Marcel Holtmann wrote:
> > This patch makes possible to store some user data in hci_request struct
> > which will be available in completion callback. Data can be added when
> > initializing new request using hci_req_init(). With this it's now easy
> > to run request which can be associated with e.g. specific hci_conn.
> > 
> > Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
> > ---
> > include/net/bluetooth/bluetooth.h |  3 +-
> > include/net/bluetooth/hci_core.h  |  3 +-
> > net/bluetooth/hci_conn.c          |  4 +-
> > net/bluetooth/hci_core.c          | 29 +++++++++-----
> > net/bluetooth/mgmt.c              | 84 +++++++++++++++++++++------------------
> > 5 files changed, 69 insertions(+), 54 deletions(-)
> > 
> > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
> > index 904777c1..28378ad 100644
> > --- a/include/net/bluetooth/bluetooth.h
> > +++ b/include/net/bluetooth/bluetooth.h
> > @@ -273,12 +273,13 @@ struct l2cap_ctrl {
> > 
> > struct hci_dev;
> > 
> > -typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status);
> > +typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status, void *data);
> > 
> > struct hci_req_ctrl {
> > 	bool			start;
> > 	u8			event;
> > 	hci_req_complete_t	complete;
> > +	void			*data;
> > };
> > 
> > struct bt_skb_cb {
> > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> > index 211bad6..30d245f 100644
> > --- a/include/net/bluetooth/hci_core.h
> > +++ b/include/net/bluetooth/hci_core.h
> > @@ -1162,6 +1162,7 @@ int hci_unregister_cb(struct hci_cb *hcb);
> > struct hci_request {
> > 	struct hci_dev		*hdev;
> > 	struct sk_buff_head	cmd_q;
> > +	void			*data;
> > 
> > 	/* If something goes wrong when building the HCI request, the error
> > 	 * value is stored in this field.
> > @@ -1169,7 +1170,7 @@ struct hci_request {
> > 	int			err;
> > };
> > 
> > -void hci_req_init(struct hci_request *req, struct hci_dev *hdev);
> > +void hci_req_init(struct hci_request *req, struct hci_dev *hdev, void *data);
> 
> do we really want to have everybody add extra data in here. We are now
> touching every possible call that we have so far. I do not really like
> this at the moment.

Maybe hci_sent_cmd_data() could be used instead to help look up the
connection that the completed command was targeting?

Johan

  parent reply	other threads:[~2014-05-09 10:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08 13:32 [PATCH 0/8] Get Connection Information Andrzej Kaczmarek
2014-05-08 13:32 ` [PATCH 1/8] Bluetooth: Store RSSI for connection Andrzej Kaczmarek
2014-05-08 15:03   ` Marcel Holtmann
2014-05-08 13:32 ` [PATCH 2/8] Bluetooth: Store TX power level " Andrzej Kaczmarek
2014-05-08 15:03   ` Marcel Holtmann
2014-05-08 13:32 ` [PATCH 3/8] Bluetooth: Move eir_append_data up Andrzej Kaczmarek
2014-05-08 13:32 ` [PATCH 4/8] Bluetooth: Add support for user data in hci_request Andrzej Kaczmarek
2014-05-08 15:32   ` Marcel Holtmann
2014-05-08 19:41     ` Andrzej Kaczmarek
2014-05-09 10:27     ` Johan Hedberg [this message]
2014-05-09 11:04       ` Andrzej Kaczmarek
2014-05-08 13:32 ` [PATCH 5/8] Bluetooth: Add support to get connection information Andrzej Kaczmarek
2014-05-08 14:20   ` Szymon Janc
2014-05-08 15:26   ` Marcel Holtmann
2014-05-08 19:57     ` Andrzej Kaczmarek
2014-05-08 13:32 ` [PATCH 6/8] Bluetooth: Make min interval for connection information configurable Andrzej Kaczmarek
2014-05-08 15:27   ` Marcel Holtmann
2014-05-08 13:32 ` [PATCH 7/8] Bluetooth: Avoid pooling TX power for LE links Andrzej Kaczmarek
2014-05-08 15:29   ` Marcel Holtmann
2014-05-08 20:06     ` Andrzej Kaczmarek
2014-05-08 13:32 ` [PATCH 8/8] Bluetooth: Add support for max_tx_power in Get Conn Info Andrzej Kaczmarek

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=20140509102748.GA31552@t440s.lan \
    --to=johan.hedberg@gmail.com \
    --cc=andrzej.kaczmarek@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox