Re: [PATCHv8 2/4] power_supply: Introduce generic psy charging driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 10, 2014 at 5:33 AM, Jenny Tc <jenny.tc@xxxxxxxxx> wrote:
> On Fri, Mar 07, 2014 at 09:25:20PM +0100, Pavel Machek wrote:

>> > +   /* sort based on priority. 0 has the highest priority  */
>> > +   for (i = 0; i < cnt; ++i)
>> > +           for (j = 0; j < cnt; ++j)
>> > +                   if (psy_prioirty(psy_lst[j]) > psy_prioirty(psy_lst[i]))
>> > +                           swap(psy_lst[j], psy_lst[i]);
>> > +
>>
>> WTF? Bubble sort in kernel?
>
> Yes, it's bubble sort. Since the number of power supply objects in real systems
> (max 4) are limited, I feel the complexity would be as same as any other
> sorting algorithms. Any suggestions?

You already have a kernel quicksort implementation in lib/sort.c.

Please restructure the code to make use of this as it is already
compiled into every kernel.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux