Re: [PATCH 2/3] cpufreq: qcom: pass pvs_name size along with its buffer

From: Viresh Kumar
Date: Mon Oct 10 2022 - 02:01:53 EST


On 10-10-22, 11:22, Viresh Kumar wrote:
> On 01-10-22, 19:10, Fabien Parent wrote:
> > @@ -265,7 +269,7 @@ static int qcom_cpufreq_probe(struct platform_device *pdev)
> > struct nvmem_cell *speedbin_nvmem;
> > struct device_node *np;
> > struct device *cpu_dev;
> > - char *pvs_name = "speedXX-pvsXX-vXX";
> > + char *pvs_name = PVS_NAME_TEMPLATE;
> > unsigned cpu;
> > const struct of_device_id *match;
> > int ret;
> > @@ -306,8 +310,8 @@ static int qcom_cpufreq_probe(struct platform_device *pdev)
> > goto free_drv;
> > }
> >
> > - ret = drv->data->get_version(cpu_dev,
> > - speedbin_nvmem, &pvs_name, drv);
> > + ret = drv->data->get_version(cpu_dev, speedbin_nvmem, &pvs_name,
> > + sizeof(PVS_NAME_TEMPLATE), drv);
>
> Since the pvs name is always PVS_NAME_TEMPLATE, why are we even
> passing it and size here ? Why not directly use it in those
> get_version() implementations directly ?

I understand how &pvs_name is used here to later set the prop_name. I
think instead you should also implement drv->data->prop_name() here,
which can return valid name or NULL.

--
viresh