[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140313091040.GB9494@amd.pavel.ucw.cz>
Date: Thu, 13 Mar 2014 10:10:41 +0100
From: Pavel Machek <pavel@....cz>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: Jenny Tc <jenny.tc@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
Anton Vorontsov <cbouatmailru@...il.com>,
Anton Vorontsov <anton.vorontsov@...aro.org>,
Kim Milo <Milo.Kim@...com>, Lee Jones <lee.jones@...aro.org>,
Jingoo Han <jg1.han@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Sachin Kamat <sachin.kamat@...aro.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Pali Rohár <pali.rohar@...il.com>,
Rhyland Klein <rklein@...dia.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
David Woodhouse <dwmw2@...radead.org>,
Tony Lindgren <tony@...mide.com>,
Russell King <linux@....linux.org.uk>,
Sebastian Reichel <sre@...g0.de>,
Aaro Koskinen <aaro.koskinen@....fi>,
Pallala Ramakrishna <ramakrishna.pallala@...el.com>,
Ивайло Димитров
<freemangordon@....bg>, Linux-OMAP <linux-omap@...r.kernel.org>
Subject: Re: [PATCHv8 2/4] power_supply: Introduce generic psy charging
driver
On Wed 2014-03-12 15:32:59, Linus Walleij wrote:
> On Mon, Mar 10, 2014 at 5:33 AM, Jenny Tc <jenny.tc@...el.com> 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.
Actually.. I believe the code needs more surgery than that. It should
not need those string lookups -- just attach data directly to struct
psy. And yes, if sort remains, it needs to use library function, but
I strongly believe sorting should not be neccessary here.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists