[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230731192229.GH1428172@hu-bjorande-lv.qualcomm.com>
Date: Mon, 31 Jul 2023 12:22:29 -0700
From: Bjorn Andersson <quic_bjorande@...cinc.com>
To: Konrad Dybcio <konrad.dybcio@...aro.org>
CC: 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>,
<luca.weiss@...rphone.com>, <u.kleine-koenig@...gutronix.de>,
<quic_subbaram@...cinc.com>, <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>
Subject: Re: [PATCH v2 3/7] soc: qcom: add QCOM PBS driver
On Wed, Jul 26, 2023 at 05:36:08PM +0200, Konrad Dybcio wrote:
> On 25.07.2023 21:34, Anjelique Melendez wrote:
> > +struct pbs_dev *get_pbs_client_device(struct device *dev)
> > +{
> > + struct device_node *pbs_dev_node;
> > + struct platform_device *pdev;
> > + struct pbs_dev *pbs;
> > +
> > + pbs_dev_node = of_parse_phandle(dev->of_node, "qcom,pbs", 0);
> > + if (!pbs_dev_node) {
> > + dev_err(dev, "Missing qcom,pbs property\n");
> > + return ERR_PTR(-ENODEV);
> > + }
> > +
> > + pdev = of_find_device_by_node(pbs_dev_node);
> > + if (!pdev) {
> > + dev_err(dev, "Unable to find PBS dev_node\n");
> > + pbs = ERR_PTR(-EPROBE_DEFER);
> > + goto out;
> > + }
> > +
> > + pbs = platform_get_drvdata(pdev);
> > + if (!pbs) {
> This check seems unnecessary, the PBS driver would have had to fail
> probing if set_drvdata never got called.
>
That's not necessarily the case, the platform_device will exist before
the probe function has been invoked. So checking this sounds
appropriate.
But if we have a valid link, but no drvdata, perhaps it would be more
appropriate to return -EPROBE_DEFER?
Regards,
Bjorn
Powered by blists - more mailing lists