[PATCH 09/10] power: reset: cv18xx: New driver

Krzysztof Kozlowski krzk at kernel.org
Mon Feb 10 00:52:23 PST 2025


On 09/02/2025 23:06, Alexander Sverdlin wrote:
> +
> +static int cv18xx_reset_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct device_node *np = dev->of_node;
> +	int ret;
> +
> +	if (!np)
> +		return -ENODEV;
> +
> +	rtcsys_ctrl_regs = syscon_regmap_lookup_by_phandle(np, "sophgo,rtcsys-ctrl");
> +	if (IS_ERR(rtcsys_ctrl_regs))
> +		return dev_err_probe(dev, PTR_ERR(rtcsys_ctrl_regs),
> +				     "sophgo,rtcsys-ctrl lookup failed\n");
> +
> +	rtcsys_core_regs = syscon_regmap_lookup_by_phandle(np, "sophgo,rtcsys-core");
> +	if (IS_ERR(rtcsys_core_regs))
> +		return dev_err_probe(dev, PTR_ERR(rtcsys_core_regs),
> +				     "sophgo,rtcsys-core lookup failed\n");
> +
> +	ret = devm_register_restart_handler(&pdev->dev, cv18xx_restart_handler, NULL);
> +	if (ret)
> +		dev_err(&pdev->dev, "Cannot register restart handler (%pe)\n", ERR_PTR(ret));

You called it reset driver and placed it in reset, but this is reboot
handler?

> +	return ret;
> +}
> +
> +static const struct of_device_id cv18xx_reset_of_match[] = {
> +	{ .compatible = "sophgo,cv1800-reset" },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(platform, cv18xx_reset_of_match);
> +
> +static struct platform_driver cv18xx_reset_driver = {
> +	.probe = cv18xx_reset_probe,
> +	.driver = {
> +		.name = "cv18xx-reset",
> +		.of_match_table = cv18xx_reset_of_match,
> +	},
> +};
> +module_platform_driver(cv18xx_reset_driver);
> +
> +MODULE_AUTHOR("Alexander Sverdlin <alexander.sverdlin at gmail.com>");
> +MODULE_DESCRIPTION("Cvitek CV18xx/Sophgo SG2000 Reset Driver");
> +MODULE_ALIAS("platform:cv18xx-reset");

You should not need MODULE_ALIAS() in normal cases. If you need it,
usually it means your device ID table is wrong (e.g. misses either
entries or MODULE_DEVICE_TABLE()). MODULE_ALIAS() is not a substitute
for incomplete ID table.




Best regards,
Krzysztof



More information about the linux-riscv mailing list