lkml.org 
[lkml]   [2020]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v1] clocksource: Avoid creating dead devices
On Thu, Feb 27, 2020 at 1:22 PM Saravana Kannan <saravanak@google.com> wrote:
>
> On Thu, Feb 27, 2020 at 1:06 AM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
> >
> > On 11/01/2020 06:21, Saravana Kannan wrote:
> > > Timer initialization is done during early boot way before the driver
> > > core starts processing devices and drivers. Timers initialized during
> > > this early boot period don't really need or use a struct device.
> > >
> > > However, for timers represented as device tree nodes, the struct devices
> > > are still created and sit around unused and wasting memory. This change
> > > avoid this by marking the device tree nodes as "populated" if the
> > > corresponding timer is successfully initialized.
> > >
> > > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > > ---
> > > drivers/clocksource/timer-probe.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/clocksource/timer-probe.c b/drivers/clocksource/timer-probe.c
> > > index ee9574da53c0..a10f28d750a9 100644
> > > --- a/drivers/clocksource/timer-probe.c
> > > +++ b/drivers/clocksource/timer-probe.c
> > > @@ -27,8 +27,10 @@ void __init timer_probe(void)
> > >
> > > init_func_ret = match->data;
> > >
> > > + of_node_set_flag(np, OF_POPULATED);
> > > ret = init_func_ret(np);
> > > if (ret) {
> > > + of_node_clear_flag(np, OF_POPULATED);
> >
> > Isn't it in conflict with:
> >
> > drivers/clocksource/ingenic-timer.c
> >
> > ?
>
> No, it won't interfere with that driver because:
> 1. This flag is getting set only if the driver already registered a
> timer init function using TIMER_OF_DECLARE.
> 2. And if the function fails, we clear the flag.
>
> So in the case of ingenic-timer, the device will still be there and be
> probed by the driver.

Daniel, friendly reminder. Or do you have a patchworks link too that I
can keep an eye on?

-Saravana

\
 
 \ /
  Last update: 2020-03-04 20:31    [W:0.068 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site