linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_bcm: Enable support for set_diag driver callback
@ 2015-10-07 18:08 Marcel Holtmann
  2015-10-07 18:31 ` kbuild test robot
  2015-10-08  7:00 ` Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Marcel Holtmann @ 2015-10-07 18:08 UTC (permalink / raw)
  To: linux-bluetooth

The set_diag driver callback allows enabling and disabling the vendor
specific diagnostic information. Since Broadcom chips have support for
a dedicated LM_DIAG channel, hook it up accordingly.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 drivers/bluetooth/hci_bcm.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index 1425bf50ae99..645e66e9a945 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -249,6 +249,29 @@ static inline int bcm_request_irq(struct bcm_data *bcm) { return 0; }
 static inline int bcm_setup_sleep(struct hci_uart *hu) { return 0; }
 #endif
 
+static int bcm_set_diag(struct hci_dev *hdev, bool enable)
+{
+	struct hci_uart *hu = hci_get_drvdata(hdev);
+	struct bcm_data *bcm = hu->priv;
+	struct sk_buff *skb;
+
+	if (!test_bit(HCI_RUNNING, &hdev->flags))
+		return -ENETDOWN;
+
+	skb = bt_skb_alloc(3, GFP_KERNEL);
+	if (IS_ERR(skb))
+		return PTR_ERR(skb);
+
+	*skb_put(skb, 1) = BCM_LM_DIAG_PKT;
+	*skb_put(skb, 1) = 0xf0;
+	*skb_put(skb, 1) = enable;
+
+	skb_queue_tail(&bcm->txq, skb);
+	hci_uart_tx_wakeup(hu);
+
+	return 0;
+}
+
 static int bcm_open(struct hci_uart *hu)
 {
 	struct bcm_data *bcm;
@@ -342,6 +365,7 @@ static int bcm_setup(struct hci_uart *hu)
 
 	bt_dev_dbg(hu->hdev, "hu %p", hu);
 
+	hu->hdev->set_diag = bcm_set_diag;
 	hu->hdev->set_bdaddr = btbcm_set_bdaddr;
 
 	err = btbcm_initialize(hu->hdev, fw_name, sizeof(fw_name));
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: hci_bcm: Enable support for set_diag driver callback
  2015-10-07 18:08 [PATCH] Bluetooth: hci_bcm: Enable support for set_diag driver callback Marcel Holtmann
@ 2015-10-07 18:31 ` kbuild test robot
  2015-10-08  7:00 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2015-10-07 18:31 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: kbuild-all, linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 4149 bytes --]

Hi Marcel,

[auto build test ERROR on next-20151007 -- if it's inappropriate base, please ignore]

config: i386-randconfig-i0-201540 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/bluetooth/hci_bcm.c: In function 'bcm_set_diag':
>> drivers/bluetooth/hci_bcm.c:262:21: error: 'BCM_LM_DIAG_PKT' undeclared (first use in this function)
     *skb_put(skb, 1) = BCM_LM_DIAG_PKT;
                        ^
   drivers/bluetooth/hci_bcm.c:262:21: note: each undeclared identifier is reported only once for each function it appears in
   drivers/bluetooth/hci_bcm.c: In function 'bcm_setup':
>> drivers/bluetooth/hci_bcm.c:365:10: error: 'struct hci_dev' has no member named 'set_diag'
     hu->hdev->set_diag = bcm_set_diag;
             ^

vim +/BCM_LM_DIAG_PKT +262 drivers/bluetooth/hci_bcm.c

   256			return -ENETDOWN;
   257	
   258		skb = bt_skb_alloc(3, GFP_KERNEL);
   259		if (IS_ERR(skb))
   260			return PTR_ERR(skb);
   261	
 > 262		*skb_put(skb, 1) = BCM_LM_DIAG_PKT;
   263		*skb_put(skb, 1) = 0xf0;
   264		*skb_put(skb, 1) = enable;
   265	
   266		skb_queue_tail(&bcm->txq, skb);
   267		hci_uart_tx_wakeup(hu);
   268	
   269		return 0;
   270	}
   271	
   272	static int bcm_open(struct hci_uart *hu)
   273	{
   274		struct bcm_data *bcm;
   275		struct list_head *p;
   276	
   277		bt_dev_dbg(hu->hdev, "hu %p", hu);
   278	
   279		bcm = kzalloc(sizeof(*bcm), GFP_KERNEL);
   280		if (!bcm)
   281			return -ENOMEM;
   282	
   283		skb_queue_head_init(&bcm->txq);
   284	
   285		hu->priv = bcm;
   286	
   287		mutex_lock(&bcm_device_lock);
   288		list_for_each(p, &bcm_device_list) {
   289			struct bcm_device *dev = list_entry(p, struct bcm_device, list);
   290	
   291			/* Retrieve saved bcm_device based on parent of the
   292			 * platform device (saved during device probe) and
   293			 * parent of tty device used by hci_uart
   294			 */
   295			if (hu->tty->dev->parent == dev->pdev->dev.parent) {
   296				bcm->dev = dev;
   297				hu->init_speed = dev->init_speed;
   298	#ifdef CONFIG_PM
   299				dev->hu = hu;
   300	#endif
   301				bcm_gpio_set_power(bcm->dev, true);
   302				break;
   303			}
   304		}
   305	
   306		mutex_unlock(&bcm_device_lock);
   307	
   308		return 0;
   309	}
   310	
   311	static int bcm_close(struct hci_uart *hu)
   312	{
   313		struct bcm_data *bcm = hu->priv;
   314		struct bcm_device *bdev = bcm->dev;
   315	
   316		bt_dev_dbg(hu->hdev, "hu %p", hu);
   317	
   318		/* Protect bcm->dev against removal of the device or driver */
   319		mutex_lock(&bcm_device_lock);
   320		if (bcm_device_exists(bdev)) {
   321			bcm_gpio_set_power(bdev, false);
   322	#ifdef CONFIG_PM
   323			pm_runtime_disable(&bdev->pdev->dev);
   324			pm_runtime_set_suspended(&bdev->pdev->dev);
   325	
   326			if (device_can_wakeup(&bdev->pdev->dev)) {
   327				devm_free_irq(&bdev->pdev->dev, bdev->irq, bdev);
   328				device_init_wakeup(&bdev->pdev->dev, false);
   329			}
   330	
   331			bdev->hu = NULL;
   332	#endif
   333		}
   334		mutex_unlock(&bcm_device_lock);
   335	
   336		skb_queue_purge(&bcm->txq);
   337		kfree_skb(bcm->rx_skb);
   338		kfree(bcm);
   339	
   340		hu->priv = NULL;
   341		return 0;
   342	}
   343	
   344	static int bcm_flush(struct hci_uart *hu)
   345	{
   346		struct bcm_data *bcm = hu->priv;
   347	
   348		bt_dev_dbg(hu->hdev, "hu %p", hu);
   349	
   350		skb_queue_purge(&bcm->txq);
   351	
   352		return 0;
   353	}
   354	
   355	static int bcm_setup(struct hci_uart *hu)
   356	{
   357		struct bcm_data *bcm = hu->priv;
   358		char fw_name[64];
   359		const struct firmware *fw;
   360		unsigned int speed;
   361		int err;
   362	
   363		bt_dev_dbg(hu->hdev, "hu %p", hu);
   364	
 > 365		hu->hdev->set_diag = bcm_set_diag;
   366		hu->hdev->set_bdaddr = btbcm_set_bdaddr;
   367	
   368		err = btbcm_initialize(hu->hdev, fw_name, sizeof(fw_name));

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 20057 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: hci_bcm: Enable support for set_diag driver callback
  2015-10-07 18:08 [PATCH] Bluetooth: hci_bcm: Enable support for set_diag driver callback Marcel Holtmann
  2015-10-07 18:31 ` kbuild test robot
@ 2015-10-08  7:00 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2015-10-08  7:00 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Wed, Oct 07, 2015, Marcel Holtmann wrote:
> The set_diag driver callback allows enabling and disabling the vendor
> specific diagnostic information. Since Broadcom chips have support for
> a dedicated LM_DIAG channel, hook it up accordingly.
> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  drivers/bluetooth/hci_bcm.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)

Applied to bluetooth-next. Thanks.

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-08  7:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-07 18:08 [PATCH] Bluetooth: hci_bcm: Enable support for set_diag driver callback Marcel Holtmann
2015-10-07 18:31 ` kbuild test robot
2015-10-08  7:00 ` Johan Hedberg

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).