Bluetooth: hci_bcm: Enable support for set_diag driver callback
Marcel Holtmann
maintainerPATCH 1/1 Bluetooth: hci_bcm: Enable support for set_diag driver callback
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.
--- drivers/bluetooth/hci_bcm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/bluetooth/hci_bcm.c +24 -0
@@ -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));
Signature · 1 line
2.4.3
kbuild test robot
build botconfig: i386-randconfig-i0-201540 (attached as .config) reproduce:
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
Johan Hedberg
AppliedHi Marcel,
Quoted 8 lines · Marcel Holtmann
The
set_diagdriver callback allows enabling and disabling the vendor specific diagnostic information. Since Broadcom chips have support for a dedicatedLM_DIAGchannel, hook it up accordingly.Signed-off-by Marcel Holtmann <[email protected]>--- drivers/bluetooth/hci_bcm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
Applied to bluetooth-next. Thanks.
Johan