* Pull request: bluetooth-next-2.6 2010-02-27 @ 2010-02-27 22:38 Marcel Holtmann 2010-02-27 22:38 ` [PATCH 1/9] Bluetooth: Add __init/__exit macros to Marvell SDIO driver Marcel Holtmann 2010-02-28 8:19 ` Pull request: bluetooth-next-2.6 2010-02-27 David Miller 0 siblings, 2 replies; 15+ messages in thread From: Marcel Holtmann @ 2010-02-27 22:38 UTC (permalink / raw) To: David Miller; +Cc: netdev [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2496 bytes --] I was hoping to get the Enhanced L2CAP updates ready for this merge window, but in the end they were not stable enough. So I removed all the L2CAP changes out of this merge request. The leftovers are small updates and bug fixes. The only bigger change is a patch that adds per controller debugfs. That way drivers don't have to deal with it on their own. This avoids clashes with multiple controllers attached to the same system. The Marvell driver is one of the examples where this is needed. Their debugfs support and multiple controllers was not done properly. Regards Marcel Please pull from git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-next-2.6.git master This will update the following files: drivers/bluetooth/ath3k.c | 2 + drivers/bluetooth/bcm203x.c | 2 +- drivers/bluetooth/bfusb.c | 2 +- drivers/bluetooth/bluecard_cs.c | 2 +- drivers/bluetooth/bpa10x.c | 2 +- drivers/bluetooth/bt3c_cs.c | 2 +- drivers/bluetooth/btmrvl_debugfs.c | 14 ++-- drivers/bluetooth/btmrvl_main.c | 2 +- drivers/bluetooth/btmrvl_sdio.c | 4 +- drivers/bluetooth/btsdio.c | 2 +- drivers/bluetooth/btuart_cs.c | 2 +- drivers/bluetooth/btusb.c | 2 +- drivers/bluetooth/dtl1_cs.c | 2 +- drivers/bluetooth/hci_ldisc.c | 2 +- drivers/bluetooth/hci_vhci.c | 2 +- include/net/bluetooth/hci.h | 6 ++- include/net/bluetooth/hci_core.h | 5 +- net/bluetooth/hci_core.c | 12 +++- net/bluetooth/hci_event.c | 1 + net/bluetooth/hci_sock.c | 2 +- net/bluetooth/hci_sysfs.c | 122 +++++++++++++++++++++++++---------- 21 files changed, 129 insertions(+), 63 deletions(-) through these ChangeSets: Dan Carpenter (1): Bluetooth: Add missing kfree() on error path in Atheros driver Johann Felix Soden (1): Bluetooth: Fix out of scope variable access in hci_sock_cmsg() Marcel Holtmann (4): Bluetooth: Convert controller hdev->type to hdev->bus Bluetooth: Convert inquiry cache to use debugfs instead of sysfs Bluetooth: Convert Marvell driver to use per adapter debugfs Bluetooth: Add controller types for BR/EDR and 802.11 AMP Márton Németh (1): Bluetooth: Make USB device id constant Peter Huewe (1): Bluetooth: Add __init/__exit macros to Marvell SDIO driver Stephen Coe (1): Bluetooth: Add SCO fallback for unsupported feature error ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/9] Bluetooth: Add __init/__exit macros to Marvell SDIO driver 2010-02-27 22:38 Pull request: bluetooth-next-2.6 2010-02-27 Marcel Holtmann @ 2010-02-27 22:38 ` Marcel Holtmann 2010-02-27 22:38 ` [PATCH 2/9] Bluetooth: Make USB device id constant Marcel Holtmann 2010-02-28 8:19 ` Pull request: bluetooth-next-2.6 2010-02-27 David Miller 1 sibling, 1 reply; 15+ messages in thread From: Marcel Holtmann @ 2010-02-27 22:38 UTC (permalink / raw) To: David Miller; +Cc: netdev From: Peter Huewe <peterhuewe@gmx.de> Trivial patch which adds the __init/__exit macros to the module_init/ module_exit functions of btmrvl_sdio.c driver. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> --- drivers/bluetooth/btmrvl_sdio.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index 57d965b..94f1f55 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c @@ -976,7 +976,7 @@ static struct sdio_driver bt_mrvl_sdio = { .remove = btmrvl_sdio_remove, }; -static int btmrvl_sdio_init_module(void) +static int __init btmrvl_sdio_init_module(void) { if (sdio_register_driver(&bt_mrvl_sdio) != 0) { BT_ERR("SDIO Driver Registration Failed"); @@ -989,7 +989,7 @@ static int btmrvl_sdio_init_module(void) return 0; } -static void btmrvl_sdio_exit_module(void) +static void __exit btmrvl_sdio_exit_module(void) { /* Set the flag as user is removing this module. */ user_rmmod = 1; -- 1.6.6 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/9] Bluetooth: Make USB device id constant 2010-02-27 22:38 ` [PATCH 1/9] Bluetooth: Add __init/__exit macros to Marvell SDIO driver Marcel Holtmann @ 2010-02-27 22:38 ` Marcel Holtmann 2010-02-27 22:38 ` [PATCH 3/9] Bluetooth: Add missing kfree() on error path in Atheros driver Marcel Holtmann 0 siblings, 1 reply; 15+ messages in thread From: Marcel Holtmann @ 2010-02-27 22:38 UTC (permalink / raw) To: David Miller; +Cc: netdev From: Márton Németh <nm127@freemail.hu> The id_table field of the struct usb_device_id is constant in <linux/usb.h> so it is worth to make bcm203x_table also constant. The semantic match that finds this kind of pattern is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ disable decl_init,const_decl_init; identifier I1, I2, x; @@ struct I1 { ... const struct I2 *x; ... }; @s@ identifier r.I1, y; identifier r.x, E; @@ struct I1 y = { .x = E, }; @c@ identifier r.I2; identifier s.E; @@ const struct I2 E[] = ... ; @depends on !c@ identifier r.I2; identifier s.E; @@ + const struct I2 E[] = ...; // </smpl> Signed-off-by: Márton Németh <nm127@freemail.hu> Cc: Julia Lawall <julia@diku.dk> Cc: cocci@diku.dk Signed-off-by: Marcel Holtmann <marcel@holtmann.org> --- drivers/bluetooth/bcm203x.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c index eafd4af..b0c84c1 100644 --- a/drivers/bluetooth/bcm203x.c +++ b/drivers/bluetooth/bcm203x.c @@ -39,7 +39,7 @@ #define VERSION "1.2" -static struct usb_device_id bcm203x_table[] = { +static const struct usb_device_id bcm203x_table[] = { /* Broadcom Blutonium (BCM2033) */ { USB_DEVICE(0x0a5c, 0x2033) }, -- 1.6.6 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/9] Bluetooth: Add missing kfree() on error path in Atheros driver 2010-02-27 22:38 ` [PATCH 2/9] Bluetooth: Make USB device id constant Marcel Holtmann @ 2010-02-27 22:38 ` Marcel Holtmann 2010-02-27 22:38 ` [PATCH 4/9] Bluetooth: Convert controller hdev->type to hdev->bus Marcel Holtmann 0 siblings, 1 reply; 15+ messages in thread From: Marcel Holtmann @ 2010-02-27 22:38 UTC (permalink / raw) To: David Miller; +Cc: netdev From: Dan Carpenter <error27@gmail.com> Add a couple kfree() calls on an error path. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> --- drivers/bluetooth/ath3k.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index add9485..128cae4 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c @@ -143,6 +143,8 @@ static int ath3k_probe(struct usb_interface *intf, usb_set_intfdata(intf, data); if (ath3k_load_firmware(data, data->fw_data, data->fw_size)) { usb_set_intfdata(intf, NULL); + kfree(data->fw_data); + kfree(data); return -EIO; } -- 1.6.6 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/9] Bluetooth: Convert controller hdev->type to hdev->bus 2010-02-27 22:38 ` [PATCH 3/9] Bluetooth: Add missing kfree() on error path in Atheros driver Marcel Holtmann @ 2010-02-27 22:38 ` Marcel Holtmann 2010-02-27 22:38 ` [PATCH 5/9] Bluetooth: Convert inquiry cache to use debugfs instead of sysfs Marcel Holtmann 0 siblings, 1 reply; 15+ messages in thread From: Marcel Holtmann @ 2010-02-27 22:38 UTC (permalink / raw) To: David Miller; +Cc: netdev The hdev->type is misnamed and should be actually hdev->bus instead. So convert it now. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> --- drivers/bluetooth/bfusb.c | 2 +- drivers/bluetooth/bluecard_cs.c | 2 +- drivers/bluetooth/bpa10x.c | 2 +- drivers/bluetooth/bt3c_cs.c | 2 +- drivers/bluetooth/btmrvl_main.c | 2 +- drivers/bluetooth/btsdio.c | 2 +- drivers/bluetooth/btuart_cs.c | 2 +- drivers/bluetooth/btusb.c | 2 +- drivers/bluetooth/dtl1_cs.c | 2 +- drivers/bluetooth/hci_ldisc.c | 2 +- drivers/bluetooth/hci_vhci.c | 2 +- include/net/bluetooth/hci.h | 2 +- include/net/bluetooth/hci_core.h | 2 +- net/bluetooth/hci_core.c | 8 ++++---- net/bluetooth/hci_sysfs.c | 16 ++++++++-------- 15 files changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index 2a00707..005919a 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -703,7 +703,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i data->hdev = hdev; - hdev->type = HCI_USB; + hdev->bus = HCI_USB; hdev->driver_data = data; SET_HCIDEV_DEV(hdev, &intf->dev); diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index c2cf811..d9bf87c 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c @@ -736,7 +736,7 @@ static int bluecard_open(bluecard_info_t *info) info->hdev = hdev; - hdev->type = HCI_PCCARD; + hdev->bus = HCI_PCCARD; hdev->driver_data = info; SET_HCIDEV_DEV(hdev, &info->p_dev->dev); diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index c115285..d945cd1 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c @@ -469,7 +469,7 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * return -ENOMEM; } - hdev->type = HCI_USB; + hdev->bus = HCI_USB; hdev->driver_data = data; data->hdev = hdev; diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 9f5926a..027cb8b 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -582,7 +582,7 @@ static int bt3c_open(bt3c_info_t *info) info->hdev = hdev; - hdev->type = HCI_PCCARD; + hdev->bus = HCI_PCCARD; hdev->driver_data = info; SET_HCIDEV_DEV(hdev, &info->p_dev->dev); diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index f97771c..53a43ad 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c @@ -563,7 +563,7 @@ struct btmrvl_private *btmrvl_add_card(void *card) priv->btmrvl_dev.tx_dnld_rdy = true; - hdev->type = HCI_SDIO; + hdev->bus = HCI_SDIO; hdev->open = btmrvl_open; hdev->close = btmrvl_close; hdev->flush = btmrvl_flush; diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c index 7e29827..76e5127 100644 --- a/drivers/bluetooth/btsdio.c +++ b/drivers/bluetooth/btsdio.c @@ -326,7 +326,7 @@ static int btsdio_probe(struct sdio_func *func, return -ENOMEM; } - hdev->type = HCI_SDIO; + hdev->bus = HCI_SDIO; hdev->driver_data = data; data->hdev = hdev; diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 91c5230..60c0953 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -500,7 +500,7 @@ static int btuart_open(btuart_info_t *info) info->hdev = hdev; - hdev->type = HCI_PCCARD; + hdev->bus = HCI_PCCARD; hdev->driver_data = info; SET_HCIDEV_DEV(hdev, &info->p_dev->dev); diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index a699f09..5d9cc53 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -939,7 +939,7 @@ static int btusb_probe(struct usb_interface *intf, return -ENOMEM; } - hdev->type = HCI_USB; + hdev->bus = HCI_USB; hdev->driver_data = data; data->hdev = hdev; diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 6975919..1778831 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -485,7 +485,7 @@ static int dtl1_open(dtl1_info_t *info) info->hdev = hdev; - hdev->type = HCI_PCCARD; + hdev->bus = HCI_PCCARD; hdev->driver_data = info; SET_HCIDEV_DEV(hdev, &info->p_dev->dev); diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index aa09193..76a1abb 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -383,7 +383,7 @@ static int hci_uart_register_dev(struct hci_uart *hu) hu->hdev = hdev; - hdev->type = HCI_UART; + hdev->bus = HCI_UART; hdev->driver_data = hu; hdev->open = hci_uart_open; diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index 7595274..bb0aefd 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c @@ -236,7 +236,7 @@ static int vhci_open(struct inode *inode, struct file *file) data->hdev = hdev; - hdev->type = HCI_VIRTUAL; + hdev->bus = HCI_VIRTUAL; hdev->driver_data = data; hdev->open = vhci_open_dev; diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index ed3aea1..3350a66 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -43,7 +43,7 @@ #define HCI_NOTIFY_CONN_DEL 2 #define HCI_NOTIFY_VOICE_SETTING 3 -/* HCI device types */ +/* HCI bus types */ #define HCI_VIRTUAL 0 #define HCI_USB 1 #define HCI_PCCARD 2 diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 7b86094..7e65885 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -70,7 +70,7 @@ struct hci_dev { char name[8]; unsigned long flags; __u16 id; - __u8 type; + __u8 bus; bdaddr_t bdaddr; __u8 dev_name[248]; __u8 dev_class[3]; diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 94ba349..4b62ed0 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -797,7 +797,7 @@ int hci_get_dev_info(void __user *arg) strcpy(di.name, hdev->name); di.bdaddr = hdev->bdaddr; - di.type = hdev->type; + di.type = hdev->bus; di.flags = hdev->flags; di.pkt_type = hdev->pkt_type; di.acl_mtu = hdev->acl_mtu; @@ -869,8 +869,8 @@ int hci_register_dev(struct hci_dev *hdev) struct list_head *head = &hci_dev_list, *p; int i, id = 0; - BT_DBG("%p name %s type %d owner %p", hdev, hdev->name, - hdev->type, hdev->owner); + BT_DBG("%p name %s bus %d owner %p", hdev, hdev->name, + hdev->bus, hdev->owner); if (!hdev->open || !hdev->close || !hdev->destruct) return -EINVAL; @@ -946,7 +946,7 @@ int hci_unregister_dev(struct hci_dev *hdev) { int i; - BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); + BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); write_lock_bh(&hci_dev_list_lock); list_del(&hdev->list); diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 2bc6f6a..9b5f376 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -166,9 +166,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn) queue_work(bt_workq, &conn->work_del); } -static inline char *host_typetostr(int type) +static inline char *host_bustostr(int bus) { - switch (type) { + switch (bus) { case HCI_VIRTUAL: return "VIRTUAL"; case HCI_USB: @@ -188,10 +188,10 @@ static inline char *host_typetostr(int type) } } -static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf) +static ssize_t show_bus(struct device *dev, struct device_attribute *attr, char *buf) { struct hci_dev *hdev = dev_get_drvdata(dev); - return sprintf(buf, "%s\n", host_typetostr(hdev->type)); + return sprintf(buf, "%s\n", host_bustostr(hdev->bus)); } static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf) @@ -355,7 +355,7 @@ static ssize_t store_sniff_min_interval(struct device *dev, struct device_attrib return count; } -static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); +static DEVICE_ATTR(bus, S_IRUGO, show_bus, NULL); static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); static DEVICE_ATTR(class, S_IRUGO, show_class, NULL); static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); @@ -373,7 +373,7 @@ static DEVICE_ATTR(sniff_min_interval, S_IRUGO | S_IWUSR, show_sniff_min_interval, store_sniff_min_interval); static struct attribute *bt_host_attrs[] = { - &dev_attr_type.attr, + &dev_attr_bus.attr, &dev_attr_name.attr, &dev_attr_class.attr, &dev_attr_address.attr, @@ -414,7 +414,7 @@ int hci_register_sysfs(struct hci_dev *hdev) struct device *dev = &hdev->dev; int err; - BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); + BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); dev->type = &bt_host; dev->class = bt_class; @@ -433,7 +433,7 @@ int hci_register_sysfs(struct hci_dev *hdev) void hci_unregister_sysfs(struct hci_dev *hdev) { - BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); + BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); device_del(&hdev->dev); } -- 1.6.6 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 5/9] Bluetooth: Convert inquiry cache to use debugfs instead of sysfs 2010-02-27 22:38 ` [PATCH 4/9] Bluetooth: Convert controller hdev->type to hdev->bus Marcel Holtmann @ 2010-02-27 22:38 ` Marcel Holtmann 2010-02-27 22:38 ` [PATCH 6/9] Bluetooth: Convert Marvell driver to use per adapter debugfs Marcel Holtmann 0 siblings, 1 reply; 15+ messages in thread From: Marcel Holtmann @ 2010-02-27 22:38 UTC (permalink / raw) To: David Miller; +Cc: netdev The output of the inquiry cache is only useful for debugging purposes and so move it into debugfs. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> --- include/net/bluetooth/hci_core.h | 2 + net/bluetooth/hci_sysfs.c | 92 +++++++++++++++++++++++++------------ 2 files changed, 64 insertions(+), 30 deletions(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 7e65885..4c94c1e 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -134,6 +134,8 @@ struct hci_dev { atomic_t promisc; + struct dentry *debugfs; + struct device *parent; struct device dev; diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 9b5f376..f9d93f9 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -2,6 +2,7 @@ #include <linux/kernel.h> #include <linux/init.h> +#include <linux/debugfs.h> #include <net/bluetooth/bluetooth.h> #include <net/bluetooth/hci_core.h> @@ -9,6 +10,9 @@ struct class *bt_class = NULL; EXPORT_SYMBOL_GPL(bt_class); +struct dentry *bt_debugfs = NULL; +EXPORT_SYMBOL_GPL(bt_debugfs); + static struct workqueue_struct *bt_workq; static inline char *link_typetostr(int type) @@ -251,32 +255,6 @@ static ssize_t show_hci_revision(struct device *dev, struct device_attribute *at return sprintf(buf, "%d\n", hdev->hci_rev); } -static ssize_t show_inquiry_cache(struct device *dev, struct device_attribute *attr, char *buf) -{ - struct hci_dev *hdev = dev_get_drvdata(dev); - struct inquiry_cache *cache = &hdev->inq_cache; - struct inquiry_entry *e; - int n = 0; - - hci_dev_lock_bh(hdev); - - for (e = cache->list; e; e = e->next) { - struct inquiry_data *data = &e->data; - bdaddr_t bdaddr; - baswap(&bdaddr, &data->bdaddr); - n += sprintf(buf + n, "%s %d %d %d 0x%.2x%.2x%.2x 0x%.4x %d %d %u\n", - batostr(&bdaddr), - data->pscan_rep_mode, data->pscan_period_mode, - data->pscan_mode, data->dev_class[2], - data->dev_class[1], data->dev_class[0], - __le16_to_cpu(data->clock_offset), - data->rssi, data->ssp_mode, e->timestamp); - } - - hci_dev_unlock_bh(hdev); - return n; -} - static ssize_t show_idle_timeout(struct device *dev, struct device_attribute *attr, char *buf) { struct hci_dev *hdev = dev_get_drvdata(dev); @@ -363,7 +341,6 @@ static DEVICE_ATTR(features, S_IRUGO, show_features, NULL); static DEVICE_ATTR(manufacturer, S_IRUGO, show_manufacturer, NULL); static DEVICE_ATTR(hci_version, S_IRUGO, show_hci_version, NULL); static DEVICE_ATTR(hci_revision, S_IRUGO, show_hci_revision, NULL); -static DEVICE_ATTR(inquiry_cache, S_IRUGO, show_inquiry_cache, NULL); static DEVICE_ATTR(idle_timeout, S_IRUGO | S_IWUSR, show_idle_timeout, store_idle_timeout); @@ -381,7 +358,6 @@ static struct attribute *bt_host_attrs[] = { &dev_attr_manufacturer.attr, &dev_attr_hci_version.attr, &dev_attr_hci_revision.attr, - &dev_attr_inquiry_cache.attr, &dev_attr_idle_timeout.attr, &dev_attr_sniff_max_interval.attr, &dev_attr_sniff_min_interval.attr, @@ -409,6 +385,46 @@ static struct device_type bt_host = { .release = bt_host_release, }; +static int inquiry_cache_open(struct inode *inode, struct file *file) +{ + file->private_data = inode->i_private; + return 0; +} + +static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) +{ + struct hci_dev *hdev = file->private_data; + struct inquiry_cache *cache = &hdev->inq_cache; + struct inquiry_entry *e; + char buf[4096]; + int n = 0; + + hci_dev_lock_bh(hdev); + + for (e = cache->list; e; e = e->next) { + struct inquiry_data *data = &e->data; + bdaddr_t bdaddr; + baswap(&bdaddr, &data->bdaddr); + n += sprintf(buf + n, "%s %d %d %d 0x%.2x%.2x%.2x 0x%.4x %d %d %u\n", + batostr(&bdaddr), + data->pscan_rep_mode, data->pscan_period_mode, + data->pscan_mode, data->dev_class[2], + data->dev_class[1], data->dev_class[0], + __le16_to_cpu(data->clock_offset), + data->rssi, data->ssp_mode, e->timestamp); + } + + hci_dev_unlock_bh(hdev); + + return simple_read_from_buffer(userbuf, count, ppos, buf, n); +} + +static const struct file_operations inquiry_cache_fops = { + .open = inquiry_cache_open, + .read = inquiry_cache_read, +}; + int hci_register_sysfs(struct hci_dev *hdev) { struct device *dev = &hdev->dev; @@ -428,6 +444,16 @@ int hci_register_sysfs(struct hci_dev *hdev) if (err < 0) return err; + if (!bt_debugfs) + return 0; + + hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs); + if (!hdev->debugfs) + return 0; + + debugfs_create_file("inquiry_cache", 0444, hdev->debugfs, + hdev, &inquiry_cache_fops); + return 0; } @@ -435,6 +461,8 @@ void hci_unregister_sysfs(struct hci_dev *hdev) { BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); + debugfs_remove_recursive(hdev->debugfs); + device_del(&hdev->dev); } @@ -444,6 +472,8 @@ int __init bt_sysfs_init(void) if (!bt_workq) return -ENOMEM; + bt_debugfs = debugfs_create_dir("bluetooth", NULL); + bt_class = class_create(THIS_MODULE, "bluetooth"); if (IS_ERR(bt_class)) { destroy_workqueue(bt_workq); @@ -455,7 +485,9 @@ int __init bt_sysfs_init(void) void bt_sysfs_cleanup(void) { - destroy_workqueue(bt_workq); - class_destroy(bt_class); + + debugfs_remove_recursive(bt_debugfs); + + destroy_workqueue(bt_workq); } -- 1.6.6 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 6/9] Bluetooth: Convert Marvell driver to use per adapter debugfs 2010-02-27 22:38 ` [PATCH 5/9] Bluetooth: Convert inquiry cache to use debugfs instead of sysfs Marcel Holtmann @ 2010-02-27 22:38 ` Marcel Holtmann 2010-02-27 22:38 ` [PATCH 7/9] Bluetooth: Add controller types for BR/EDR and 802.11 AMP Marcel Holtmann 0 siblings, 1 reply; 15+ messages in thread From: Marcel Holtmann @ 2010-02-27 22:38 UTC (permalink / raw) To: David Miller; +Cc: netdev The debugfs support of the Marvell driver is buggy. It is limited to one controller per system. Fix this by using the controller specific debugfs directory as parent. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> --- drivers/bluetooth/btmrvl_debugfs.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/bluetooth/btmrvl_debugfs.c b/drivers/bluetooth/btmrvl_debugfs.c index d43b5cb..3126a3d 100644 --- a/drivers/bluetooth/btmrvl_debugfs.c +++ b/drivers/bluetooth/btmrvl_debugfs.c @@ -26,7 +26,8 @@ #include "btmrvl_drv.h" struct btmrvl_debugfs_data { - struct dentry *root_dir, *config_dir, *status_dir; + struct dentry *config_dir; + struct dentry *status_dir; /* config */ struct dentry *psmode; @@ -363,6 +364,9 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) struct btmrvl_private *priv = hdev->driver_data; struct btmrvl_debugfs_data *dbg; + if (!hdev->debugfs) + return; + dbg = kzalloc(sizeof(*dbg), GFP_KERNEL); priv->debugfs_data = dbg; @@ -371,9 +375,7 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) return; } - dbg->root_dir = debugfs_create_dir("btmrvl", NULL); - - dbg->config_dir = debugfs_create_dir("config", dbg->root_dir); + dbg->config_dir = debugfs_create_dir("config", hdev->debugfs); dbg->psmode = debugfs_create_file("psmode", 0644, dbg->config_dir, hdev->driver_data, &btmrvl_psmode_fops); @@ -388,7 +390,7 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) dbg->hscfgcmd = debugfs_create_file("hscfgcmd", 0644, dbg->config_dir, hdev->driver_data, &btmrvl_hscfgcmd_fops); - dbg->status_dir = debugfs_create_dir("status", dbg->root_dir); + dbg->status_dir = debugfs_create_dir("status", hdev->debugfs); dbg->curpsmode = debugfs_create_file("curpsmode", 0444, dbg->status_dir, hdev->driver_data, @@ -425,7 +427,5 @@ void btmrvl_debugfs_remove(struct hci_dev *hdev) debugfs_remove(dbg->txdnldready); debugfs_remove(dbg->status_dir); - debugfs_remove(dbg->root_dir); - kfree(dbg); } -- 1.6.6 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 7/9] Bluetooth: Add controller types for BR/EDR and 802.11 AMP 2010-02-27 22:38 ` [PATCH 6/9] Bluetooth: Convert Marvell driver to use per adapter debugfs Marcel Holtmann @ 2010-02-27 22:38 ` Marcel Holtmann 2010-02-27 22:38 ` [PATCH 8/9] Bluetooth: Add SCO fallback for unsupported feature error Marcel Holtmann 0 siblings, 1 reply; 15+ messages in thread From: Marcel Holtmann @ 2010-02-27 22:38 UTC (permalink / raw) To: David Miller; +Cc: netdev With the Bluetooth 3.0 specification and the introduction of alternate MAC/PHY (AMP) support, it is required to differentiate between primary BR/EDR controllers and 802.11 AMP controllers. So introduce a special type inside HCI device for differentiation. For now all AMP controllers will be treated as raw devices until an AMP manager has been implemented. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> --- include/net/bluetooth/hci.h | 4 ++++ include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_core.c | 6 +++++- net/bluetooth/hci_sysfs.c | 20 ++++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletions(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 3350a66..fc0c502 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -52,6 +52,10 @@ #define HCI_PCI 5 #define HCI_SDIO 6 +/* HCI controller types */ +#define HCI_BREDR 0x00 +#define HCI_80211 0x01 + /* HCI device quirks */ enum { HCI_QUIRK_NO_RESET, diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 4c94c1e..ce3c99e 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -71,6 +71,7 @@ struct hci_dev { unsigned long flags; __u16 id; __u8 bus; + __u8 dev_type; bdaddr_t bdaddr; __u8 dev_name[248]; __u8 dev_class[3]; diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 4b62ed0..4ad2319 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -491,6 +491,10 @@ int hci_dev_open(__u16 dev) if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) set_bit(HCI_RAW, &hdev->flags); + /* Treat all non BR/EDR controllers as raw devices for now */ + if (hdev->dev_type != HCI_BREDR) + set_bit(HCI_RAW, &hdev->flags); + if (hdev->open(hdev)) { ret = -EIO; goto done; @@ -797,7 +801,7 @@ int hci_get_dev_info(void __user *arg) strcpy(di.name, hdev->name); di.bdaddr = hdev->bdaddr; - di.type = hdev->bus; + di.type = (hdev->bus & 0x0f) | (hdev->dev_type << 4); di.flags = hdev->flags; di.pkt_type = hdev->pkt_type; di.acl_mtu = hdev->acl_mtu; diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index f9d93f9..1a79a6c 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -192,12 +192,30 @@ static inline char *host_bustostr(int bus) } } +static inline char *host_typetostr(int type) +{ + switch (type) { + case HCI_BREDR: + return "BR/EDR"; + case HCI_80211: + return "802.11"; + default: + return "UNKNOWN"; + } +} + static ssize_t show_bus(struct device *dev, struct device_attribute *attr, char *buf) { struct hci_dev *hdev = dev_get_drvdata(dev); return sprintf(buf, "%s\n", host_bustostr(hdev->bus)); } +static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct hci_dev *hdev = dev_get_drvdata(dev); + return sprintf(buf, "%s\n", host_typetostr(hdev->dev_type)); +} + static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf) { struct hci_dev *hdev = dev_get_drvdata(dev); @@ -334,6 +352,7 @@ static ssize_t store_sniff_min_interval(struct device *dev, struct device_attrib } static DEVICE_ATTR(bus, S_IRUGO, show_bus, NULL); +static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); static DEVICE_ATTR(class, S_IRUGO, show_class, NULL); static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); @@ -351,6 +370,7 @@ static DEVICE_ATTR(sniff_min_interval, S_IRUGO | S_IWUSR, static struct attribute *bt_host_attrs[] = { &dev_attr_bus.attr, + &dev_attr_type.attr, &dev_attr_name.attr, &dev_attr_class.attr, &dev_attr_address.attr, -- 1.6.6 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 8/9] Bluetooth: Add SCO fallback for unsupported feature error 2010-02-27 22:38 ` [PATCH 7/9] Bluetooth: Add controller types for BR/EDR and 802.11 AMP Marcel Holtmann @ 2010-02-27 22:38 ` Marcel Holtmann 2010-02-27 22:38 ` [PATCH 9/9] Bluetooth: Fix out of scope variable access in hci_sock_cmsg() Marcel Holtmann 0 siblings, 1 reply; 15+ messages in thread From: Marcel Holtmann @ 2010-02-27 22:38 UTC (permalink / raw) To: David Miller; +Cc: netdev From: Stephen Coe <smcoe1@gmail.com> The Bluetooth SIG PTS test case: TC_AG_ACS_BV_10_I, rejects eSCO with "Unsupported Feature or Parameter Value" (0x11). This patch adds case for SCO fallback. 2007-09-20 12:20:37.787747 > HCI Event: Number of Completed Packets (0x13) plen 5 handle 38 packets 1 2007-09-20 12:20:37.842154 < HCI Command: Setup Synchronous Connection (0x01|0x0028) plen 17 handle 38 voice setting 0x0060 2007-09-20 12:20:37.847037 > HCI Event: Command Status (0x0f) plen 4 Setup Synchronous Connection (0x01|0x0028) status 0x00 ncmd 1 2007-09-20 12:20:37.855233 > HCI Event: Max Slots Change (0x1b) plen 3 handle 38 slots 1 2007-09-20 12:20:39.913354 > HCI Event: Synchronous Connect Complete (0x2c) plen 17 status 0x11 handle 38 bdaddr 00:16:93:01:01:7A type eSCO Error: Unsupported Feature or Parameter Value 2007-09-20 12:20:39.922629 > HCI Event: Max Slots Change (0x1b) plen 3 handle 38 slots 5 2007-09-20 12:20:58.126886 < ACL data: handle 38 flags 0x02 dlen 8 L2CAP(d): cid 0x0041 len 4 [psm 0] 0000: 0b 53 01 b8 .S.. 2007-09-20 12:20:58.130138 > HCI Event: Number of Completed Packets (0x13) plen 5 handle 38 packets 1 Signed-off-by: Stephen Coe <smcoe1@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> --- net/bluetooth/hci_event.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 592da5c..6c57fc7 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -1698,6 +1698,7 @@ static inline void hci_sync_conn_complete_evt(struct hci_dev *hdev, struct sk_bu hci_conn_add_sysfs(conn); break; + case 0x11: /* Unsupported Feature or Parameter Value */ case 0x1c: /* SCO interval rejected */ case 0x1a: /* Unsupported Remote Feature */ case 0x1f: /* Unspecified error */ -- 1.6.6 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 9/9] Bluetooth: Fix out of scope variable access in hci_sock_cmsg() 2010-02-27 22:38 ` [PATCH 8/9] Bluetooth: Add SCO fallback for unsupported feature error Marcel Holtmann @ 2010-02-27 22:38 ` Marcel Holtmann 0 siblings, 0 replies; 15+ messages in thread From: Marcel Holtmann @ 2010-02-27 22:38 UTC (permalink / raw) To: David Miller; +Cc: netdev From: Johann Felix Soden <johfel@users.sourceforge.net> The pointer data can point to the variable ctv. Access to data happens when ctv is already out of scope. Signed-off-by: Johann Felix Soden <johfel@users.sourceforge.net> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> --- net/bluetooth/hci_sock.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 688cfeb..b0e6108 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -338,8 +338,8 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ data = &tv; len = sizeof(tv); #ifdef CONFIG_COMPAT + struct compat_timeval ctv; if (msg->msg_flags & MSG_CMSG_COMPAT) { - struct compat_timeval ctv; ctv.tv_sec = tv.tv_sec; ctv.tv_usec = tv.tv_usec; data = &ctv; -- 1.6.6 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: Pull request: bluetooth-next-2.6 2010-02-27 2010-02-27 22:38 Pull request: bluetooth-next-2.6 2010-02-27 Marcel Holtmann 2010-02-27 22:38 ` [PATCH 1/9] Bluetooth: Add __init/__exit macros to Marvell SDIO driver Marcel Holtmann @ 2010-02-28 8:19 ` David Miller 2010-02-28 8:33 ` Marcel Holtmann 1 sibling, 1 reply; 15+ messages in thread From: David Miller @ 2010-02-28 8:19 UTC (permalink / raw) To: marcel; +Cc: netdev From: Marcel Holtmann <marcel@holtmann.org> Date: Sat, 27 Feb 2010 23:38:29 +0100 > Please pull from > > git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-next-2.6.git master There are no new changes in that tree. Either you forgot to push or you gave me the wrong URL. :-) davem@sunset:~/src/GIT/net-next-2.6$ git pull git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-next-2.6.git master >From git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-next-2.6 * branch master -> FETCH_HEAD Already up-to-date. davem@sunset:~/src/GIT/net-next-2.6$ ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Pull request: bluetooth-next-2.6 2010-02-27 2010-02-28 8:19 ` Pull request: bluetooth-next-2.6 2010-02-27 David Miller @ 2010-02-28 8:33 ` Marcel Holtmann 2010-02-28 8:41 ` David Miller 0 siblings, 1 reply; 15+ messages in thread From: Marcel Holtmann @ 2010-02-28 8:33 UTC (permalink / raw) To: David Miller; +Cc: netdev Hi Dave, > > Please pull from > > > > git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-next-2.6.git master > > There are no new changes in that tree. Either you forgot to push > or you gave me the wrong URL. :-) > > davem@sunset:~/src/GIT/net-next-2.6$ git pull git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-next-2.6.git master > From git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-next-2.6 > * branch master -> FETCH_HEAD > Already up-to-date. > davem@sunset:~/src/GIT/net-next-2.6$ that is embarrassing. I indeed just forgot to call git push after updating the tree. Sorry about that. Try again, they should show up now. Regards Marcel ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Pull request: bluetooth-next-2.6 2010-02-27 2010-02-28 8:33 ` Marcel Holtmann @ 2010-02-28 8:41 ` David Miller 2010-02-28 8:52 ` Marcel Holtmann 0 siblings, 1 reply; 15+ messages in thread From: David Miller @ 2010-02-28 8:41 UTC (permalink / raw) To: marcel; +Cc: netdev From: Marcel Holtmann <marcel@holtmann.org> Date: Sun, 28 Feb 2010 00:33:16 -0800 > that is embarrassing. I indeed just forgot to call git push after > updating the tree. Sorry about that. Try again, they should show up now. Ok thanks. But I just noticed that patch #9 is bogus, it ends up mixing code and variable declarations in the function. Please fix this and resend your pull request. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Pull request: bluetooth-next-2.6 2010-02-27 2010-02-28 8:41 ` David Miller @ 2010-02-28 8:52 ` Marcel Holtmann 2010-02-28 8:58 ` David Miller 0 siblings, 1 reply; 15+ messages in thread From: Marcel Holtmann @ 2010-02-28 8:52 UTC (permalink / raw) To: David Miller; +Cc: netdev Hi Dave, > > that is embarrassing. I indeed just forgot to call git push after > > updating the tree. Sorry about that. Try again, they should show up now. > > Ok thanks. > > But I just noticed that patch #9 is bogus, it ends up mixing > code and variable declarations in the function. Please > fix this and resend your pull request. makes it more ugly, but you are right. I updated the tree with a proper fix for that one now. Please pull again. Regards Marcel ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Pull request: bluetooth-next-2.6 2010-02-27 2010-02-28 8:52 ` Marcel Holtmann @ 2010-02-28 8:58 ` David Miller 0 siblings, 0 replies; 15+ messages in thread From: David Miller @ 2010-02-28 8:58 UTC (permalink / raw) To: marcel; +Cc: netdev From: Marcel Holtmann <marcel@holtmann.org> Date: Sun, 28 Feb 2010 00:52:41 -0800 > Hi Dave, > >> But I just noticed that patch #9 is bogus, it ends up mixing >> code and variable declarations in the function. Please >> fix this and resend your pull request. > > makes it more ugly, but you are right. I updated the tree with a proper > fix for that one now. Please pull again. Looks a lot better, pulled thanks! ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2010-02-28 8:58 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-02-27 22:38 Pull request: bluetooth-next-2.6 2010-02-27 Marcel Holtmann 2010-02-27 22:38 ` [PATCH 1/9] Bluetooth: Add __init/__exit macros to Marvell SDIO driver Marcel Holtmann 2010-02-27 22:38 ` [PATCH 2/9] Bluetooth: Make USB device id constant Marcel Holtmann 2010-02-27 22:38 ` [PATCH 3/9] Bluetooth: Add missing kfree() on error path in Atheros driver Marcel Holtmann 2010-02-27 22:38 ` [PATCH 4/9] Bluetooth: Convert controller hdev->type to hdev->bus Marcel Holtmann 2010-02-27 22:38 ` [PATCH 5/9] Bluetooth: Convert inquiry cache to use debugfs instead of sysfs Marcel Holtmann 2010-02-27 22:38 ` [PATCH 6/9] Bluetooth: Convert Marvell driver to use per adapter debugfs Marcel Holtmann 2010-02-27 22:38 ` [PATCH 7/9] Bluetooth: Add controller types for BR/EDR and 802.11 AMP Marcel Holtmann 2010-02-27 22:38 ` [PATCH 8/9] Bluetooth: Add SCO fallback for unsupported feature error Marcel Holtmann 2010-02-27 22:38 ` [PATCH 9/9] Bluetooth: Fix out of scope variable access in hci_sock_cmsg() Marcel Holtmann 2010-02-28 8:19 ` Pull request: bluetooth-next-2.6 2010-02-27 David Miller 2010-02-28 8:33 ` Marcel Holtmann 2010-02-28 8:41 ` David Miller 2010-02-28 8:52 ` Marcel Holtmann 2010-02-28 8:58 ` David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).