* pull request: bluetooth-next-2.6 2010-10-13
From: Gustavo F. Padovan @ 2010-10-13 3:48 UTC (permalink / raw)
To: linville; +Cc: marcel, linux-wireless, linux-bluetooth
Hi John,
Here goes the Bluetooth patches for the next merge window. In this
patchset we have a new stream-oriented recvmsg() which is used in L2CAP
and RFCOMM. Support for two new MacBookPro devices. A buffer overflow
check for L2CAP to prevent frames exceeding the receiving MTU. All the
rest are simple bugfixes. No big features this time.
One notable change is in the MAINTAINERS file, From now and on I'm going
to maintain the Bluetooth trees as well as send the pull requests to you.
Despite this maintenance change, Marcel will remain helping with patch
review, and ACK/NAK in the Bluetooth subsystem as he always did. Not a
big change in the end. ;)
Thanks,
The following changes since commit 29b4433d991c88d86ca48a4c1cc33c671475be4b:
net: percpu net_device refcount (2010-10-12 12:35:25 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-next-2.6.git master
Andrei Emeltchenko (4):
Bluetooth: remove extra newline from debug output
Bluetooth: check L2CAP length in first ACL fragment
Bluetooth: check for l2cap header in start fragment
Bluetooth: clean up rfcomm code
David Vrabel (2):
Bluetooth: HCI devices are either BR/EDR or AMP radios
Bluetooth: Support SDIO devices that are AMP controllers
Gustavo F. Padovan (4):
Bluetooth: remove unused variable from cmtp
Bluetooth: make batostr() print in the right order
Bluetooth: Use the proper error value from bt_skb_send_alloc()
Bluetooth: update MAINTAINERS for Bluetooth subsys
Haijun Liu (1):
Bluetooth: Update conf_state before send config_req out
Johan Hedberg (1):
Bluetooth: Don't clear the blacklist when closing the HCI device
Karl Beldan (1):
Bluetooth: hci_uart: Fix typo in stats for sco tx
Mat Martineau (4):
Bluetooth: Validate PSM values in calls to connect() and bind()
Bluetooth: Add common code for stream-oriented recvmsg()
Bluetooth: Use common SOCK_STREAM receive code in RFCOMM
Bluetooth: Use a stream-oriented recvmsg with SOCK_STREAM L2CAP sockets.
Nobuhiro Iwamatsu (2):
Bluetooth: Add support Bluetooth controller of MacbookPro 6,2
Bluetooth: Add support Bluetooth controller of MacbookPro 7,1
Yuri Kululin (1):
Bluetooth: Fix RFCOMM RPN negotiation
MAINTAINERS | 5 ++-
drivers/bluetooth/btmrvl_main.c | 4 +-
drivers/bluetooth/btsdio.c | 8 +++
drivers/bluetooth/btusb.c | 6 ++
drivers/bluetooth/hci_ldisc.c | 2 +-
include/linux/mmc/sdio_ids.h | 1 +
include/net/bluetooth/bluetooth.h | 2 +
include/net/bluetooth/hci.h | 2 +-
include/net/bluetooth/rfcomm.h | 5 --
net/bluetooth/af_bluetooth.c | 109 +++++++++++++++++++++++++++++++++++++
net/bluetooth/cmtp/core.c | 6 +--
net/bluetooth/hci_core.c | 1 -
net/bluetooth/hci_sysfs.c | 21 ++-----
net/bluetooth/hidp/core.c | 8 +--
net/bluetooth/l2cap.c | 56 ++++++++++++++++---
net/bluetooth/lib.c | 4 +-
net/bluetooth/rfcomm/core.c | 39 +++++++-------
net/bluetooth/rfcomm/sock.c | 104 ++---------------------------------
net/bluetooth/rfcomm/tty.c | 4 +-
19 files changed, 218 insertions(+), 169 deletions(-)
--
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi
^ permalink raw reply
* Re: Firmware versioning best practices: ath3k-2.fw rename or replace ath3k-1.fw ?
From: Henry Ptasinski @ 2010-10-12 21:17 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Suraj Sumangala, Luis Rodriguez, David Woodhouse, Marcel Holtmann,
linux-bluetooth, linux-kernel@vger.kernel.org, linux-wireless,
Henry Ptasinski
In-Reply-To: <20101008181508.GM10149@tux>
On Fri, Oct 08, 2010 at 11:15:08AM -0700, Luis R. Rodriguez wrote:
> On Fri, Oct 08, 2010 at 10:27:36AM -0700, Suraj Sumangala wrote:
> > Marcel had answered me before. It makes sense to have same file name.
> > Other ways we end up changing the driver whenever there is a firmware
> > change.
>
> > > I last tried to document a thread we had over this here:
> > >
> > > http://wireless.kernel.org/en/developers/Documentation/firmware-versioning
> > >
>
> Thanks, I've updated that link above to document bug fixing does not require
> a filename change.
I don't really understand why you would not want to change the code revision
part of the filename.
I totally agree that you don't want to change the driver every time the
firmware gets a bug fix, but wasn't that the whole point of splitting the name
into API and code revisions portions, and symlinking the file to one that just
has the API version?
What's the issue with using the process as originally documented?
- Henry
^ permalink raw reply
* RE: RFC: btusb firmware load help
From: Kevin Hayes @ 2010-10-12 13:38 UTC (permalink / raw)
To: Marcel Holtmann, Shanmugamkamatchi Balashanmugam
Cc: Shanmugamkamatchi Balashanmugam, Luis Rodriguez, Johannes Berg,
linux-bluetooth, linux-kernel@vger.kernel.org,
linux-wireless@vger.kernel.org, Deepak Dhamdhere, Sree Durbha
In-Reply-To: <1286469741.6145.165.camel@aeonflux>
SGkgTWFyY2VsLCBCYWxhLA0KDQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJv
bTogbGludXgtYmx1ZXRvb3RoLW93bmVyQHZnZXIua2VybmVsLm9yZyBbbWFpbHRvOmxpbnV4LWJs
dWV0b290aC0NCj4gb3duZXJAdmdlci5rZXJuZWwub3JnXSBPbiBCZWhhbGYgT2YgTWFyY2VsIEhv
bHRtYW5uDQo+IFNlbnQ6IFRodXJzZGF5LCBPY3RvYmVyIDA3LCAyMDEwIDk6NDIgQU0NCj4gVG86
IFNoYW5tdWdhbWthbWF0Y2hpIEJhbGFzaGFubXVnYW0NCj4gQ2M6IFNoYW5tdWdhbWthbWF0Y2hp
IEJhbGFzaGFubXVnYW07IEx1aXMgUm9kcmlndWV6OyBKb2hhbm5lcyBCZXJnOw0KPiBsaW51eC1i
bHVldG9vdGg7IGxpbnV4LWtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc7IGxpbnV4LQ0KPiB3aXJlbGVz
c0B2Z2VyLmtlcm5lbC5vcmc7IERlZXBhayBEaGFtZGhlcmU7IFNyZWUgRHVyYmhhDQo+IFN1Ympl
Y3Q6IFJlOiBSRkM6IGJ0dXNiIGZpcm13YXJlIGxvYWQgaGVscA0KPiANCj4gSGkgQmFsYSwNCj4g
DQo+ID4gPj4gVGhhbmtzIEpvaGFubmVzLiAgVGhpcyB3b3VsZCBiZSBiZXR0ZXIgb3B0aW9uIHRv
IGNoYW5nZSBQSUQgaW4NCj4gZmlybXdhcmUNCj4gPiA+PiBhcyBibGFja2xpc3RpbmcgMzAwMiBt
aWdodCBjcmVhdGUgcHJvYmxlbXMgZm9yIDMwMTEgY2hpcHNldHMuDQo+ID4gPj4gV2lsbCB0cnkg
YW5kIGxldCB5b3UgcGVvcGxlIGtub3cuDQo+ID4gPiBUaGUgbWlzYmVoYXZpbmcgMzAwMiBuZWVk
cyB0byBiZSBibGFja2xpc3RlZCBpbiBidHVzYi5jIGFueXdheS4NCj4gSG93ZXZlcg0KPiA+ID4g
YWZ0ZXIgbG9hZGluZyB0aGUgZmlybXdhcmUgdG8gMzAwMiBkZXZpY2UsIGl0IHNob3VsZCBjaGFu
Z2UgaXRzIFBJRA0KPiB0bw0KPiA+ID4gc29tZXRoaW5nIGVsc2UuDQo+ID4gPg0KPiA+ID4gSSBh
bSBzdGlsbCB0cnlpbmcgdG8gZmlndXJlIG91dCBpZiB0aGlzIGlzIG9uZSBzdGFnZSBmaXJtd2Fy
ZQ0KPiBsb2FkaW5nIG9yDQo+ID4gPiBhIHR3byBzdGFnZSBmaXJtd2FyZSBsb2FkaW5nLiBUaGlz
IGlzIGFsbCBwcmV0dHkgdW5jbGVhciBhbmQgbm9ib2R5DQo+IGhhcw0KPiA+ID4gYW5zd2VyZWQg
dGhpcyBjbGVhcmx5IHNvIGZhci4NCj4gPg0KPiA+IGVlcHJvbSBiYXNlZCAzMDExIGNoaXBzIGNv
bWVzIHVwIHdpdGggUElEIDMwMDAgZ2l2aW5nIGNvbnRyb2wgdG8gREZVDQo+ID4gZHJpdmVyIFth
dGgza10uICBhdGgzayBkb3dubG9hZHMgdGhlDQo+ID4gZmlybXdhcmUgY2hhbmdpbmcgUElEIHRv
IDMwMDIuICBOb3cgYnR1c2IgZ2V0cyBjb250cm9sLg0KPiA+DQo+ID4gSW4gc2ZsYXNoIGJhc2Vk
IGRldmljZXMgdG8gcmVkdWNlIHdpbmRvd3Mgc3VzcGVuZC9yZXN1bWUgdGltZSB3ZSBoYWQNCj4g
YQ0KPiA+IHNtYWxsIGZpcm13YXJlIGluIGZsYXNoIHdoaWNoDQo+ID4gZW5hYmxlcyB0aGUgZGV2
aWNlIHRvIGdldCBkZXRlY3RlZCBhcyBHZW5lcmljIEJsdWV0b290aCBVU0IgZGV2aWNlDQo+IHdp
dGgNCj4gPiBQSUQgMzAwMi4gIFNvIGNvbnRyb2wgcmVhY2hlcyBidHVzYiB3aGVuIGRldmljZSBp
cyBwbHVnZ2VkIGluLA0KPiBsZWF2aW5nDQo+ID4gbm8gb3B0aW9uIGZvciB1cyB0byBsb2FkIHRo
ZSBhY3R1YWwgZmlybXdhcmUuDQo+ID4NCj4gPiBTb2x1dGlvbiB3b3VsZCBiZSB0byBibGFja2xp
c3QgMzAwMiBpbiBidHVzYiwgZW5hYmxlIGF0aDNrIHRvIGdldA0KPiA+IGNvbnRyb2wgZm9yIGJv
dGggdGhlIGRldmljZXMsIGRvd25sb2FkIHRoZSBmaXJtd2FyZSBhbmQgY2hhbmdlIFBJRCB0bw0K
PiA+IDMwMDMgc28gdGhhdCBjb250cm9sIHdpdGggY29tZSB0byBidHVzYi4NCj4gDQo+IHNvIGhl
cmUgaXMgdGhlIHRoaW5nIHRoYXQgbmVlZHMgdG8gYmUgZG9uZS4NCj4gDQo+IGEpIEdldCBhIGZp
cm13YXJlIGZvciBQSUQgMzAwMCBkZXZpY2VzIHRoYXQgY2hhbmdlIHRoZSBmaXJtd2FyZSB0byBz
b21lDQo+IG90aGVyIFBJRC4gU2luY2UgMzAwMyBpcyBhbHJlYWR5IGluIHVzZSBhcyB3ZWxsLCB1
c2luZyAzMDA0IG9yIGxhdGVyIGlzDQo+IGJldHRlciBhcHByb2FjaC4NCj4gDQo+IGIpIEJsYWNr
bGlzdCBQSUQgMzAwMiBpbiBidHVzYi5jLg0KPiANCj4gYykgSGFuZGxlIHNwZWNpYWwgZmlybXdh
cmUgbG9hZGluZyBjYXNlIGZvciBQSUQgMzAwMiBzZmxhc2ggZGV2aWNlcy4gSWYNCj4gZmlybXdh
cmUgaXMgbG9hZGVkIGNoYW5nZWQgdG8gMzAwNSBvciBvdGhlci4NCj4gDQo+IEFuZCBhcyBhIGdl
bmVyYWwgbm90ZSwgSSBwcmVmZXIgdGhhdCB0aGUgUElEIGFmdGVyIGxvYWRpbmcgZmlybXdhcmUg
aXMNCj4gZGlmZmVyZW50IGlmIHlvdSBkb24ndCBoYXBwZW4gdG8gYWN0dWFsbHkgbG9hZCB0aGUg
c2FtZSBmaXJtd2FyZS4NCj4gDQo+IFNvIHBsZWFzZSBzb3J0IG91dCB5b3VyIFVTQiBQSUQgYXNz
aWdubWVudCBmb3IgQmx1ZXRvb3RoIGluIGdlbmVyYWwuDQo+IFRoaXMgc2VlbXMgdG8gYmUgYSBt
ZXNzIHRoYXQgaXMgbm90IHRob3VnaHQgdGhyb3VnaCBwcm9wZXJseS4NCj4gDQo+IFJlZ2FyZHMN
Cj4gDQo+IE1hcmNlbA0KPiANCg0KWWVzLCBpdCBpcyBhIGdvb2QgaWRlYSB0byBsZXQgdGhlIGRv
d25sb2FkYWJsZSBmaXJtd2FyZSBzZXQgYSBuZXcgUElELCBhbG9uZyB3aXRoIHRoZSBibGFja2xp
c3Qgb24gdGhlIDMwMDIgUElEIGZvciB0aGUgZmlyc3QgZ28gcm91bmQuICBJIGVtcGhhc2l6ZSwg
aXQgaXMgdGhlIGRvd25sb2FkZWQgZmlybXdhcmUgdGhhdCB3aWxsIGJlIHJlcXVpcmVkIHRvIGRv
IHRoZSBQSUQgc3dpenpsaW5nLCBub3QgdGhlIHNmbGFzaCBmaXJtd2FyZS4gIEFuZCBJIGFncmVl
IHdlIHNob3VsZCBoYXZlIGEgbWFwIG9mIHRoZSBQSURzIGluIHVzZSBhbmQgd2hhdCB0aGV5IGFy
ZSB1c2VkIGZvciwgb25jZSB3ZSBnZXQgdGhyb3VnaCB0aGlzIGltbWVkaWF0ZSBmaXhpbmcgcGhh
c2UuDQoNClRoYW5rcywNCg0KCUsrKw0KDQoNCg0K
^ permalink raw reply
* Re: [PATCH 2/7] Bluetooth: Add LE connect support
From: Ville Tervo @ 2010-10-12 12:50 UTC (permalink / raw)
To: ext Gustavo F. Padovan; +Cc: Marcel Holtmann, linux-bluetooth@vger.kernel.org
In-Reply-To: <20101007163619.GB4893@vigoh>
On Thu, Oct 07, 2010 at 06:36:20PM +0200, ext Gustavo F. Padovan wrote:
> Hi Ville,
>
> * Marcel Holtmann <marcel@holtmann.org> [2010-10-07 12:58:09 +0200]:
>
> > Hi Ville,
> >
> > > Add logic to create LE connections.
>
>
> Could you be more verbose on the commit message, that way people can
> understand better what you are doing in the patch. ;)
Sure.
>
> > >
> > > Signed-off-by: Ville Tervo <ville.tervo@nokia.com>
> > > ---
> > > include/net/bluetooth/hci.h | 1 +
> > > include/net/bluetooth/hci_core.h | 6 ++-
> > > net/bluetooth/hci_conn.c | 38 ++++++++++++++-
> > > net/bluetooth/hci_event.c | 100 +++++++++++++++++++++++++++++++++++++-
> > > 4 files changed, 141 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> > > index b86aed5..b326240 100644
> > > --- a/include/net/bluetooth/hci.h
> > > +++ b/include/net/bluetooth/hci.h
> > > @@ -162,6 +162,7 @@ enum {
> > > #define SCO_LINK 0x00
> > > #define ACL_LINK 0x01
> > > #define ESCO_LINK 0x02
> > > +#define LE_LINK 0x03
> >
> > this is not a value defined by the specification, while the others are.
> > And some functions match these to HCI event. So if wanna do it like
> > this, then using something like 0x80 is better.
>
> A comment in the code saying that is also a good ideia.
Done
--
VIlle
^ permalink raw reply
* Re: [PATCH 2/7] Bluetooth: Add LE connect support
From: Ville Tervo @ 2010-10-12 12:50 UTC (permalink / raw)
To: ext Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1286449089.6145.91.camel@aeonflux>
Hi Marcel,
Thanks for the review. Could you comments on hci_connect?
On Thu, Oct 07, 2010 at 12:58:09PM +0200, ext Marcel Holtmann wrote:
> Hi Ville,
>
> > Add logic to create LE connections.
> >
> > Signed-off-by: Ville Tervo <ville.tervo@nokia.com>
> > ---
> > include/net/bluetooth/hci.h | 1 +
> > include/net/bluetooth/hci_core.h | 6 ++-
> > net/bluetooth/hci_conn.c | 38 ++++++++++++++-
> > net/bluetooth/hci_event.c | 100 +++++++++++++++++++++++++++++++++++++-
> > 4 files changed, 141 insertions(+), 4 deletions(-)
> >
> > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> > index b86aed5..b326240 100644
> > --- a/include/net/bluetooth/hci.h
> > +++ b/include/net/bluetooth/hci.h
> > @@ -162,6 +162,7 @@ enum {
> > #define SCO_LINK 0x00
> > #define ACL_LINK 0x01
> > #define ESCO_LINK 0x02
> > +#define LE_LINK 0x03
>
> this is not a value defined by the specification, while the others are.
> And some functions match these to HCI event. So if wanna do it like
> this, then using something like 0x80 is better.
Done with some explanation why 0x80 is used.
> > /* LMP features */
> > #define LMP_3SLOT 0x01
> > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> > index ebec8c9..89f4b10 100644
> > --- a/include/net/bluetooth/hci_core.h
> > +++ b/include/net/bluetooth/hci_core.h
> > @@ -170,6 +170,7 @@ struct hci_conn {
> > bdaddr_t dst;
> > __u16 handle;
> > __u16 state;
> > + __u16 le_state;
>
> I don't see the need for a separate state here. The LE link is different
> from an ACL link and also from a SCO link. We will create a new hci_conn
> for each type of link.
I removed le_state completely.
> > __u8 mode;
> > __u8 type;
> > __u8 out;
> > @@ -203,6 +204,7 @@ struct hci_conn {
> > struct hci_dev *hdev;
> > void *l2cap_data;
> > void *sco_data;
> > + void *le_data;
> > void *priv;
>
> What is the use of le_data here?
No use. Some left over earlier version.
> > struct hci_conn *link;
> > @@ -272,7 +274,7 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
> > {
> > struct hci_conn_hash *h = &hdev->conn_hash;
> > list_add(&c->list, &h->list);
> > - if (c->type == ACL_LINK)
> > + if (c->type == ACL_LINK || c->type == LE_LINK)
> > h->acl_num++;
> > else
> > h->sco_num++;
> > @@ -282,7 +284,7 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
> > {
> > struct hci_conn_hash *h = &hdev->conn_hash;
> > list_del(&c->list);
> > - if (c->type == ACL_LINK)
> > + if (c->type == ACL_LINK || c->type == LE_LINK)
> > h->acl_num--;
> > else
> > h->sco_num--;
>
> I would assume that counting LE connection separately would be way
> better. We could have ACL link to one device and LE link to another.
Done
> > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> > index 145993f..cb41d64 100644
> > --- a/net/bluetooth/hci_conn.c
> > +++ b/net/bluetooth/hci_conn.c
> > @@ -45,6 +45,27 @@
> > #include <net/bluetooth/bluetooth.h>
> > #include <net/bluetooth/hci_core.h>
> >
> > +void hci_le_connect(struct hci_conn *conn)
> > +{
> > + struct hci_dev *hdev = conn->hdev;
> > + struct hci_cp_le_create_conn cp;
> > +
> > + conn->le_state = BT_CONNECT;
> > + conn->out = 1;
> > +
> > + memset(&cp, 0, sizeof(cp));
> > + cp.scan_interval = cpu_to_le16(0x0004);
> > + cp.scan_window = cpu_to_le16(0x0004);
> > + bacpy(&cp.peer_addr, &conn->dst);
> > + cp.conn_interval_min = cpu_to_le16(0x0008);
> > + cp.conn_interval_max = cpu_to_le16(0x0100);
> > + cp.supervision_timeout = cpu_to_le16(0x0064);
> > + cp.min_ce_len = cpu_to_le16(0x0001);
> > + cp.max_ce_len = cpu_to_le16(0xffff);
> > +
> > + hci_send_cmd(hdev, HCI_OP_LE_CREATE_CONN, sizeof(cp), &cp);
> > +}
> > +
> > void hci_acl_connect(struct hci_conn *conn)
> > {
> > struct hci_dev *hdev = conn->hdev;
> > @@ -365,15 +386,30 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src)
> > }
> > EXPORT_SYMBOL(hci_get_route);
> >
> > -/* Create SCO or ACL connection.
> > +/* Create SCO, ACL or LE connection.
> > * Device _must_ be locked */
> > struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type)
> > {
> > struct hci_conn *acl;
> > struct hci_conn *sco;
> > + struct hci_conn *le;
> >
> > BT_DBG("%s dst %s", hdev->name, batostr(dst));
> >
> > + if (type == LE_LINK) {
> > + le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
> > +
> > + if (!le)
> > + le = hci_conn_add(hdev, LE_LINK, dst);
> > +
> > + if (!le)
> > + return NULL;
> > +
> > + hci_le_connect(le);
> > +
> > + return le;
> > + }
> > +
> > if (!(acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst))) {
> > if (!(acl = hci_conn_add(hdev, ACL_LINK, dst)))
> > return NULL;
>
> No liking it this much. We might have to re-think on how to do things
> here.
Could you eloborate which part you dislike? I'm leaving this currently like it was.
> > diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> > index d3c68de..0b979ae 100644
> > --- a/net/bluetooth/hci_event.c
> > +++ b/net/bluetooth/hci_event.c
> > @@ -868,6 +868,44 @@ static void hci_cc_le_set_scan(struct hci_dev *hdev, struct sk_buff *skb)
> > hci_req_complete(hdev, status);
> > }
> >
> > +static void hci_cs_le_create_conn(struct hci_dev *hdev, __u8 status)
> > +{
> > + struct hci_cp_le_create_conn *cp;
> > + struct hci_conn *conn;
> > +
> > + BT_DBG("%s status 0x%x", hdev->name, status);
> > +
> > + cp = hci_sent_cmd_data(hdev, HCI_OP_LE_CREATE_CONN);
> > + if (!cp)
> > + return;
> > +
> > + hci_dev_lock(hdev);
> > +
> > + conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->peer_addr);
> > +
> > + BT_DBG("%s bdaddr %s conn %p", hdev->name, batostr(&cp->peer_addr),
> > + conn);
> > +
> > + if (status) {
> > + if (conn && conn->le_state == BT_CONNECT) {
> > + conn->le_state = BT_CLOSED;
> > + hci_proto_connect_cfm(conn, status);
> > + hci_conn_del(conn);
> > + }
> > + } else {
> > + if (!conn) {
> > + conn = hci_conn_add(hdev, LE_LINK, &cp->peer_addr);
> > + if (conn) {
> > + conn->out = 1;
> > + conn->link_mode |= HCI_LM_MASTER;
> > + } else
> > + BT_ERR("No memory for new connection");
> > + }
> > + }
> > +
> > + hci_dev_unlock(hdev);
> > +}
>
> Do we have the master/slave association with LE?
Yes. But it cannot be changed like in legacy bluetooth connection. conn->out
and conn->link_mode |= HCI_LM_MASTER are redutant information. I removed
conn->link_mode setting.
> > static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
> > {
> > __u8 status = *((__u8 *) skb->data);
> > @@ -1069,7 +1107,10 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff
> >
> > conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
> > if (conn) {
> > - conn->state = BT_CLOSED;
> > + if (conn->type == LE_LINK)
> > + conn->le_state = BT_CLOSED;
> > + else
> > + conn->state = BT_CLOSED;
>
> If we would just use conn->state then this should not be needed.
>
> > hci_proto_disconn_cfm(conn, ev->reason);
> > hci_conn_del(conn);
> > @@ -1430,6 +1471,10 @@ static inline void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
> > hci_cs_exit_sniff_mode(hdev, ev->status);
> > break;
> >
> > + case HCI_OP_LE_CREATE_CONN:
> > + hci_cs_le_create_conn(hdev, ev->status);
> > + break;
> > +
> > default:
> > BT_DBG("%s opcode 0x%x", hdev->name, opcode);
> > break;
> > @@ -1875,6 +1920,55 @@ static inline void hci_remote_host_features_evt(struct hci_dev *hdev, struct sk_
> > hci_dev_unlock(hdev);
> > }
> >
> > +static inline void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
> > +{
> > + struct hci_ev_le_conn_complete *ev = (void *) skb->data;
> > + struct hci_conn *conn;
> > +
> > + BT_DBG("%s status %d", hdev->name, ev->status);
> > +
> > + hci_dev_lock(hdev);
> > +
> > + conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &ev->bdaddr);
> > +
> > + if (!conn)
> > + goto unlock;
>
> The empty line between conn assignment and check should be removed.
Done
>
> > +
> > + if (ev->status) {
> > + hci_proto_connect_cfm(conn, ev->status);
> > + conn->le_state = BT_CLOSED;
> > + hci_conn_del(conn);
> > + goto unlock;
> > + }
> > +
> > + conn->handle = __le16_to_cpu(ev->handle);
> > + conn->le_state = BT_CONNECTED;
> > +
> > + hci_conn_hold_device(conn);
> > + hci_conn_add_sysfs(conn);
> > +
> > + hci_proto_connect_cfm(conn, ev->status);
> > +unlock:
> > + hci_dev_unlock(hdev);
>
> And here you should have an empty line between the label and the last
> statement before the label.
Done
> > +}
> > +
> > +static inline void hci_le_meta_evt(struct hci_dev *hdev, struct sk_buff *skb)
> > +{
> > + struct hci_ev_le_meta *le_ev = (void *) skb->data;
> > + __u8 event = le_ev->subevent;
>
> Why?
>
> > +
> > + skb_pull(skb, sizeof(*le_ev));
> > +
> > + switch (event) {
>
> Using le_ev->subevent would be just fine here.
Done
> > + case HCI_EV_LE_CONN_COMPLETE:
> > + hci_le_conn_complete_evt(hdev, skb);
> > + break;
> > +
> > + default:
> > + break;
> > + }
> > +}
> > +
> > void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
> > {
> > struct hci_event_hdr *hdr = (void *) skb->data;
> > @@ -2011,6 +2105,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
> > hci_remote_host_features_evt(hdev, skb);
> > break;
> >
> > + case HCI_EV_LE_META:
> > + hci_le_meta_evt(hdev, skb);
> > + break;
> > +
> > default:
> > BT_DBG("%s event 0x%x", hdev->name, event);
> > break;
>
--
Ville
^ permalink raw reply
* Re: Pull request git://gitorious.org/bluez-mcap-hdp/mcap-hdp.git for_upstream
From: Johan Hedberg @ 2010-10-12 10:15 UTC (permalink / raw)
To: Jose Antonio Santos Cadenas; +Cc: linux-bluetooth
In-Reply-To: <AANLkTikapHztx_w9mWxotJBuofYHnxMExd88V+8ng40E@mail.gmail.com>
Hi Jose,
On Tue, Oct 12, 2010, Jose Antonio Santos Cadenas wrote:
> >> On Tue, Oct 12, 2010, Jose Antonio Santos Cadenas wrote:
> >>> I'm sorry but I can't connect to the IRC rigth now. Nevertheless, I
> >>> think that I've found the issues:
> >>>
> >>> - The iochannel should be unrefereed when the watcher is explicitly removed
> >>
> >> Yes, though do you need to have a reference at all? As long as you have
> >> the GLib watch callback GLib itself holds a reference, so if you don't
> >> need one just remove chan->echo_chan and do an unref after calling
> >> add_watch.
> >
> > Sorry I've forgot this one. Gonna solve it.
>
> Solved, I've removed the chan->echo_chan attribute and directly unref
> the io_channel once the watcher is set.
Thanks. The patches have now been pushed upstream.
Johan
^ permalink raw reply
* Re: Pull request git://gitorious.org/bluez-mcap-hdp/mcap-hdp.git for_upstream
From: Jose Antonio Santos Cadenas @ 2010-10-12 10:10 UTC (permalink / raw)
To: Jose Antonio Santos Cadenas, linux-bluetooth; +Cc: Johan Hedberg
In-Reply-To: <AANLkTikPOQm0MBQVL7Ax=v8nfp5wJCY+W5=9Fqn384Ur@mail.gmail.com>
2010/10/12 Jose Antonio Santos Cadenas <santoscadenas@gmail.com>:
> 2010/10/12 Johan Hedberg <johan.hedberg@gmail.com>:
>> Hi Jose,
>>
>> On Tue, Oct 12, 2010, Jose Antonio Santos Cadenas wrote:
>>> I'm sorry but I can't connect to the IRC rigth now. Nevertheless, I
>>> think that I've found the issues:
>>>
>>> - The iochannel should be unrefereed when the watcher is explicitly removed
>>
>> Yes, though do you need to have a reference at all? As long as you have
>> the GLib watch callback GLib itself holds a reference, so if you don't
>> need one just remove chan->echo_chan and do an unref after calling
>> add_watch.
>
> Sorry I've forgot this one. Gonna solve it.
Solved, I've removed the chan->echo_chan attribute and directly unref
the io_channel once the watcher is set.
>
>>
>>> - The commit message s/paramter/parameter
>>>
>>> Are there any more?
>>
>> s/Imcoming/Incoming/
>> s/DBus/D-Bus/
>>
>> And the following doesn't make much sense to me:
>>
>> "Delete all channels DBus interface when the instance is removed"
>>
>> Could you rephrase it somehow, maybe by putting most of it in the
>> message body instead of the summary line. Is it trying to say "Delete
>> the D-Bus interfaces of all channels"? The summary line shouldn't be too
>> complex. You can just say "Fix D-Bus channel removal when removing
>> instances" and then in the message body do the more detailed
>> explanation.
>>
>> Johan
>>
>
^ permalink raw reply
* Re: Pull request git://gitorious.org/bluez-mcap-hdp/mcap-hdp.git for_upstream
From: Jose Antonio Santos Cadenas @ 2010-10-12 10:02 UTC (permalink / raw)
To: Jose Antonio Santos Cadenas, linux-bluetooth; +Cc: Johan Hedberg
In-Reply-To: <20101012093531.GA22165@jh-x301>
2010/10/12 Johan Hedberg <johan.hedberg@gmail.com>:
> Hi Jose,
>
> On Tue, Oct 12, 2010, Jose Antonio Santos Cadenas wrote:
>> I'm sorry but I can't connect to the IRC rigth now. Nevertheless, I
>> think that I've found the issues:
>>
>> - The iochannel should be unrefereed when the watcher is explicitly removed
>
> Yes, though do you need to have a reference at all? As long as you have
> the GLib watch callback GLib itself holds a reference, so if you don't
> need one just remove chan->echo_chan and do an unref after calling
> add_watch.
Sorry I've forgot this one. Gonna solve it.
>
>> - The commit message s/paramter/parameter
>>
>> Are there any more?
>
> s/Imcoming/Incoming/
> s/DBus/D-Bus/
>
> And the following doesn't make much sense to me:
>
> "Delete all channels DBus interface when the instance is removed"
>
> Could you rephrase it somehow, maybe by putting most of it in the
> message body instead of the summary line. Is it trying to say "Delete
> the D-Bus interfaces of all channels"? The summary line shouldn't be too
> complex. You can just say "Fix D-Bus channel removal when removing
> instances" and then in the message body do the more detailed
> explanation.
>
> Johan
>
^ permalink raw reply
* Re: Pull request git://gitorious.org/bluez-mcap-hdp/mcap-hdp.git for_upstream
From: Jose Antonio Santos Cadenas @ 2010-10-12 9:57 UTC (permalink / raw)
To: Jose Antonio Santos Cadenas, linux-bluetooth
In-Reply-To: <20101012093531.GA22165@jh-x301>
Hi,
2010/10/12 Johan Hedberg <johan.hedberg@gmail.com>:
> Hi Jose,
>
> On Tue, Oct 12, 2010, Jose Antonio Santos Cadenas wrote:
>> I'm sorry but I can't connect to the IRC rigth now. Nevertheless, I
>> think that I've found the issues:
>>
>> - The iochannel should be unrefereed when the watcher is explicitly removed
>
> Yes, though do you need to have a reference at all? As long as you have
> the GLib watch callback GLib itself holds a reference, so if you don't
> need one just remove chan->echo_chan and do an unref after calling
> add_watch.
>
>> - The commit message s/paramter/parameter
>>
>> Are there any more?
>
> s/Imcoming/Incoming/
Solved this one
> s/DBus/D-Bus/
>
> And the following doesn't make much sense to me:
>
> "Delete all channels DBus interface when the instance is removed"
>
> Could you rephrase it somehow, maybe by putting most of it in the
> message body instead of the summary line. Is it trying to say "Delete
> the D-Bus interfaces of all channels"? The summary line shouldn't be too
> complex. You can just say "Fix D-Bus channel removal when removing
> instances" and then in the message body do the more detailed
> explanation.
I've changed the commit message and added an explanation. I hope now is clearer.
>
> Johan
>
Regards.
Jose.
^ permalink raw reply
* Re: [PATCH 4/4] Fix possible use of uninitialized variables
From: Johan Hedberg @ 2010-10-12 9:39 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1286870891-5862-4-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Tue, Oct 12, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> Using uninitialized value "hi" and "flags" in call to function
> "OBEX_ObjectAddHeader".
> ---
> src/obex.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
And this one has also been pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 3/4] Fix dead statement
From: Johan Hedberg @ 2010-10-12 9:39 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1286870891-5862-3-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Tue, Oct 12, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> Cannot reach dead statement "(*os->driver->close)(object);"
> ---
> src/obex.c | 8 +-------
> 1 files changed, 1 insertions(+), 7 deletions(-)
This one is also upstream.
Johan
^ permalink raw reply
* Re: [PATCH 2/4] Fix possible NULL pointer deference
From: Johan Hedberg @ 2010-10-12 9:38 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1286870891-5862-2-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Tue, Oct 12, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> Variable "transfer" tracked as NULL was passed to function
> "transfer_unregister" that dereferences it.
> ---
> client/session.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
Pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 1/4] Fix possible NULL pointer deference
From: Johan Hedberg @ 2010-10-12 9:38 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1286870891-5862-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Tue, Oct 12, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> Variable "os->driver" tracked as NULL.
> ---
> src/obex.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
Pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: Pull request git://gitorious.org/bluez-mcap-hdp/mcap-hdp.git for_upstream
From: Johan Hedberg @ 2010-10-12 9:35 UTC (permalink / raw)
To: Jose Antonio Santos Cadenas; +Cc: linux-bluetooth
In-Reply-To: <AANLkTik8k84qwMM3nHc4z2gVWm6Vo0HaLME2PEcwMyeg@mail.gmail.com>
Hi Jose,
On Tue, Oct 12, 2010, Jose Antonio Santos Cadenas wrote:
> I'm sorry but I can't connect to the IRC rigth now. Nevertheless, I
> think that I've found the issues:
>
> - The iochannel should be unrefereed when the watcher is explicitly removed
Yes, though do you need to have a reference at all? As long as you have
the GLib watch callback GLib itself holds a reference, so if you don't
need one just remove chan->echo_chan and do an unref after calling
add_watch.
> - The commit message s/paramter/parameter
>
> Are there any more?
s/Imcoming/Incoming/
s/DBus/D-Bus/
And the following doesn't make much sense to me:
"Delete all channels DBus interface when the instance is removed"
Could you rephrase it somehow, maybe by putting most of it in the
message body instead of the summary line. Is it trying to say "Delete
the D-Bus interfaces of all channels"? The summary line shouldn't be too
complex. You can just say "Fix D-Bus channel removal when removing
instances" and then in the message body do the more detailed
explanation.
Johan
^ permalink raw reply
* [PATCH 4/4] Fix possible use of uninitialized variables
From: Luiz Augusto von Dentz @ 2010-10-12 8:08 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1286870891-5862-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
Using uninitialized value "hi" and "flags" in call to function
"OBEX_ObjectAddHeader".
---
src/obex.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/obex.c b/src/obex.c
index 41ba558..3e9f5b6 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -670,6 +670,9 @@ add_header:
case OBEX_HDR_APPARAM:
flags = 0;
break;
+ default:
+ error("read(): unkown header type %u", hi);
+ return -EIO;
}
OBEX_ObjectAddHeader(obex, obj, hi, hd, len, flags);
--
1.7.1
^ permalink raw reply related
* [PATCH 3/4] Fix dead statement
From: Luiz Augusto von Dentz @ 2010-10-12 8:08 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1286870891-5862-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
Cannot reach dead statement "(*os->driver->close)(object);"
---
src/obex.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/src/obex.c b/src/obex.c
index 8d12f8f..41ba558 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -882,7 +882,7 @@ int obex_get_stream_start(struct obex_session *os, const char *filename)
&size, &err);
if (object == NULL) {
error("open(%s): %s (%d)", filename, strerror(-err), -err);
- goto fail;
+ return err;
}
os->object = object;
@@ -893,12 +893,6 @@ int obex_get_stream_start(struct obex_session *os, const char *filename)
os->buf = g_malloc0(os->tx_mtu);
return 0;
-
-fail:
- if (object)
- os->driver->close(object);
-
- return err;
}
int obex_put_stream_start(struct obex_session *os, const char *filename)
--
1.7.1
^ permalink raw reply related
* [PATCH 2/4] Fix possible NULL pointer deference
From: Luiz Augusto von Dentz @ 2010-10-12 8:08 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1286870891-5862-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
Variable "transfer" tracked as NULL was passed to function
"transfer_unregister" that dereferences it.
---
client/session.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/client/session.c b/client/session.c
index 7539a97..ce3432d 100644
--- a/client/session.c
+++ b/client/session.c
@@ -1274,10 +1274,8 @@ int session_send(struct session_data *session, const char *filename,
transfer = transfer_register(session, filename, targetname, NULL,
NULL);
- if (transfer == NULL) {
- err = -EINVAL;
- goto fail;
- }
+ if (transfer == NULL)
+ return -EINVAL;
/* Transfer should start if it is the first in the pending list */
if (transfer != session->pending->data)
--
1.7.1
^ permalink raw reply related
* [PATCH 1/4] Fix possible NULL pointer deference
From: Luiz Augusto von Dentz @ 2010-10-12 8:08 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
Variable "os->driver" tracked as NULL.
---
src/obex.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/obex.c b/src/obex.c
index 92d3b5c..8d12f8f 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -589,7 +589,9 @@ static int obex_read_stream(struct obex_session *os, obex_t *obex,
os->buf = g_realloc(os->buf, os->pending + size);
memcpy(os->buf + os->pending, buffer, size);
os->pending += size;
- if (os->object == NULL) {
+
+ /* only write if both object and driver are valid */
+ if (os->object == NULL || os->driver == NULL) {
DBG("Stored %u bytes into temporary buffer", os->pending);
return 0;
}
--
1.7.1
^ permalink raw reply related
* Re: [PATCH] Bluetooth: TI_ST bluetooth driver
From: Pavan Savoy @ 2010-10-12 4:19 UTC (permalink / raw)
To: linux-bluetooth, marcel; +Cc: greg, linux-kernel, Pavan Savoy
In-Reply-To: <1286814803-6740-1-git-send-email-pavan_savoy@ti.com>
On Mon, Oct 11, 2010 at 12:33 PM, <pavan_savoy@ti.com> wrote:
> From: Pavan Savoy <pavan_savoy@ti.com>
>
> Gustavo, Marcel,
>
> I have taken care of most of the comments which you provided.
> Couple of them like usage of goto's, I didn't handle since
> I am not doing much error handling repeatedly there.
>
> I have also removed the 2 states like _REGISTERED, _RUNNING which
> were not required and the flags associated with it.
> I have taken care of other style comments.
>
> Please review and provide your comments,
Marcel,
I hope you find some time to provide comments.
Thanks,
Pavan
> -- patch description --
>
> This is the bluetooth protocol driver for the TI WiLink7 chipsets.
> Texas Instrument's WiLink chipsets combine wireless technologies
> like BT, FM, GPS and WLAN onto a single chip.
>
> This Bluetooth driver works on top of the TI_ST shared transport
> line discipline driver which also allows other drivers like
> FM V4L2 and GPS character driver to make use of the same UART interface.
>
> Kconfig and Makefile modifications to enable the Bluetooth
> driver for Texas Instrument's WiLink 7 chipset.
>
> Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
> ---
> =C2=A0drivers/bluetooth/Kconfig =C2=A0 =C2=A0| =C2=A0 10 +
> =C2=A0drivers/bluetooth/Makefile =C2=A0 | =C2=A0 =C2=A01 +
> =C2=A0drivers/bluetooth/btwilink.c | =C2=A0455 ++++++++++++++++++++++++++=
++++++++++++++++
> =C2=A03 files changed, 466 insertions(+), 0 deletions(-)
> =C2=A0create mode 100644 drivers/bluetooth/btwilink.c
>
> diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
> index 02deef4..e0d67dd 100644
> --- a/drivers/bluetooth/Kconfig
> +++ b/drivers/bluetooth/Kconfig
> @@ -219,4 +219,14 @@ config BT_ATH3K
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Say Y here to compile support for "Athe=
ros firmware download driver"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0into the kernel or say M to compile it =
as module (ath3k).
>
> +config BT_WILINK
> + =C2=A0 =C2=A0 =C2=A0 tristate "BlueZ bluetooth driver for TI ST"
> + =C2=A0 =C2=A0 =C2=A0 depends on TI_ST
> + =C2=A0 =C2=A0 =C2=A0 help
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 This enables the Bluetooth driver for Texas=
Instrument's BT/FM/GPS
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 combo devices. This makes use of shared tra=
nsport line discipline
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 core driver to communicate with the BT core=
of the combo chip.
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 Say Y here to compile support for Texas Ins=
trument's WiLink7 driver
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 into the kernel or say M to compile it as m=
odule.
> =C2=A0endmenu
> diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
> index 71bdf13..5351b62 100644
> --- a/drivers/bluetooth/Makefile
> +++ b/drivers/bluetooth/Makefile
> @@ -28,3 +28,4 @@ hci_uart-$(CONFIG_BT_HCIUART_BCSP) =C2=A0 =C2=A0+=3D hc=
i_bcsp.o
> =C2=A0hci_uart-$(CONFIG_BT_HCIUART_LL) =C2=A0 =C2=A0 =C2=A0 +=3D hci_ll.o
> =C2=A0hci_uart-$(CONFIG_BT_HCIUART_ATH3K) =C2=A0 =C2=A0+=3D hci_ath.o
> =C2=A0hci_uart-objs =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0:=3D $(hci_uart-y)
> +obj-$(CONFIG_BT_WILINK) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0:=3D btwilink.o
> diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
> new file mode 100644
> index 0000000..e0bde79
> --- /dev/null
> +++ b/drivers/bluetooth/btwilink.c
> @@ -0,0 +1,455 @@
> +/*
> + * =C2=A0Texas Instrument's Bluetooth Driver For Shared Transport.
> + *
> + * =C2=A0Bluetooth Driver acts as interface between HCI CORE and
> + * =C2=A0TI Shared Transport Layer.
> + *
> + * =C2=A0Copyright (C) 2009-2010 Texas Instruments
> + * =C2=A0Author: Raja Mani <raja_mani@ti.com>
> + * =C2=A0 =C2=A0 Pavan Savoy <pavan_savoy@ti.com>
> + *
> + * =C2=A0This program is free software; you can redistribute it and/or m=
odify
> + * =C2=A0it under the terms of the GNU General Public License version 2 =
as
> + * =C2=A0published by the Free Software Foundation.
> + *
> + * =C2=A0This program is distributed in the hope that it will be useful,
> + * =C2=A0but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * =C2=A0MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =C2=A0See =
the
> + * =C2=A0GNU General Public License for more details.
> + *
> + * =C2=A0You should have received a copy of the GNU General Public Licen=
se
> + * =C2=A0along with this program; if not, write to the Free Software
> + * =C2=A0Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA =C2=A0=
02111-1307 =C2=A0USA
> + *
> + */
> +
> +#include <linux/platform_device.h>
> +#include <net/bluetooth/bluetooth.h>
> +#include <net/bluetooth/hci_core.h>
> +
> +#include <linux/ti_wilink_st.h>
> +
> +/* Bluetooth Driver Version */
> +#define VERSION =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "1.0"
> +
> +/* Defines number of seconds to wait for reg completion
> + * callback getting called from ST (in case,registration
> + * with ST returns PENDING status)
> + */
> +#define BT_REGISTER_TIMEOUT =C2=A0 6000 =C2=A0 =C2=A0 /* 6 sec */
> +
> +/**
> + * struct ti_st - BT driver operation structure
> + * @hdev: hci device pointer which binds to bt driver
> + * @flags: used locally,to maintain various BT driver status
> + * @streg_cbdata: to hold ST registration callback status
> + * @st_write: write function pointer of ST driver
> + * @wait_for_btdrv_reg_completion - completion sync between ti_st_open
> + * =C2=A0 =C2=A0 and ti_st_registration_completion_cb.
> + */
> +struct ti_st {
> + =C2=A0 =C2=A0 =C2=A0 struct hci_dev *hdev;
> + =C2=A0 =C2=A0 =C2=A0 char streg_cbdata;
> + =C2=A0 =C2=A0 =C2=A0 long (*st_write) (struct sk_buff *);
> + =C2=A0 =C2=A0 =C2=A0 struct completion wait_for_btdrv_reg_completion;
> +};
> +
> +static int reset;
> +
> +/* Increments HCI counters based on pocket ID (cmd,acl,sco) */
> +static inline void ti_st_tx_complete(struct ti_st *hst, int pkt_type)
> +{
> + =C2=A0 =C2=A0 =C2=A0 struct hci_dev *hdev;
> + =C2=A0 =C2=A0 =C2=A0 hdev =3D hst->hdev;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Update HCI stat counters */
> + =C2=A0 =C2=A0 =C2=A0 switch (pkt_type) {
> + =C2=A0 =C2=A0 =C2=A0 case HCI_COMMAND_PKT:
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hdev->stat.cmd_tx++;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;
> +
> + =C2=A0 =C2=A0 =C2=A0 case HCI_ACLDATA_PKT:
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hdev->stat.acl_tx++;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;
> +
> + =C2=A0 =C2=A0 =C2=A0 case HCI_SCODATA_PKT:
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hdev->stat.sco_tx++;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;
> + =C2=A0 =C2=A0 =C2=A0 }
> +}
> +
> +/* ------- Interfaces to Shared Transport ------ */
> +
> +/* Called by ST layer to indicate protocol registration completion
> + * status.ti_st_open() function will wait for signal from this
> + * API when st_register() function returns ST_PENDING.
> + */
> +static void st_registration_completion_cb(void *priv_data, char data)
> +{
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *lhst =3D (struct ti_st *)priv_data;
> + =C2=A0 =C2=A0 =C2=A0 /* ti_st_open() function needs value of 'data' to =
know
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* the registration status(success/fail),So h=
ave a back
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* up of it.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 lhst->streg_cbdata =3D data;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Got a feedback from ST for BT driver registrati=
on
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* request.Wackup ti_st_open() function to co=
ntinue
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* it's open operation.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 complete(&lhst->wait_for_btdrv_reg_completion);
> +}
> +
> +/* Called by Shared Transport layer when receive data is
> + * available */
> +static long st_receive(void *priv_data, struct sk_buff *skb)
> +{
> + =C2=A0 =C2=A0 =C2=A0 int err;
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *lhst =3D (struct ti_st *)priv_data;
> +
> + =C2=A0 =C2=A0 =C2=A0 if (skb =3D=3D NULL) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Invalid SKB re=
ceived from ST");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EFAULT;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 if (!lhst) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfree_skb(skb);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Invalid ti_st =
memory,freeing SKB");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EFAULT;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 skb->dev =3D (struct net_device *)lhst->hdev;
> + =C2=A0 =C2=A0 =C2=A0 /* Forward skb to HCI CORE layer */
> + =C2=A0 =C2=A0 =C2=A0 err =3D hci_recv_frame(skb);
> + =C2=A0 =C2=A0 =C2=A0 if (err) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfree_skb(skb);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Unable to push=
skb to HCI CORE(%d),freeing SKB",
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 err);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return err;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 lhst->hdev->stat.byte_rx +=3D skb->len;
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +/* ------- Interfaces to HCI layer ------ */
> +
> +/* Called from HCI core to initialize the device */
> +static int ti_st_open(struct hci_dev *hdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 static struct st_proto_s ti_st_proto;
> + =C2=A0 =C2=A0 =C2=A0 unsigned long timeleft;
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *hst;
> + =C2=A0 =C2=A0 =C2=A0 int err;
> + =C2=A0 =C2=A0 =C2=A0 err =3D 0;
> +
> + =C2=A0 =C2=A0 =C2=A0 BT_DBG("%s %p", hdev->name, hdev);
> + =C2=A0 =C2=A0 =C2=A0 hst =3D hdev->driver_data;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Populate BT driver info required by ST */
> + =C2=A0 =C2=A0 =C2=A0 memset(&ti_st_proto, 0, sizeof(ti_st_proto));
> +
> + =C2=A0 =C2=A0 =C2=A0 /* BT driver ID */
> + =C2=A0 =C2=A0 =C2=A0 ti_st_proto.type =3D ST_BT;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Receive function which called from ST */
> + =C2=A0 =C2=A0 =C2=A0 ti_st_proto.recv =3D st_receive;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Callback to be called when registration is pend=
ing */
> + =C2=A0 =C2=A0 =C2=A0 ti_st_proto.reg_complete_cb =3D st_registration_co=
mpletion_cb;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* send in the hst to be received at registration =
complete callback
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* and during st's receive
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 ti_st_proto.priv_data =3D hst;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Register with ST layer */
> + =C2=A0 =C2=A0 =C2=A0 err =3D st_register(&ti_st_proto);
> + =C2=A0 =C2=A0 =C2=A0 if (err =3D=3D -EINPROGRESS) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Prepare wait-for-co=
mpletion handler data structures.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Needed to sync=
ronize this and st_registration_completion_cb()
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* functions.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 init_completion(&hst->=
wait_for_btdrv_reg_completion);
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Reset ST registrati=
on callback status flag , this value
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* will be update=
d in ti_st_registration_completion_cb()
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* function whene=
ver it called from ST driver.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hst->streg_cbdata =3D =
-EINPROGRESS;
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* ST is busy with oth=
er protocol registration(may be busy with
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* firmware downl=
oad).So,Wait till the registration callback
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* (passed as a a=
rgument to st_register() function) getting
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* called from ST=
.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_DBG(" %s waiting fo=
r reg completion signal from ST",
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __func__);
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 timeleft =3D
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 wait_for_completion_timeout
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 (&hst->wait_for_btdrv_reg_completion,
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0msecs_to_jiffies(BT_REGISTER_TIMEOUT));
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!timeleft) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 BT_ERR("Timeout(%d sec),didn't get reg"
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "completion =
signal from ST",
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_REGISTER_=
TIMEOUT / 1000);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 return -ETIMEDOUT;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Is ST registration =
callback called with ERROR value? */
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (hst->streg_cbdata =
!=3D 0) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 BT_ERR("ST reg completion CB called with invalid"
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "status %d",=
hst->streg_cbdata);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 return -EAGAIN;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 err =3D 0;
> + =C2=A0 =C2=A0 =C2=A0 } else if (err =3D=3D -1) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("st_register fa=
iled %d", err);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EAGAIN;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Do we have proper ST write function? */
> + =C2=A0 =C2=A0 =C2=A0 if (ti_st_proto.write !=3D NULL) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* We need this pointe=
r for sending any Bluetooth pkts */
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hst->st_write =3D ti_s=
t_proto.write;
> + =C2=A0 =C2=A0 =C2=A0 } else {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("failed to get =
ST write func pointer");
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Undo registration w=
ith ST */
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 err =3D st_unregister(=
ST_BT);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (err < 0)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 BT_ERR("st_unregister failed %d", err);
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hst->st_write =3D NULL=
;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EAGAIN;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Registration with ST layer is completed success=
fully,
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* now chip is ready to accept commands from =
HCI CORE.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* Mark HCI Device flag as RUNNING
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 set_bit(HCI_RUNNING, &hdev->flags);
> + =C2=A0 =C2=A0 =C2=A0 return err;
> +}
> +
> +/* Close device */
> +static int ti_st_close(struct hci_dev *hdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 int err =3D 0;
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *hst;
> +
> + =C2=A0 =C2=A0 =C2=A0 hst =3D hdev->driver_data;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Clear HCI device RUNNING flag */
> + =C2=A0 =C2=A0 =C2=A0 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)=
)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("HCI not RUNNIN=
G?");
> +
> + =C2=A0 =C2=A0 =C2=A0 /* continue to unregister from transport */
> + =C2=A0 =C2=A0 =C2=A0 err =3D st_unregister(ST_BT);
> + =C2=A0 =C2=A0 =C2=A0 if (err !=3D 0) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hst->st_write =3D NULL=
;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("st_unregister =
failed %d", err);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EBUSY;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 hst->st_write =3D NULL;
> + =C2=A0 =C2=A0 =C2=A0 return err;
> +}
> +
> +/* Called from HCI CORE , Sends frames to Shared Transport */
> +static int ti_st_send_frame(struct sk_buff *skb)
> +{
> + =C2=A0 =C2=A0 =C2=A0 struct hci_dev *hdev;
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *hst;
> + =C2=A0 =C2=A0 =C2=A0 long len;
> +
> + =C2=A0 =C2=A0 =C2=A0 if (skb =3D=3D NULL) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Invalid skb re=
ceived from HCI CORE");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENOMEM;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 hdev =3D (struct hci_dev *)skb->dev;
> + =C2=A0 =C2=A0 =C2=A0 if (!hdev) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("SKB received f=
or invalid HCI Device (hdev=3DNULL)");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENODEV;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 if (!test_bit(HCI_RUNNING, &hdev->flags)) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Device is not =
running");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EBUSY;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 hst =3D (struct ti_st *)hdev->driver_data;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Prepend skb with frame type */
> + =C2=A0 =C2=A0 =C2=A0 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1)=
;
> +
> + =C2=A0 =C2=A0 =C2=A0 BT_DBG(" %s: type %d len %d", hdev->name, bt_cb(sk=
b)->pkt_type,
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 skb->len);
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Insert skb to shared transport layer's transmit=
queue.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* Freeing skb memory is taken care in shared=
transport layer,
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0* so don't free skb memory here.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 if (!hst->st_write) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfree_skb(skb);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR(" Can't write t=
o ST, st_write null?");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EAGAIN;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 len =3D hst->st_write(skb);
> + =C2=A0 =C2=A0 =C2=A0 if (len < 0) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfree_skb(skb);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR(" ST write fail=
ed (%ld)", len);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -EAGAIN;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 /* ST accepted our skb. So, Go ahead and do rest *=
/
> + =C2=A0 =C2=A0 =C2=A0 hdev->stat.byte_tx +=3D len;
> + =C2=A0 =C2=A0 =C2=A0 ti_st_tx_complete(hst, bt_cb(skb)->pkt_type);
> +
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +static void ti_st_destruct(struct hci_dev *hdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 if (!hdev) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Destruct calle=
d with invalid HCI Device"
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "(hdev=3DNULL)");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 BT_DBG("%s", hdev->name);
> +
> + =C2=A0 =C2=A0 =C2=A0 /* free ti_st memory */
> + =C2=A0 =C2=A0 =C2=A0 if (hdev->driver_data !=3D NULL)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfree(hdev->driver_dat=
a);
> +
> + =C2=A0 =C2=A0 =C2=A0 return;
> +}
> +
> +/* Creates new HCI device */
> +static int ti_st_register_dev(struct ti_st *hst)
> +{
> + =C2=A0 =C2=A0 =C2=A0 struct hci_dev *hdev;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Initialize and register HCI device */
> + =C2=A0 =C2=A0 =C2=A0 hdev =3D hci_alloc_dev();
> + =C2=A0 =C2=A0 =C2=A0 if (!hdev) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Can't allocate=
HCI device");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENOMEM;
> + =C2=A0 =C2=A0 =C2=A0 }
> + =C2=A0 =C2=A0 =C2=A0 BT_DBG(" HCI device allocated. hdev=3D %p", hdev);
> +
> + =C2=A0 =C2=A0 =C2=A0 hst->hdev =3D hdev;
> + =C2=A0 =C2=A0 =C2=A0 hdev->bus =3D HCI_UART;
> + =C2=A0 =C2=A0 =C2=A0 hdev->driver_data =3D hst;
> + =C2=A0 =C2=A0 =C2=A0 hdev->open =3D ti_st_open;
> + =C2=A0 =C2=A0 =C2=A0 hdev->close =3D ti_st_close;
> + =C2=A0 =C2=A0 =C2=A0 hdev->flush =3D NULL;
> + =C2=A0 =C2=A0 =C2=A0 hdev->send =3D ti_st_send_frame;
> + =C2=A0 =C2=A0 =C2=A0 hdev->destruct =3D ti_st_destruct;
> + =C2=A0 =C2=A0 =C2=A0 hdev->owner =3D THIS_MODULE;
> +
> + =C2=A0 =C2=A0 =C2=A0 if (reset)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 set_bit(HCI_QUIRK_NO_R=
ESET, &hdev->quirks);
> +
> + =C2=A0 =C2=A0 =C2=A0 if (hci_register_dev(hdev) < 0) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Can't register=
HCI device");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hci_free_dev(hdev);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENODEV;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 BT_DBG(" HCI device registered. hdev=3D %p", hdev)=
;
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +
> +static int bt_ti_probe(struct platform_device *pdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 int err;
> + =C2=A0 =C2=A0 =C2=A0 static struct ti_st *hst;
> + =C2=A0 =C2=A0 =C2=A0 err =3D 0;
> +
> + =C2=A0 =C2=A0 =C2=A0 BT_DBG(" Bluetooth Driver Version %s", VERSION);
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Allocate local resource memory */
> + =C2=A0 =C2=A0 =C2=A0 hst =3D kzalloc(sizeof(struct ti_st), GFP_KERNEL);
> + =C2=A0 =C2=A0 =C2=A0 if (!hst) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Can't allocate=
control structure");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENFILE;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 /* Expose "hciX" device to user space */
> + =C2=A0 =C2=A0 =C2=A0 err =3D ti_st_register_dev(hst);
> + =C2=A0 =C2=A0 =C2=A0 if (err) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Release local resou=
rce memory */
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 kfree(hst);
> +
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("Unable to expo=
se hci0 device(%d)", err);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return err;
> + =C2=A0 =C2=A0 =C2=A0 }
> +
> + =C2=A0 =C2=A0 =C2=A0 dev_set_drvdata(&pdev->dev, hst);
> + =C2=A0 =C2=A0 =C2=A0 return err;
> +}
> +
> +static int bt_ti_remove(struct platform_device *pdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 struct ti_st *hst;
> +
> + =C2=A0 =C2=A0 =C2=A0 hst =3D dev_get_drvdata(&pdev->dev);
> + =C2=A0 =C2=A0 =C2=A0 /* Deallocate local resource's memory =C2=A0*/
> + =C2=A0 =C2=A0 =C2=A0 if (hst) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct hci_dev *hdev =
=3D hst->hdev;
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (hdev =3D=3D NULL) =
{
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 BT_ERR("Invalid hdev memory");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 kfree(hst);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 ti_st_close(hdev);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 hci_unregister_dev(hdev);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 /* Free HCI device memory */
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 hci_free_dev(hdev);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
> + =C2=A0 =C2=A0 =C2=A0 }
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +static struct platform_driver bt_ti_driver =3D {
> + =C2=A0 =C2=A0 =C2=A0 .probe =3D bt_ti_probe,
> + =C2=A0 =C2=A0 =C2=A0 .remove =3D bt_ti_remove,
> + =C2=A0 =C2=A0 =C2=A0 .driver =3D {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .name =3D "ti_st_bluet=
ooth",
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .owner =3D THIS_MODULE=
,
> + =C2=A0 =C2=A0 =C2=A0 },
> +};
> +
> +/* ------- Module Init/Exit interfaces ------ */
> +static int __init bt_drv_init(void)
> +{
> + =C2=A0 =C2=A0 =C2=A0 long ret =3D 0;
> + =C2=A0 =C2=A0 =C2=A0 ret =3D platform_driver_register(&bt_ti_driver);
> + =C2=A0 =C2=A0 =C2=A0 if (ret !=3D 0) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BT_ERR("bt_ti platform=
drv registration failed");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -1;
> + =C2=A0 =C2=A0 =C2=A0 }
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +static void __exit bt_drv_exit(void)
> +{
> + =C2=A0 =C2=A0 =C2=A0 platform_driver_unregister(&bt_ti_driver);
> +}
> +
> +module_init(bt_drv_init);
> +module_exit(bt_drv_exit);
> +
> +/* ------ Module Info ------ */
> +
> +module_param(reset, bool, 0644);
> +MODULE_PARM_DESC(reset, "Send HCI reset command on initialization");
> +MODULE_AUTHOR("Raja Mani <raja_mani@ti.com>");
> +MODULE_DESCRIPTION("Bluetooth Driver for TI Shared Transport" VERSION);
> +MODULE_VERSION(VERSION);
> +MODULE_LICENSE("GPL");
> --
> 1.6.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth=
" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at =C2=A0http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Bluez UCD support
From: Viswanathan Sankararam @ 2010-10-11 23:37 UTC (permalink / raw)
To: linux-bluetooth
All,
Does the Bluez stack support UCD which is part of the bluetooth 3.0
specification?
Thanks
^ permalink raw reply
* Re: Pull request git://gitorious.org/bluez-mcap-hdp/mcap-hdp.git for_upstream
From: Jose Antonio Santos Cadenas @ 2010-10-11 23:23 UTC (permalink / raw)
To: Jose Antonio Santos Cadenas, linux-bluetooth
In-Reply-To: <AANLkTik8k84qwMM3nHc4z2gVWm6Vo0HaLME2PEcwMyeg@mail.gmail.com>
Hi,
2010/10/12 Jose Antonio Santos Cadenas <santoscadenas@gmail.com>:
> Hi,
>
> 2010/10/11 Johan Hedberg <johan.hedberg@gmail.com>:
>> Hi,
>>
>> On Mon, Oct 11, 2010, Jose Antonio Santos Cadenas wrote:
>>> The following changes since commit 646f0c7e6b557c5413825ce7b04bee52bf0129e8:
>>>
>>> Move remote name and version requests to hciops (2010-10-10 22:44:25 +0100)
>>>
>>> are available in the git repository at:
>>> git://gitorious.org/bluez-mcap-hdp/mcap-hdp.git for_upstream
>>>
>>> José Antonio Santos Cadenas (6):
>>> Remove mdl_conn from struct hdp_channel
>>> Remove app paramter from hdp_establish_mcl, it is not needed
>>> Imcoming connection in control channel should be ERTM
>>> Fix multiple emission of main channel property signal.
>>> Return MCAP_MDL_BUSY when health channel can't be created
>>> Implement callback for responding echo petitions
>>>
>>> Santiago Carot-Nemesio (6):
>>> Add a new function to create channels
>>> Process request of of echo channels creation
>>> Correctly notify the deletion of the reliable data channel
>>> Add extra checks for avoid notifiying incoming echo channels
>>> Delete all channels DBus interface when the instance is removed
>>> Check first reliable configuration during channel creation
>>>
>>> health/hdp.c | 249 +++++++++++++++++++++++++++++++++++----------------
>>> health/hdp_types.h | 3 +-
>>> health/hdp_util.c | 3 -
>>> health/hdp_util.h | 1 -
>>> health/mcap.c | 1 +
>>> 5 files changed, 174 insertions(+), 83 deletions(-)
>>
>> Could you try to ping me on IRC when possible so we can solve a few
>> issues with these patches. It seems e.g. that you're doing GIOChannel
>> reference counting incorrectly in one place. There are also some english
>> language errors in the commit messages that would be good to fix (let's
>> see if you can spot them yourselves, otherwise I'll point them out when
>> we go over the other issues ;)
>
> I'm sorry but I can't connect to the IRC rigth now. Nevertheless, I
> think that I've found the issues:
>
> - The iochannel should be unrefereed when the watcher is explicitly removed
> - The commit message s/paramter/parameter
>
> Are there any more?
>
> I will solve them in half an hour.
I've rebased the branch with the changes that I described before. I've
also fixed an other issue related with the mdep checks, now a macro is
used to make the code more readable and easy to mantain.
Regards.
Jose.
^ permalink raw reply
* Re: Pull request git://gitorious.org/bluez-mcap-hdp/mcap-hdp.git for_upstream
From: Jose Antonio Santos Cadenas @ 2010-10-11 22:25 UTC (permalink / raw)
To: Jose Antonio Santos Cadenas, linux-bluetooth
In-Reply-To: <20101011213154.GA12131@jh-x301>
Hi,
2010/10/11 Johan Hedberg <johan.hedberg@gmail.com>:
> Hi,
>
> On Mon, Oct 11, 2010, Jose Antonio Santos Cadenas wrote:
>> The following changes since commit 646f0c7e6b557c5413825ce7b04bee52bf0129e8:
>>
>> Move remote name and version requests to hciops (2010-10-10 22:44:25 +0100)
>>
>> are available in the git repository at:
>> git://gitorious.org/bluez-mcap-hdp/mcap-hdp.git for_upstream
>>
>> José Antonio Santos Cadenas (6):
>> Remove mdl_conn from struct hdp_channel
>> Remove app paramter from hdp_establish_mcl, it is not needed
>> Imcoming connection in control channel should be ERTM
>> Fix multiple emission of main channel property signal.
>> Return MCAP_MDL_BUSY when health channel can't be created
>> Implement callback for responding echo petitions
>>
>> Santiago Carot-Nemesio (6):
>> Add a new function to create channels
>> Process request of of echo channels creation
>> Correctly notify the deletion of the reliable data channel
>> Add extra checks for avoid notifiying incoming echo channels
>> Delete all channels DBus interface when the instance is removed
>> Check first reliable configuration during channel creation
>>
>> health/hdp.c | 249 +++++++++++++++++++++++++++++++++++----------------
>> health/hdp_types.h | 3 +-
>> health/hdp_util.c | 3 -
>> health/hdp_util.h | 1 -
>> health/mcap.c | 1 +
>> 5 files changed, 174 insertions(+), 83 deletions(-)
>
> Could you try to ping me on IRC when possible so we can solve a few
> issues with these patches. It seems e.g. that you're doing GIOChannel
> reference counting incorrectly in one place. There are also some english
> language errors in the commit messages that would be good to fix (let's
> see if you can spot them yourselves, otherwise I'll point them out when
> we go over the other issues ;)
I'm sorry but I can't connect to the IRC rigth now. Nevertheless, I
think that I've found the issues:
- The iochannel should be unrefereed when the watcher is explicitly removed
- The commit message s/paramter/parameter
Are there any more?
I will solve them in half an hour.
>
> Johan
>
Jose.
^ permalink raw reply
* Re: Pull request git://gitorious.org/~vudentz/bluez/vudentzs-clone.git for-upstream
From: Johan Hedberg @ 2010-10-11 21:36 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <AANLkTikWCgaXMyRZcpKAsZq19-NzPD_U7YpA=_cFtFQX@mail.gmail.com>
Hi Luiz,
On Mon, Oct 11, 2010, Luiz Augusto von Dentz wrote:
> The following changes since commit 646f0c7e6b557c5413825ce7b04bee52bf0129e8:
>
> Move remote name and version requests to hciops (2010-10-10 22:44:25 +0100)
>
> are available in the git repository at:
> git://gitorious.org/~vudentz/bluez/vudentzs-clone.git for-upstream
>
> Luiz Augusto von Dentz (8):
> Fix not always signalling new streams when acting as a sink
> Fix not replying an error in case of endpoint request timeout
> Add source if the device attempt to configure a stream with a local sink
> Make use of avdtp category when setting errors
> Fix blocking on setconf confirmation callback
> Fix blocking on setconf indication callback
> Fix blocking when calling endpoint on hsp/hfp connection
> Remove unused code
>
> audio/a2dp.c | 239 ++++++++++++++++++++++++++++++++++++++++----------------
> audio/avdtp.c | 117 ++++++++++++++++++----------
> audio/avdtp.h | 19 +++--
> audio/media.c | 54 +++++--------
> audio/sink.c | 4 +-
> audio/source.c | 4 +-
> 6 files changed, 281 insertions(+), 156 deletions(-)
Thanks. The patches have been pushed upstream.
Johan
^ permalink raw reply
* Re: Pull request git://gitorious.org/bluez-mcap-hdp/mcap-hdp.git for_upstream
From: Johan Hedberg @ 2010-10-11 21:31 UTC (permalink / raw)
To: Jose Antonio Santos Cadenas; +Cc: linux-bluetooth
In-Reply-To: <AANLkTi=Ogzb3kUX7O4fz-w9gNpU9PCyTFo0GnhfePjC6@mail.gmail.com>
Hi,
On Mon, Oct 11, 2010, Jose Antonio Santos Cadenas wrote:
> The following changes since commit 646f0c7e6b557c5413825ce7b04bee52bf0129e8:
>
> Move remote name and version requests to hciops (2010-10-10 22:44:25 +0100)
>
> are available in the git repository at:
> git://gitorious.org/bluez-mcap-hdp/mcap-hdp.git for_upstream
>
> José Antonio Santos Cadenas (6):
> Remove mdl_conn from struct hdp_channel
> Remove app paramter from hdp_establish_mcl, it is not needed
> Imcoming connection in control channel should be ERTM
> Fix multiple emission of main channel property signal.
> Return MCAP_MDL_BUSY when health channel can't be created
> Implement callback for responding echo petitions
>
> Santiago Carot-Nemesio (6):
> Add a new function to create channels
> Process request of of echo channels creation
> Correctly notify the deletion of the reliable data channel
> Add extra checks for avoid notifiying incoming echo channels
> Delete all channels DBus interface when the instance is removed
> Check first reliable configuration during channel creation
>
> health/hdp.c | 249 +++++++++++++++++++++++++++++++++++----------------
> health/hdp_types.h | 3 +-
> health/hdp_util.c | 3 -
> health/hdp_util.h | 1 -
> health/mcap.c | 1 +
> 5 files changed, 174 insertions(+), 83 deletions(-)
Could you try to ping me on IRC when possible so we can solve a few
issues with these patches. It seems e.g. that you're doing GIOChannel
reference counting incorrectly in one place. There are also some english
language errors in the commit messages that would be good to fix (let's
see if you can spot them yourselves, otherwise I'll point them out when
we go over the other issues ;)
Johan
^ permalink raw reply
* [PATCH] Bluetooth: TI_ST bluetooth driver
From: pavan_savoy @ 2010-10-11 16:33 UTC (permalink / raw)
To: linux-bluetooth, marcel; +Cc: greg, linux-kernel, Pavan Savoy
From: Pavan Savoy <pavan_savoy@ti.com>
Gustavo, Marcel,
I have taken care of most of the comments which you provided.
Couple of them like usage of goto's, I didn't handle since
I am not doing much error handling repeatedly there.
I have also removed the 2 states like _REGISTERED, _RUNNING which
were not required and the flags associated with it.
I have taken care of other style comments.
Please review and provide your comments,
-- patch description --
This is the bluetooth protocol driver for the TI WiLink7 chipsets.
Texas Instrument's WiLink chipsets combine wireless technologies
like BT, FM, GPS and WLAN onto a single chip.
This Bluetooth driver works on top of the TI_ST shared transport
line discipline driver which also allows other drivers like
FM V4L2 and GPS character driver to make use of the same UART interface.
Kconfig and Makefile modifications to enable the Bluetooth
driver for Texas Instrument's WiLink 7 chipset.
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
---
drivers/bluetooth/Kconfig | 10 +
drivers/bluetooth/Makefile | 1 +
drivers/bluetooth/btwilink.c | 455 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 466 insertions(+), 0 deletions(-)
create mode 100644 drivers/bluetooth/btwilink.c
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index 02deef4..e0d67dd 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -219,4 +219,14 @@ config BT_ATH3K
Say Y here to compile support for "Atheros firmware download driver"
into the kernel or say M to compile it as module (ath3k).
+config BT_WILINK
+ tristate "BlueZ bluetooth driver for TI ST"
+ depends on TI_ST
+ help
+ This enables the Bluetooth driver for Texas Instrument's BT/FM/GPS
+ combo devices. This makes use of shared transport line discipline
+ core driver to communicate with the BT core of the combo chip.
+
+ Say Y here to compile support for Texas Instrument's WiLink7 driver
+ into the kernel or say M to compile it as module.
endmenu
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
index 71bdf13..5351b62 100644
--- a/drivers/bluetooth/Makefile
+++ b/drivers/bluetooth/Makefile
@@ -28,3 +28,4 @@ hci_uart-$(CONFIG_BT_HCIUART_BCSP) += hci_bcsp.o
hci_uart-$(CONFIG_BT_HCIUART_LL) += hci_ll.o
hci_uart-$(CONFIG_BT_HCIUART_ATH3K) += hci_ath.o
hci_uart-objs := $(hci_uart-y)
+obj-$(CONFIG_BT_WILINK) := btwilink.o
diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
new file mode 100644
index 0000000..e0bde79
--- /dev/null
+++ b/drivers/bluetooth/btwilink.c
@@ -0,0 +1,455 @@
+/*
+ * Texas Instrument's Bluetooth Driver For Shared Transport.
+ *
+ * Bluetooth Driver acts as interface between HCI CORE and
+ * TI Shared Transport Layer.
+ *
+ * Copyright (C) 2009-2010 Texas Instruments
+ * Author: Raja Mani <raja_mani@ti.com>
+ * Pavan Savoy <pavan_savoy@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <linux/platform_device.h>
+#include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
+
+#include <linux/ti_wilink_st.h>
+
+/* Bluetooth Driver Version */
+#define VERSION "1.0"
+
+/* Defines number of seconds to wait for reg completion
+ * callback getting called from ST (in case,registration
+ * with ST returns PENDING status)
+ */
+#define BT_REGISTER_TIMEOUT 6000 /* 6 sec */
+
+/**
+ * struct ti_st - BT driver operation structure
+ * @hdev: hci device pointer which binds to bt driver
+ * @flags: used locally,to maintain various BT driver status
+ * @streg_cbdata: to hold ST registration callback status
+ * @st_write: write function pointer of ST driver
+ * @wait_for_btdrv_reg_completion - completion sync between ti_st_open
+ * and ti_st_registration_completion_cb.
+ */
+struct ti_st {
+ struct hci_dev *hdev;
+ char streg_cbdata;
+ long (*st_write) (struct sk_buff *);
+ struct completion wait_for_btdrv_reg_completion;
+};
+
+static int reset;
+
+/* Increments HCI counters based on pocket ID (cmd,acl,sco) */
+static inline void ti_st_tx_complete(struct ti_st *hst, int pkt_type)
+{
+ struct hci_dev *hdev;
+ hdev = hst->hdev;
+
+ /* Update HCI stat counters */
+ switch (pkt_type) {
+ case HCI_COMMAND_PKT:
+ hdev->stat.cmd_tx++;
+ break;
+
+ case HCI_ACLDATA_PKT:
+ hdev->stat.acl_tx++;
+ break;
+
+ case HCI_SCODATA_PKT:
+ hdev->stat.sco_tx++;
+ break;
+ }
+}
+
+/* ------- Interfaces to Shared Transport ------ */
+
+/* Called by ST layer to indicate protocol registration completion
+ * status.ti_st_open() function will wait for signal from this
+ * API when st_register() function returns ST_PENDING.
+ */
+static void st_registration_completion_cb(void *priv_data, char data)
+{
+ struct ti_st *lhst = (struct ti_st *)priv_data;
+ /* ti_st_open() function needs value of 'data' to know
+ * the registration status(success/fail),So have a back
+ * up of it.
+ */
+ lhst->streg_cbdata = data;
+
+ /* Got a feedback from ST for BT driver registration
+ * request.Wackup ti_st_open() function to continue
+ * it's open operation.
+ */
+ complete(&lhst->wait_for_btdrv_reg_completion);
+}
+
+/* Called by Shared Transport layer when receive data is
+ * available */
+static long st_receive(void *priv_data, struct sk_buff *skb)
+{
+ int err;
+ struct ti_st *lhst = (struct ti_st *)priv_data;
+
+ if (skb == NULL) {
+ BT_ERR("Invalid SKB received from ST");
+ return -EFAULT;
+ }
+
+ if (!lhst) {
+ kfree_skb(skb);
+ BT_ERR("Invalid ti_st memory,freeing SKB");
+ return -EFAULT;
+ }
+
+ skb->dev = (struct net_device *)lhst->hdev;
+ /* Forward skb to HCI CORE layer */
+ err = hci_recv_frame(skb);
+ if (err) {
+ kfree_skb(skb);
+ BT_ERR("Unable to push skb to HCI CORE(%d),freeing SKB",
+ err);
+ return err;
+ }
+
+ lhst->hdev->stat.byte_rx += skb->len;
+ return 0;
+}
+
+/* ------- Interfaces to HCI layer ------ */
+
+/* Called from HCI core to initialize the device */
+static int ti_st_open(struct hci_dev *hdev)
+{
+ static struct st_proto_s ti_st_proto;
+ unsigned long timeleft;
+ struct ti_st *hst;
+ int err;
+ err = 0;
+
+ BT_DBG("%s %p", hdev->name, hdev);
+ hst = hdev->driver_data;
+
+ /* Populate BT driver info required by ST */
+ memset(&ti_st_proto, 0, sizeof(ti_st_proto));
+
+ /* BT driver ID */
+ ti_st_proto.type = ST_BT;
+
+ /* Receive function which called from ST */
+ ti_st_proto.recv = st_receive;
+
+ /* Callback to be called when registration is pending */
+ ti_st_proto.reg_complete_cb = st_registration_completion_cb;
+
+ /* send in the hst to be received at registration complete callback
+ * and during st's receive
+ */
+ ti_st_proto.priv_data = hst;
+
+ /* Register with ST layer */
+ err = st_register(&ti_st_proto);
+ if (err == -EINPROGRESS) {
+ /* Prepare wait-for-completion handler data structures.
+ * Needed to syncronize this and st_registration_completion_cb()
+ * functions.
+ */
+ init_completion(&hst->wait_for_btdrv_reg_completion);
+
+ /* Reset ST registration callback status flag , this value
+ * will be updated in ti_st_registration_completion_cb()
+ * function whenever it called from ST driver.
+ */
+ hst->streg_cbdata = -EINPROGRESS;
+
+ /* ST is busy with other protocol registration(may be busy with
+ * firmware download).So,Wait till the registration callback
+ * (passed as a argument to st_register() function) getting
+ * called from ST.
+ */
+ BT_DBG(" %s waiting for reg completion signal from ST",
+ __func__);
+
+ timeleft =
+ wait_for_completion_timeout
+ (&hst->wait_for_btdrv_reg_completion,
+ msecs_to_jiffies(BT_REGISTER_TIMEOUT));
+ if (!timeleft) {
+ BT_ERR("Timeout(%d sec),didn't get reg"
+ "completion signal from ST",
+ BT_REGISTER_TIMEOUT / 1000);
+ return -ETIMEDOUT;
+ }
+
+ /* Is ST registration callback called with ERROR value? */
+ if (hst->streg_cbdata != 0) {
+ BT_ERR("ST reg completion CB called with invalid"
+ "status %d", hst->streg_cbdata);
+ return -EAGAIN;
+ }
+ err = 0;
+ } else if (err == -1) {
+ BT_ERR("st_register failed %d", err);
+ return -EAGAIN;
+ }
+
+ /* Do we have proper ST write function? */
+ if (ti_st_proto.write != NULL) {
+ /* We need this pointer for sending any Bluetooth pkts */
+ hst->st_write = ti_st_proto.write;
+ } else {
+ BT_ERR("failed to get ST write func pointer");
+
+ /* Undo registration with ST */
+ err = st_unregister(ST_BT);
+ if (err < 0)
+ BT_ERR("st_unregister failed %d", err);
+
+ hst->st_write = NULL;
+ return -EAGAIN;
+ }
+
+ /* Registration with ST layer is completed successfully,
+ * now chip is ready to accept commands from HCI CORE.
+ * Mark HCI Device flag as RUNNING
+ */
+ set_bit(HCI_RUNNING, &hdev->flags);
+ return err;
+}
+
+/* Close device */
+static int ti_st_close(struct hci_dev *hdev)
+{
+ int err = 0;
+ struct ti_st *hst;
+
+ hst = hdev->driver_data;
+
+ /* Clear HCI device RUNNING flag */
+ if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
+ BT_ERR("HCI not RUNNING?");
+
+ /* continue to unregister from transport */
+ err = st_unregister(ST_BT);
+ if (err != 0) {
+ hst->st_write = NULL;
+ BT_ERR("st_unregister failed %d", err);
+ return -EBUSY;
+ }
+
+ hst->st_write = NULL;
+ return err;
+}
+
+/* Called from HCI CORE , Sends frames to Shared Transport */
+static int ti_st_send_frame(struct sk_buff *skb)
+{
+ struct hci_dev *hdev;
+ struct ti_st *hst;
+ long len;
+
+ if (skb == NULL) {
+ BT_ERR("Invalid skb received from HCI CORE");
+ return -ENOMEM;
+ }
+
+ hdev = (struct hci_dev *)skb->dev;
+ if (!hdev) {
+ BT_ERR("SKB received for invalid HCI Device (hdev=NULL)");
+ return -ENODEV;
+ }
+
+ if (!test_bit(HCI_RUNNING, &hdev->flags)) {
+ BT_ERR("Device is not running");
+ return -EBUSY;
+ }
+
+ hst = (struct ti_st *)hdev->driver_data;
+
+ /* Prepend skb with frame type */
+ memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
+
+ BT_DBG(" %s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type,
+ skb->len);
+
+ /* Insert skb to shared transport layer's transmit queue.
+ * Freeing skb memory is taken care in shared transport layer,
+ * so don't free skb memory here.
+ */
+ if (!hst->st_write) {
+ kfree_skb(skb);
+ BT_ERR(" Can't write to ST, st_write null?");
+ return -EAGAIN;
+ }
+
+ len = hst->st_write(skb);
+ if (len < 0) {
+ kfree_skb(skb);
+ BT_ERR(" ST write failed (%ld)", len);
+ return -EAGAIN;
+ }
+
+ /* ST accepted our skb. So, Go ahead and do rest */
+ hdev->stat.byte_tx += len;
+ ti_st_tx_complete(hst, bt_cb(skb)->pkt_type);
+
+ return 0;
+}
+
+static void ti_st_destruct(struct hci_dev *hdev)
+{
+ if (!hdev) {
+ BT_ERR("Destruct called with invalid HCI Device"
+ "(hdev=NULL)");
+ return;
+ }
+
+ BT_DBG("%s", hdev->name);
+
+ /* free ti_st memory */
+ if (hdev->driver_data != NULL)
+ kfree(hdev->driver_data);
+
+ return;
+}
+
+/* Creates new HCI device */
+static int ti_st_register_dev(struct ti_st *hst)
+{
+ struct hci_dev *hdev;
+
+ /* Initialize and register HCI device */
+ hdev = hci_alloc_dev();
+ if (!hdev) {
+ BT_ERR("Can't allocate HCI device");
+ return -ENOMEM;
+ }
+ BT_DBG(" HCI device allocated. hdev= %p", hdev);
+
+ hst->hdev = hdev;
+ hdev->bus = HCI_UART;
+ hdev->driver_data = hst;
+ hdev->open = ti_st_open;
+ hdev->close = ti_st_close;
+ hdev->flush = NULL;
+ hdev->send = ti_st_send_frame;
+ hdev->destruct = ti_st_destruct;
+ hdev->owner = THIS_MODULE;
+
+ if (reset)
+ set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks);
+
+ if (hci_register_dev(hdev) < 0) {
+ BT_ERR("Can't register HCI device");
+ hci_free_dev(hdev);
+ return -ENODEV;
+ }
+
+ BT_DBG(" HCI device registered. hdev= %p", hdev);
+ return 0;
+}
+
+
+static int bt_ti_probe(struct platform_device *pdev)
+{
+ int err;
+ static struct ti_st *hst;
+ err = 0;
+
+ BT_DBG(" Bluetooth Driver Version %s", VERSION);
+
+ /* Allocate local resource memory */
+ hst = kzalloc(sizeof(struct ti_st), GFP_KERNEL);
+ if (!hst) {
+ BT_ERR("Can't allocate control structure");
+ return -ENFILE;
+ }
+
+ /* Expose "hciX" device to user space */
+ err = ti_st_register_dev(hst);
+ if (err) {
+ /* Release local resource memory */
+ kfree(hst);
+
+ BT_ERR("Unable to expose hci0 device(%d)", err);
+ return err;
+ }
+
+ dev_set_drvdata(&pdev->dev, hst);
+ return err;
+}
+
+static int bt_ti_remove(struct platform_device *pdev)
+{
+ struct ti_st *hst;
+
+ hst = dev_get_drvdata(&pdev->dev);
+ /* Deallocate local resource's memory */
+ if (hst) {
+ struct hci_dev *hdev = hst->hdev;
+ if (hdev == NULL) {
+ BT_ERR("Invalid hdev memory");
+ kfree(hst);
+ } else {
+ ti_st_close(hdev);
+ hci_unregister_dev(hdev);
+ /* Free HCI device memory */
+ hci_free_dev(hdev);
+ }
+ }
+ return 0;
+}
+
+static struct platform_driver bt_ti_driver = {
+ .probe = bt_ti_probe,
+ .remove = bt_ti_remove,
+ .driver = {
+ .name = "ti_st_bluetooth",
+ .owner = THIS_MODULE,
+ },
+};
+
+/* ------- Module Init/Exit interfaces ------ */
+static int __init bt_drv_init(void)
+{
+ long ret = 0;
+ ret = platform_driver_register(&bt_ti_driver);
+ if (ret != 0) {
+ BT_ERR("bt_ti platform drv registration failed");
+ return -1;
+ }
+ return 0;
+}
+
+static void __exit bt_drv_exit(void)
+{
+ platform_driver_unregister(&bt_ti_driver);
+}
+
+module_init(bt_drv_init);
+module_exit(bt_drv_exit);
+
+/* ------ Module Info ------ */
+
+module_param(reset, bool, 0644);
+MODULE_PARM_DESC(reset, "Send HCI reset command on initialization");
+MODULE_AUTHOR("Raja Mani <raja_mani@ti.com>");
+MODULE_DESCRIPTION("Bluetooth Driver for TI Shared Transport" VERSION);
+MODULE_VERSION(VERSION);
+MODULE_LICENSE("GPL");
--
1.6.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox