lkml.org 
[lkml]   [2020]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: (EXT) Re: [PATCH mmc-next v2] mmc: allow setting slot index via device tree alias
From
Date
On Tue, 2020-08-25 at 11:39 +0200, Matthias Schiffer wrote:
> On Tue, 2020-08-25 at 11:14 +0200, Ulf Hansson wrote:
> > On Thu, 20 Aug 2020 at 09:59, Matthias Schiffer
> > <matthias.schiffer@ew.tq-group.com> wrote:
> > > +
> > > +static void __init mmc_of_reserve_idx(void)
> > > +{
> > > + int max;
> > > +
> > > + max = of_alias_get_highest_id("mmc");
> >
> > Is calling of_alias_get_highest_id("mmc") costly from an execution
> > point of view?
> >
> > If not, we might as well call it directly from mmc_alloc_host()
> > each
> > time a host is allocated instead, to simplify the code a bit.
>
> It's not particularly costly (it just walks the list of aliases once
> and does a string comparison for each entry), but it does so while
> holding the of_mutex.
>
> Both variants exist in the current kernel: The I2C core stores the
> hightest index in a global variable, while of_alias_get_highest_id()
> is
> called once for each registered SPI controller. I have a slight
> preference for the global variable solution.

Looking at this again, it's pretty much the same as of_alias_get_id().
I'll remove the extra functions and global variable.

Kind regards,
Matthias

\
 
 \ /
  Last update: 2020-08-25 13:25    [W:0.076 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site