* [PATCH 1/2] interconnect: Add a common standard aggregate function @ 2019-11-28 13:48 Georgi Djakov 2019-11-28 13:48 ` [PATCH 2/2] interconnect: qcom: Use the " Georgi Djakov ` (3 more replies) 0 siblings, 4 replies; 8+ messages in thread From: Georgi Djakov @ 2019-11-28 13:48 UTC (permalink / raw) To: linux-pm Cc: evgreen, bjorn.andersson, agross, daidavid1, masneyb, sibis, linux-kernel, linux-arm-msm, georgi.djakov Currently there is one very standard aggregation method that is used by several drivers. Let's add this as a common function, so that drivers could just point to it, instead of copy/pasting code. Suggested-by: Evan Green <evgreen@chromium.org> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> --- drivers/interconnect/core.c | 10 ++++++++++ include/linux/interconnect-provider.h | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 0e4852feb395..2633fd223875 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -221,6 +221,16 @@ static int apply_constraints(struct icc_path *path) return ret; } +int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, + u32 peak_bw, u32 *agg_avg, u32 *agg_peak) +{ + *agg_avg += avg_bw; + *agg_peak = max(*agg_peak, peak_bw); + + return 0; +} +EXPORT_SYMBOL_GPL(icc_std_aggregate); + /* of_icc_xlate_onecell() - Translate function using a single index. * @spec: OF phandle args to map into an interconnect node. * @data: private data (pointer to struct icc_onecell_data) diff --git a/include/linux/interconnect-provider.h b/include/linux/interconnect-provider.h index 31440c921216..0c494534b4d3 100644 --- a/include/linux/interconnect-provider.h +++ b/include/linux/interconnect-provider.h @@ -92,6 +92,8 @@ struct icc_node { #if IS_ENABLED(CONFIG_INTERCONNECT) +int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, + u32 peak_bw, u32 *agg_avg, u32 *agg_peak); struct icc_node *icc_node_create(int id); void icc_node_destroy(int id); int icc_link_create(struct icc_node *node, const int dst_id); @@ -104,6 +106,12 @@ int icc_provider_del(struct icc_provider *provider); #else +static inline int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, + u32 peak_bw, u32 *agg_avg, u32 *agg_peak) +{ + return -ENOTSUPP; +} + static inline struct icc_node *icc_node_create(int id) { return ERR_PTR(-ENOTSUPP); ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] interconnect: qcom: Use the standard aggregate function 2019-11-28 13:48 [PATCH 1/2] interconnect: Add a common standard aggregate function Georgi Djakov @ 2019-11-28 13:48 ` Georgi Djakov 2019-11-28 15:15 ` Brian Masney ` (2 more replies) 2019-11-28 15:15 ` [PATCH 1/2] interconnect: Add a common " Brian Masney ` (2 subsequent siblings) 3 siblings, 3 replies; 8+ messages in thread From: Georgi Djakov @ 2019-11-28 13:48 UTC (permalink / raw) To: linux-pm Cc: evgreen, bjorn.andersson, agross, daidavid1, masneyb, sibis, linux-kernel, linux-arm-msm, georgi.djakov Now we have a common function for standard aggregation, so let's use it, instead of duplicating the code. Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> --- drivers/interconnect/qcom/msm8974.c | 15 +++------------ drivers/interconnect/qcom/qcs404.c | 15 +++------------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/interconnect/qcom/msm8974.c b/drivers/interconnect/qcom/msm8974.c index 8823dce811c3..bf724c2ca02b 100644 --- a/drivers/interconnect/qcom/msm8974.c +++ b/drivers/interconnect/qcom/msm8974.c @@ -550,15 +550,6 @@ static struct msm8974_icc_desc msm8974_snoc = { .num_nodes = ARRAY_SIZE(msm8974_snoc_nodes), }; -static int msm8974_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, - u32 peak_bw, u32 *agg_avg, u32 *agg_peak) -{ - *agg_avg += avg_bw; - *agg_peak = max(*agg_peak, peak_bw); - - return 0; -} - static void msm8974_icc_rpm_smd_send(struct device *dev, int rsc_type, char *name, int id, u64 val) { @@ -603,8 +594,8 @@ static int msm8974_icc_set(struct icc_node *src, struct icc_node *dst) qp = to_msm8974_icc_provider(provider); list_for_each_entry(n, &provider->nodes, node_list) - msm8974_icc_aggregate(n, 0, n->avg_bw, n->peak_bw, - &agg_avg, &agg_peak); + provider->aggregate(n, 0, n->avg_bw, n->peak_bw, + &agg_avg, &agg_peak); sum_bw = icc_units_to_bps(agg_avg); max_peak_bw = icc_units_to_bps(agg_peak); @@ -703,7 +694,7 @@ static int msm8974_icc_probe(struct platform_device *pdev) INIT_LIST_HEAD(&provider->nodes); provider->dev = dev; provider->set = msm8974_icc_set; - provider->aggregate = msm8974_icc_aggregate; + provider->aggregate = icc_std_aggregate; provider->xlate = of_icc_xlate_onecell; provider->data = data; diff --git a/drivers/interconnect/qcom/qcs404.c b/drivers/interconnect/qcom/qcs404.c index a4c6ba715f61..ce2e6faa3a79 100644 --- a/drivers/interconnect/qcom/qcs404.c +++ b/drivers/interconnect/qcom/qcs404.c @@ -327,15 +327,6 @@ static struct qcom_icc_desc qcs404_snoc = { .num_nodes = ARRAY_SIZE(qcs404_snoc_nodes), }; -static int qcom_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, - u32 peak_bw, u32 *agg_avg, u32 *agg_peak) -{ - *agg_avg += avg_bw; - *agg_peak = max(*agg_peak, peak_bw); - - return 0; -} - static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) { struct qcom_icc_provider *qp; @@ -354,8 +345,8 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) qp = to_qcom_provider(provider); list_for_each_entry(n, &provider->nodes, node_list) - qcom_icc_aggregate(n, 0, n->avg_bw, n->peak_bw, - &agg_avg, &agg_peak); + provider->aggregate(n, 0, n->avg_bw, n->peak_bw, + &agg_avg, &agg_peak); sum_bw = icc_units_to_bps(agg_avg); max_peak_bw = icc_units_to_bps(agg_peak); @@ -465,7 +456,7 @@ static int qnoc_probe(struct platform_device *pdev) INIT_LIST_HEAD(&provider->nodes); provider->dev = dev; provider->set = qcom_icc_set; - provider->aggregate = qcom_icc_aggregate; + provider->aggregate = icc_std_aggregate; provider->xlate = of_icc_xlate_onecell; provider->data = data; ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] interconnect: qcom: Use the standard aggregate function 2019-11-28 13:48 ` [PATCH 2/2] interconnect: qcom: Use the " Georgi Djakov @ 2019-11-28 15:15 ` Brian Masney 2019-11-28 17:54 ` Bjorn Andersson 2019-12-06 20:44 ` Evan Green 2 siblings, 0 replies; 8+ messages in thread From: Brian Masney @ 2019-11-28 15:15 UTC (permalink / raw) To: Georgi Djakov Cc: linux-pm, evgreen, bjorn.andersson, agross, daidavid1, sibis, linux-kernel, linux-arm-msm On Thu, Nov 28, 2019 at 03:48:39PM +0200, Georgi Djakov wrote: > Now we have a common function for standard aggregation, so let's use it, > instead of duplicating the code. > > Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> Reviewed-by: Brian Masney <masneyb@onstation.org> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] interconnect: qcom: Use the standard aggregate function 2019-11-28 13:48 ` [PATCH 2/2] interconnect: qcom: Use the " Georgi Djakov 2019-11-28 15:15 ` Brian Masney @ 2019-11-28 17:54 ` Bjorn Andersson 2019-12-06 20:44 ` Evan Green 2 siblings, 0 replies; 8+ messages in thread From: Bjorn Andersson @ 2019-11-28 17:54 UTC (permalink / raw) To: Georgi Djakov Cc: linux-pm, evgreen, agross, daidavid1, masneyb, sibis, linux-kernel, linux-arm-msm On Thu 28 Nov 05:48 PST 2019, Georgi Djakov wrote: > Now we have a common function for standard aggregation, so let's use it, > instead of duplicating the code. > > Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> > --- > drivers/interconnect/qcom/msm8974.c | 15 +++------------ > drivers/interconnect/qcom/qcs404.c | 15 +++------------ > 2 files changed, 6 insertions(+), 24 deletions(-) > > diff --git a/drivers/interconnect/qcom/msm8974.c b/drivers/interconnect/qcom/msm8974.c > index 8823dce811c3..bf724c2ca02b 100644 > --- a/drivers/interconnect/qcom/msm8974.c > +++ b/drivers/interconnect/qcom/msm8974.c > @@ -550,15 +550,6 @@ static struct msm8974_icc_desc msm8974_snoc = { > .num_nodes = ARRAY_SIZE(msm8974_snoc_nodes), > }; > > -static int msm8974_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, > - u32 peak_bw, u32 *agg_avg, u32 *agg_peak) > -{ > - *agg_avg += avg_bw; > - *agg_peak = max(*agg_peak, peak_bw); > - > - return 0; > -} > - > static void msm8974_icc_rpm_smd_send(struct device *dev, int rsc_type, > char *name, int id, u64 val) > { > @@ -603,8 +594,8 @@ static int msm8974_icc_set(struct icc_node *src, struct icc_node *dst) > qp = to_msm8974_icc_provider(provider); > > list_for_each_entry(n, &provider->nodes, node_list) > - msm8974_icc_aggregate(n, 0, n->avg_bw, n->peak_bw, > - &agg_avg, &agg_peak); > + provider->aggregate(n, 0, n->avg_bw, n->peak_bw, > + &agg_avg, &agg_peak); > > sum_bw = icc_units_to_bps(agg_avg); > max_peak_bw = icc_units_to_bps(agg_peak); > @@ -703,7 +694,7 @@ static int msm8974_icc_probe(struct platform_device *pdev) > INIT_LIST_HEAD(&provider->nodes); > provider->dev = dev; > provider->set = msm8974_icc_set; > - provider->aggregate = msm8974_icc_aggregate; > + provider->aggregate = icc_std_aggregate; > provider->xlate = of_icc_xlate_onecell; > provider->data = data; > > diff --git a/drivers/interconnect/qcom/qcs404.c b/drivers/interconnect/qcom/qcs404.c > index a4c6ba715f61..ce2e6faa3a79 100644 > --- a/drivers/interconnect/qcom/qcs404.c > +++ b/drivers/interconnect/qcom/qcs404.c > @@ -327,15 +327,6 @@ static struct qcom_icc_desc qcs404_snoc = { > .num_nodes = ARRAY_SIZE(qcs404_snoc_nodes), > }; > > -static int qcom_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, > - u32 peak_bw, u32 *agg_avg, u32 *agg_peak) > -{ > - *agg_avg += avg_bw; > - *agg_peak = max(*agg_peak, peak_bw); > - > - return 0; > -} > - > static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) > { > struct qcom_icc_provider *qp; > @@ -354,8 +345,8 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) > qp = to_qcom_provider(provider); > > list_for_each_entry(n, &provider->nodes, node_list) > - qcom_icc_aggregate(n, 0, n->avg_bw, n->peak_bw, > - &agg_avg, &agg_peak); > + provider->aggregate(n, 0, n->avg_bw, n->peak_bw, > + &agg_avg, &agg_peak); > > sum_bw = icc_units_to_bps(agg_avg); > max_peak_bw = icc_units_to_bps(agg_peak); > @@ -465,7 +456,7 @@ static int qnoc_probe(struct platform_device *pdev) > INIT_LIST_HEAD(&provider->nodes); > provider->dev = dev; > provider->set = qcom_icc_set; > - provider->aggregate = qcom_icc_aggregate; > + provider->aggregate = icc_std_aggregate; > provider->xlate = of_icc_xlate_onecell; > provider->data = data; > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] interconnect: qcom: Use the standard aggregate function 2019-11-28 13:48 ` [PATCH 2/2] interconnect: qcom: Use the " Georgi Djakov 2019-11-28 15:15 ` Brian Masney 2019-11-28 17:54 ` Bjorn Andersson @ 2019-12-06 20:44 ` Evan Green 2 siblings, 0 replies; 8+ messages in thread From: Evan Green @ 2019-12-06 20:44 UTC (permalink / raw) To: Georgi Djakov Cc: linux-pm, Bjorn Andersson, Andy Gross, David Dai, masneyb, Sibi Sankar, LKML, linux-arm-msm On Thu, Nov 28, 2019 at 5:48 AM Georgi Djakov <georgi.djakov@linaro.org> wrote: > > Now we have a common function for standard aggregation, so let's use it, > instead of duplicating the code. > > Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> Reviewed-by: Evan Green <evgreen@chromium.org> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] interconnect: Add a common standard aggregate function 2019-11-28 13:48 [PATCH 1/2] interconnect: Add a common standard aggregate function Georgi Djakov 2019-11-28 13:48 ` [PATCH 2/2] interconnect: qcom: Use the " Georgi Djakov @ 2019-11-28 15:15 ` Brian Masney 2019-11-28 17:53 ` Bjorn Andersson 2019-12-06 20:43 ` Evan Green 3 siblings, 0 replies; 8+ messages in thread From: Brian Masney @ 2019-11-28 15:15 UTC (permalink / raw) To: Georgi Djakov Cc: linux-pm, evgreen, bjorn.andersson, agross, daidavid1, sibis, linux-kernel, linux-arm-msm On Thu, Nov 28, 2019 at 03:48:38PM +0200, Georgi Djakov wrote: > Currently there is one very standard aggregation method that is used by > several drivers. Let's add this as a common function, so that drivers > could just point to it, instead of copy/pasting code. > > Suggested-by: Evan Green <evgreen@chromium.org> > Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> Reviewed-by: Brian Masney <masneyb@onstation.org> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] interconnect: Add a common standard aggregate function 2019-11-28 13:48 [PATCH 1/2] interconnect: Add a common standard aggregate function Georgi Djakov 2019-11-28 13:48 ` [PATCH 2/2] interconnect: qcom: Use the " Georgi Djakov 2019-11-28 15:15 ` [PATCH 1/2] interconnect: Add a common " Brian Masney @ 2019-11-28 17:53 ` Bjorn Andersson 2019-12-06 20:43 ` Evan Green 3 siblings, 0 replies; 8+ messages in thread From: Bjorn Andersson @ 2019-11-28 17:53 UTC (permalink / raw) To: Georgi Djakov Cc: linux-pm, evgreen, agross, daidavid1, masneyb, sibis, linux-kernel, linux-arm-msm On Thu 28 Nov 05:48 PST 2019, Georgi Djakov wrote: > Currently there is one very standard aggregation method that is used by > several drivers. Let's add this as a common function, so that drivers > could just point to it, instead of copy/pasting code. > > Suggested-by: Evan Green <evgreen@chromium.org> > Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> > --- > drivers/interconnect/core.c | 10 ++++++++++ > include/linux/interconnect-provider.h | 8 ++++++++ > 2 files changed, 18 insertions(+) > > diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c > index 0e4852feb395..2633fd223875 100644 > --- a/drivers/interconnect/core.c > +++ b/drivers/interconnect/core.c > @@ -221,6 +221,16 @@ static int apply_constraints(struct icc_path *path) > return ret; > } > > +int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, > + u32 peak_bw, u32 *agg_avg, u32 *agg_peak) > +{ > + *agg_avg += avg_bw; > + *agg_peak = max(*agg_peak, peak_bw); > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(icc_std_aggregate); > + > /* of_icc_xlate_onecell() - Translate function using a single index. > * @spec: OF phandle args to map into an interconnect node. > * @data: private data (pointer to struct icc_onecell_data) > diff --git a/include/linux/interconnect-provider.h b/include/linux/interconnect-provider.h > index 31440c921216..0c494534b4d3 100644 > --- a/include/linux/interconnect-provider.h > +++ b/include/linux/interconnect-provider.h > @@ -92,6 +92,8 @@ struct icc_node { > > #if IS_ENABLED(CONFIG_INTERCONNECT) > > +int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, > + u32 peak_bw, u32 *agg_avg, u32 *agg_peak); > struct icc_node *icc_node_create(int id); > void icc_node_destroy(int id); > int icc_link_create(struct icc_node *node, const int dst_id); > @@ -104,6 +106,12 @@ int icc_provider_del(struct icc_provider *provider); > > #else > > +static inline int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, > + u32 peak_bw, u32 *agg_avg, u32 *agg_peak) > +{ > + return -ENOTSUPP; > +} > + > static inline struct icc_node *icc_node_create(int id) > { > return ERR_PTR(-ENOTSUPP); ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] interconnect: Add a common standard aggregate function 2019-11-28 13:48 [PATCH 1/2] interconnect: Add a common standard aggregate function Georgi Djakov ` (2 preceding siblings ...) 2019-11-28 17:53 ` Bjorn Andersson @ 2019-12-06 20:43 ` Evan Green 3 siblings, 0 replies; 8+ messages in thread From: Evan Green @ 2019-12-06 20:43 UTC (permalink / raw) To: Georgi Djakov Cc: linux-pm, Bjorn Andersson, Andy Gross, David Dai, masneyb, Sibi Sankar, LKML, linux-arm-msm On Thu, Nov 28, 2019 at 5:48 AM Georgi Djakov <georgi.djakov@linaro.org> wrote: > > Currently there is one very standard aggregation method that is used by > several drivers. Let's add this as a common function, so that drivers > could just point to it, instead of copy/pasting code. > > Suggested-by: Evan Green <evgreen@chromium.org> > Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> Reviewed-by: Evan Green <evgreen@chromium.org> ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-12-06 20:45 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-11-28 13:48 [PATCH 1/2] interconnect: Add a common standard aggregate function Georgi Djakov 2019-11-28 13:48 ` [PATCH 2/2] interconnect: qcom: Use the " Georgi Djakov 2019-11-28 15:15 ` Brian Masney 2019-11-28 17:54 ` Bjorn Andersson 2019-12-06 20:44 ` Evan Green 2019-11-28 15:15 ` [PATCH 1/2] interconnect: Add a common " Brian Masney 2019-11-28 17:53 ` Bjorn Andersson 2019-12-06 20:43 ` Evan Green
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).