lkml.org 
[lkml]   [2020]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [EXT] [PATCH 1/4] net: fec: set GPR bit on suspend by DT connfiguration.
Date
From: Fuzzey, Martin <martin.fuzzey@flowbird.group> Sent: Wednesday, March 18, 2020 4:36 PM
> On Wed, 18 Mar 2020 at 07:26, Andy Duan <fugang.duan@nxp.com> wrote:
> >
> > From: Martin Fuzzey <martin.fuzzey@flowbird.group> Sent: Wednesday,
> > March 18, 2020 12:50 AM
> > > +static int fec_enet_of_parse_stop_mode(struct fec_enet_private *fep,
> > > + struct device_node *np) {
> > > + static const char prop[] = "fsl,stop-mode";
> > > + struct of_phandle_args args;
> > > + int ret;
> > > +
> > > + ret = of_parse_phandle_with_fixed_args(np, prop, 2, 0,
> > > + &args);
> > To save memory:
> >
> > ret = of_parse_phandle_with_fixed_args(np,
> > "fsl,stop-mode", 2, 0, &args);
> >
>
> Why would this save memory?
> prop is defined static const char[] (and not char *) so there will no be extra
> pointers.
>
> I haven't checked the generated assembler but this should generate the same
> code as a string litteral I think.
>
> It is also reused later in the function in a debug (which is the reason I did it
> this way to ensure the property name is unique and consistent.

static variable cost memory and never is not freed if the module is built in.

the later debug message cannot depend on the variable.
>
> Regards,
>
> Martin
>
> --
\
 
 \ /
  Last update: 2020-03-18 10:03    [W:0.048 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site