[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3272350f-73fc-f6b6-326f-1b9d7db75758@linaro.org>
Date: Sat, 24 Jun 2023 12:01:32 +0200
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Anjelique Melendez <quic_amelende@...cinc.com>, pavel@....cz,
lee@...nel.org, thierry.reding@...il.com, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
agross@...nel.org, andersson@...nel.org
Cc: konrad.dybcio@...aro.org, u.kleine-koenig@...gutronix.de,
linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-pwm@...r.kernel.org, Abel Vesa <abel.vesa@...aro.org>
Subject: Re: [PATCH 3/7] soc: qcom: add QCOM PBS driver
On 24/06/2023 11:55, Krzysztof Kozlowski wrote:
>> +/**
>> + * get_pbs_client_device() - Get the PBS device used by client
>> + * @dev: Client device
>> + *
>> + * This function is used to get the PBS device that is being
>> + * used by the client.
>> + *
>> + * Returns: pbs_dev on success, ERR_PTR on failure
>> + */
>> +struct pbs_dev *get_pbs_client_device(struct device *dev)
>> +{
>> + struct device_node *pbs_dev_node;
>> + struct pbs_dev *pbs;
>> +
>> + pbs_dev_node = of_parse_phandle(dev->of_node, "qcom,pbs-client", 0);
>> + if (!pbs_dev_node) {
>> + pr_err("Missing qcom,pbs-client property\n");
>> + return ERR_PTR(-ENODEV);
>> + }
>> +
>> + mutex_lock(&pbs_list_lock);
>> + list_for_each_entry(pbs, &pbs_dev_list, link) {
>
> It does not make sense. You have the reference to the device, so you
> have the pbs (via container_of). Don't add some
> global-list-lookup-functions.
>
> Look for example at Abel Vesa's ICE patchset.
To be specific:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/soc/qcom/ice.c?h=v6.4-rc7#n293
(+CC Abel)
Best regards,
Krzysztof
Powered by blists - more mailing lists