Re: [PATCH V5 1/2] soc: qcom: aoss: Expose send for generic usecase

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Deepak Kumar Singh (2021-08-09 02:57:26)
>
> On 8/6/2021 12:04 AM, Stephen Boyd wrote:
> > Quoting Deepak Kumar Singh (2021-08-05 04:12:53)
> >> diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c
> >> index 934fcc4..b84cb31 100644
> >> --- a/drivers/soc/qcom/qcom_aoss.c
> >> +++ b/drivers/soc/qcom/qcom_aoss.c
> >> @@ -515,6 +521,43 @@ static void qmp_cooling_devices_remove(struct qmp *qmp)
> >>                  thermal_cooling_device_unregister(qmp->cooling_devs[i].cdev);
> >>   }
> >>
> >> +/**
> >> + * qmp_get() - get a qmp handle from a device
> >> + * @dev: client device pointer
> >> + *
> >> + * Return: handle to qmp device on success, ERR_PTR() on failure
> >> + */
> >> +struct qmp *qmp_get(struct device *dev)
> >> +{
> >> +       struct platform_device *pdev;
> >> +       struct device_node *np;
> >> +       struct qmp *qmp;
> >> +
> >> +       if (!dev || !dev->of_node)
> >> +               return ERR_PTR(-EINVAL);
> >> +
> >> +       np = of_parse_phandle(dev->of_node, "qcom,qmp", 0);
> >> +       if (!np)
> >> +               return ERR_PTR(-ENODEV);
> >> +
> >> +       pdev = of_find_device_by_node(np);
> >> +       of_node_put(np);
> >> +       if (!pdev)
> >> +               return ERR_PTR(-EINVAL);
> >> +
> >> +       qmp = platform_get_drvdata(pdev);
> >> +
> >> +       return qmp ? qmp : ERR_PTR(-EPROBE_DEFER);
> >> +}
> >> +EXPORT_SYMBOL(qmp_get);
> >> +
> >> +void qmp_put(struct qmp *qmp)
> >> +{
> >> +       if (!IS_ERR_OR_NULL(qmp))
> >> +               put_device(qmp->dev);
> > Where is the corresponding get_device() call?
> of_find_device_by_node() internally calls get_device(), so no need to
> call get_device() explicitly.

Got it. Can you add a comment here so we remember?

	/*
	 * Match get_device() inside of_find_device_by_node() in
	 * qmp_get()
	 */

and it would be super useful if we could update the documentation on
that API, and the one it calls, so callers know about this.



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux