[PATCH v3 4/6] thermal: sun8i: add syscon register access code
Krzysztof Kozlowski
krzysztof.kozlowski at linaro.org
Mon Nov 27 23:43:32 PST 2023
On 28/11/2023 01:58, Andre Przywara wrote:
>
> +static struct regmap *sun8i_ths_get_syscon_regmap(struct device_node *node)
> +{
> + struct device_node *syscon_node;
> + struct platform_device *syscon_pdev;
> + struct regmap *regmap = NULL;
> +
> + syscon_node = of_parse_phandle(node, "syscon", 0);
Nope. For the 100th time, this cannot be generic.
> + if (!syscon_node)
> + return ERR_PTR(-ENODEV);
> +
> + syscon_pdev = of_find_device_by_node(syscon_node);
> + if (!syscon_pdev) {
> + /* platform device might not be probed yet */
> + regmap = ERR_PTR(-EPROBE_DEFER);
> + goto out_put_node;
> + }
> +
> + /* If no regmap is found then the other device driver is at fault */
> + regmap = dev_get_regmap(&syscon_pdev->dev, NULL);
> + if (!regmap)
> + regmap = ERR_PTR(-EINVAL);
Aren't you open-coding existing API to get regmap from syscon?
Best regards,
Krzysztof
More information about the linux-arm-kernel
mailing list