Hi Daniel,
On Tuesday, January 24, 2017, Daniel Lezcano wrote:
> > > > +early_platform_init("earlytimer", &ostm_timer);
> > > > +subsys_initcall(ostm_init); module_exit(ostm_exit);
> > > > +
> > > > +MODULE_AUTHOR("Chris Brandt");
> > > > +MODULE_DESCRIPTION("Renesas OSTM Timer Driver");
> > > > +MODULE_LICENSE("GPL v2");
> > >
> > > Maybe you can try with builtin_platform ?
> >
> > Good idea. But, now I get a "Section mismatch" during link time so
> > I'll have to figure out why that is.
>
> Mmh, I think it would be more consistent to convert this to:
>
> CLOCKSOURCE_OF_DECLARE(ostm, "renesas,ostm", ostm_init);
>
> The only problem is to get the struct device associated to the of_node
> passed as parameter to ostm_init in order to use the devm_* API.
>
> I think of_find_device_by_node should return the platform_device, then
> pdev->dev. If that works the other drivers will benefit from that to
> pdev->remove all
> the rollback code everywhere.
So I realized that in order to use builtin_platform, I can't have any of the
functions in __init because the build system has no idea that I never plan
on removing or probing again after boot. But, even if I take out all the
__init from my code, I'm still calling clocksource_mmio_init which is __init
so I can never escape the "Section mismatch".
This leaves me with 2 options:
1) Pull the clocksource_mmio driver code into my driver and leave everything
out of __init
2) Rewrite as a DT driver using CLOCKSOURCE_OF_DECLARE which puts most of
the code in __init
Of course the better (lower system memory) answer is #2.
I'll try your trick about of_find_device_by_node because while there are
equivalent OF functions for mapping resources, I do like the auto-rollback
feature of demv
Thank you,
Chris