Re: [PATCH 3/4] clk: qcom: Add support to LPASS AUDIO_CC Glitch Free Mux clocks
From: Stephen Boyd
Date: Wed Sep 23 2020 - 19:28:31 EST
Quoting Srinivas Kandagatla (2020-09-22 14:45:07)
> Thanks Stephen for review,
>
> On 22/09/2020 19:41, Stephen Boyd wrote:
> > Quoting Srinivas Kandagatla (2020-09-17 06:28:49)
> >> diff --git a/drivers/clk/qcom/lpass-gfm-sm8250.c b/drivers/clk/qcom/lpass-gfm-sm8250.c
> >> new file mode 100644
> >> index 000000000000..2d5c41ae4969
> >> --- /dev/null
> >> +++ b/drivers/clk/qcom/lpass-gfm-sm8250.c
> >> @@ -0,0 +1,235 @@
[...]
> >> +};
> >> +
> >> +static int lpass_gfm_clk_driver_probe(struct platform_device *pdev)
> >> +{
> >> + const struct lpass_gfm_data *data;
> >> + struct device *dev = &pdev->dev;
> >> + struct resource *res;
> >> + struct clk_gfm *gfm;
> >> + struct lpass_gfm *cc;
> >> + int err, i;
> >> +
> >> + cc = devm_kzalloc(dev, sizeof(*cc), GFP_KERNEL);
> >> + if (!cc)
> >> + return -ENOMEM;
> >> +
> >> + cc->core_vote = devm_clk_get(&pdev->dev, "core");
> >> + if (IS_ERR(cc->core_vote)) {
> >> + dev_dbg(dev, "Failed to get lpass core clk\n");
> >> + return PTR_ERR(cc->core_vote);
> >> + }
> >
> > Can this use the pm_clk stuff?
>
> you mean add runtime pm support or something else?
>
> I can give it a go and see!
>
Yes use the runtime PM support and pm_clk APIs. There are some examples
in this directory already.
>
> >
> >> +
> >> + data = of_device_get_match_data(dev);
> >
> > What if data is NULL?
> It should not be here if there is no match of compatible string, so data
> should not be NULL!
Ok sure but it always makes me feel better if we check for a valid
pointer with this API.