Re: [PATCH v5 4/8] soc: qcom: rpmpd: Add support for get/set performance state
From: Stephen Boyd
Date: Wed Dec 05 2018 - 15:46:38 EST
Quoting Rajendra Nayak (2018-12-05 02:11:22)
>
> On 12/5/2018 12:33 PM, Rajendra Nayak wrote:
> >>
> >>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturnÂ0;
> >>> +ÂÂÂÂÂÂÂ}
> >>> +
> >>> +ÂÂÂÂÂÂÂof_node_put(np);
> >>
> >> ThisÂsameÂcodeÂexistsÂtwice.ÂPerhapsÂaÂhelperÂneedsÂtoÂexistÂfor
> >> qcom_rpm_get_performance()ÂtoÂpullÂtheÂnumberÂoutÂofÂtheÂDT.
> >
> > SureÂIÂcanÂmakeÂbothÂdriversÂuseÂaÂcommonÂhelperÂinsteadÂofÂduplicatingÂit.
>
> which would mean I will need to create a new file just to define the
> common helper. Does that seem like an overkill?
Maybe put it in the genpd code and let it take a const char *name
argument that picks out the property that drivers want to look at? That
way other OPP properties can be picked out with a simple call to the
function but it's generic enough to be used in other places.