/* If there are footprints written before smp_init, do init on driver detection are too late. */
int __init mnemosyne_early_init(void)
{
	struct device_node *np;

	pr_info("%s: init from early init.\n", MNEMOSYNE_MODULE_NAME);

	np = of_find_node_by_name(NULL, MNEMOSYNE_DT_NAME);
	if (!np) {
		pr_warn("%s: cannot find mnemosyne device node named %s.\n", MNEMOSYNE_MODULE_NAME, MNEMOSYNE_DT_NAME);
		return -ENODEV;
	}

	return mnemosyne_parse_dt(np);
}
Пример #2
0
static int __devinit mnemosyne_probe(struct platform_device *pdev)
{
	if (pdev->dev.of_node) {
		if (mnemosyne_parse_dt(&pdev->dev)) {
			pr_err("%s: parse device tree fail.\n", MNEMOSYNE_MODULE_NAME);
			return -ENODEV;
		}
	} else {
		if (mnemosyne_parse_pdata(&pdev->dev)) {
			pr_err("%s: parse pdata fail.\n", MNEMOSYNE_MODULE_NAME);
			return -ENODEV;
		}
	}

	return 0;
}