static int hi3660_reset_probe()

in hisilicon/reset-hi3660.c [76:103]


static int hi3660_reset_probe(struct platform_device *pdev)
{
	struct hi3660_reset_controller *rc;
	struct device_node *np = pdev->dev.of_node;
	struct device *dev = &pdev->dev;

	rc = devm_kzalloc(dev, sizeof(*rc), GFP_KERNEL);
	if (!rc)
		return -ENOMEM;

	rc->map = syscon_regmap_lookup_by_phandle(np, "hisilicon,rst-syscon");
	if (rc->map == ERR_PTR(-ENODEV)) {
		/* fall back to the deprecated compatible */
		rc->map = syscon_regmap_lookup_by_phandle(np,
							  "hisi,rst-syscon");
	}
	if (IS_ERR(rc->map)) {
		dev_err(dev, "failed to get hisilicon,rst-syscon\n");
		return PTR_ERR(rc->map);
	}

	rc->rst.ops = &hi3660_reset_ops,
	rc->rst.of_node = np;
	rc->rst.of_reset_n_cells = 2;
	rc->rst.of_xlate = hi3660_reset_xlate;

	return reset_controller_register(&rc->rst);
}