Re: [PATCH] Bluetooth: Fix registering HCI devices with duplicate name

Andrei Emeltchenko
2012-04-12T10:45:24Z

Hi Marcel,

On Thu, Apr 12, 2012 at 12:15:14PM +0200, Marcel Holtmann wrote:
> then lets fix the logic we have right now. It can not be that hard to
> have this behave correctly. Find the proper next free id and find the
> right location in the list to add it to.

We are highly dependent here on ordered list which is not good IMO,
especially given that BR/EDR shall be first element with id=0. This of
course works well in default situation when we have only 2 controllers.

> > > > BTW: Have you checked my patch version 3.
> > >
> > > If we have to run through that list twice, then we are doing something
> > > wrong. Also having to run through the whole list seems pointless. We
> > > just need to make sure that the list stays ordered.
> >
> > We are not running through the whole list, just until found free id.
>
> You are running the whole list for the bitmask creation and then a
> second time for finding the right location in the list. Fair enough that

Second run is not needed, we can just add to the tail of the list. In most
cases list will still be ordered and this does not matter since we do not
depend on ordered list.

Best regards
Andrei Emeltchenko

> the second time you only run until you found a free spot, but
> nevertheless, you run it again.
>
> Regards
>
> Marcel
>
>