RE: [PATCH v3 2/2] clocksource: Add renesas-ostm timer driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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.


It was a good idea....but it will not work.

While CLOCKSOURCE_OF_DECLARE is good at putting the driver at the
front of the line for loading, it's too early in boot to detect
a platform_device.

of_find_device_by_node calls bus_find_device. But the first thing that
bus_find_device does is:

	if (!bus || !bus->p)
		return NULL;

But bus->p=0 so it returns immediately.


Of course changing the code over to:
        devm_kzalloc -> devm_kzalloc
devm_ioremap_nocache -> of_io_request_and_map
    platform_get_irq -> irq_of_parse_and_map
             dev_err -> pr_err


Then things work, but I'm back to managing the rollback code manually.


Any other ideas on how to get the corresponding platform_device for
a DT node?


Chris

��.n��������+%������w��{.n����z�{��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux