]> git.karo-electronics.de Git - linux-beck.git/commit
Bluetooth: Fix registering hci with duplicate name
authorUlisses Furquim <ulisses@profusion.mobi>
Wed, 18 Apr 2012 15:13:04 +0000 (12:13 -0300)
committerGustavo Padovan <gustavo@padovan.org>
Wed, 9 May 2012 04:40:38 +0000 (01:40 -0300)
commitfc50744c1e518adfb4ff2eda156f941e20aea36d
treea03c61a9c59c57dcd3bda1b572dc913c8f4798d8
parent519e42b38ee47005aaa2243789cda54161e62dc8
Bluetooth: Fix registering hci with duplicate name

When adding HCI devices hci_register_dev assigns the same name
hci1 for subsequently added AMP devices.

...
[ 6958.381886] sysfs: cannot create duplicate filename
       '/devices/virtual/bluetooth/hci1
...

We assume id starts with the number we'll try to add the new device
and keep iterating until we find the proper place. The only difference
is we start with 0 for BR/EDR device and 1 for AMP devices (thus AMP
devices will never receive register as index 0). Then every hdev->id in
the _ordered_ list <= to the id we want we increment id and move the
variable head. In the end we'll have id as the first available one and
head is where you need to add hdev after to keep the list ordered.

Reported-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Ulisses Furquim <ulisses@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hci_core.c