Re: [PATCH 1/4] soc: qcom: ice: introduce devm_of_qcom_ice_get
From: Krzysztof Kozlowski
Date: Fri Jan 17 2025 - 02:40:30 EST
On 16/01/2025 15:49, Tudor Ambarus wrote:
> +
> +static void devm_of_qcom_ice_put(struct device *dev, void *res)
> +{
> + qcom_ice_put(*(struct qcom_ice **)res);
> +}
> +
> +struct qcom_ice *devm_of_qcom_ice_get(struct device *dev)
That's exported function, you need kerneldoc here.
> +{
> + struct qcom_ice *ice, **dr;
> +
> + dr = devres_alloc(devm_of_qcom_ice_put, sizeof(*dr), GFP_KERNEL);
> + if (!dr)
> + return ERR_PTR(-ENOMEM);
> +
> + ice = of_qcom_ice_get(dev);
> + if (!IS_ERR_OR_NULL(ice)) {
> + *dr = ice;
> + devres_add(dev, dr);
> + } else {
> + devres_free(dr);
> + }
> +
> + return ice;
> +}
> +EXPORT_SYMBOL_GPL(devm_of_qcom_ice_get);
> +
> static int qcom_ice_probe(struct platform_device *pdev)
> {
> struct qcom_ice *engine;
> diff --git a/include/soc/qcom/ice.h b/include/soc/qcom/ice.h
> index 5870a94599a2..d5f6a228df65 100644
> --- a/include/soc/qcom/ice.h
> +++ b/include/soc/qcom/ice.h
> @@ -34,4 +34,6 @@ int qcom_ice_program_key(struct qcom_ice *ice,
> int slot);
> int qcom_ice_evict_key(struct qcom_ice *ice, int slot);
> struct qcom_ice *of_qcom_ice_get(struct device *dev);
> +struct qcom_ice *devm_of_qcom_ice_get(struct device *dev);
Put should be also added for completeness.
Best regards,
Krzysztof