* [PATCH v2 20/34] clk: nxp: change lpc18xx_pll0_round_rate() return logic
[not found] <1514835300-381-1-git-send-email-pure.logic@nexus-software.ie>
@ 2018-01-01 19:34 ` Bryan O'Donoghue
2018-01-01 19:34 ` [PATCH v2 21/34] clk: lpc32xx: change clk_hclk_pll_round_rate() " Bryan O'Donoghue
` (3 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: Bryan O'Donoghue @ 2018-01-01 19:34 UTC (permalink / raw)
To: linux-arm-kernel
This patch updates the round_rate() logic here to return zero instead of a
negative number on error.
In conjunction with higher-level changes associated with acting on the
return value of clk_ops->round_rate() it is then possible to have
clk_ops->round_rate() return values from 1 Hz to ULONG_MAX Hz instead of
the current limitation of 1 Hz to LONG_MAX Hz.
Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: linux-clk at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
---
drivers/clk/nxp/clk-lpc18xx-cgu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/nxp/clk-lpc18xx-cgu.c b/drivers/clk/nxp/clk-lpc18xx-cgu.c
index e08bad9..396d4f7 100644
--- a/drivers/clk/nxp/clk-lpc18xx-cgu.c
+++ b/drivers/clk/nxp/clk-lpc18xx-cgu.c
@@ -381,13 +381,13 @@ static unsigned long lpc18xx_pll0_round_rate(struct clk_hw *hw,
if (*prate < rate) {
pr_warn("%s: pll dividers not supported\n", __func__);
- return -EINVAL;
+ return 0;
}
m = DIV_ROUND_UP_ULL(*prate, rate * 2);
if (m <= 0 && m > LPC18XX_PLL0_MSEL_MAX) {
pr_warn("%s: unable to support rate %lu\n", __func__, rate);
- return -EINVAL;
+ return 0;
}
return 2 * *prate * m;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 21/34] clk: lpc32xx: change clk_hclk_pll_round_rate() return logic
[not found] <1514835300-381-1-git-send-email-pure.logic@nexus-software.ie>
2018-01-01 19:34 ` [PATCH v2 20/34] clk: nxp: change lpc18xx_pll0_round_rate() return logic Bryan O'Donoghue
@ 2018-01-01 19:34 ` Bryan O'Donoghue
2018-01-01 19:34 ` [PATCH v2 23/34] clk: sirf: remove unnecessary long cast on return Bryan O'Donoghue
` (2 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: Bryan O'Donoghue @ 2018-01-01 19:34 UTC (permalink / raw)
To: linux-arm-kernel
This patch updates the round_rate() logic here to return zero instead of a
negative number on error.
In conjunction with higher-level changes associated with acting on the
return value of clk_ops->round_rate() it is then possible to have
clk_ops->round_rate() return values from 1 Hz to ULONG_MAX Hz instead of
the current limitation of 1 Hz to LONG_MAX Hz.
Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: Sylvain Lemieux <slemieux.tyco@gmail.com>
Cc: Gabriel Fernandez <gabriel.fernandez@st.com>
Cc: linux-clk at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
---
drivers/clk/nxp/clk-lpc32xx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/nxp/clk-lpc32xx.c b/drivers/clk/nxp/clk-lpc32xx.c
index 81ab57d..76c17f4 100644
--- a/drivers/clk/nxp/clk-lpc32xx.c
+++ b/drivers/clk/nxp/clk-lpc32xx.c
@@ -595,7 +595,7 @@ static unsigned long clk_hclk_pll_round_rate(struct clk_hw *hw,
pr_debug("%s: %lu/%lu\n", clk_hw_get_name(hw), *parent_rate, rate);
if (rate > 266500000)
- return -EINVAL;
+ return 0;
/* Have to check all 20 possibilities to find the minimal M */
for (p_i = 4; p_i >= 0; p_i--) {
@@ -622,7 +622,7 @@ static unsigned long clk_hclk_pll_round_rate(struct clk_hw *hw,
if (d == (u64)rate << 6) {
pr_err("%s: %lu: no valid PLL parameters are found\n",
clk_hw_get_name(hw), rate);
- return -EINVAL;
+ return 0;
}
clk->m_div = m;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 23/34] clk: sirf: remove unnecessary long cast on return
[not found] <1514835300-381-1-git-send-email-pure.logic@nexus-software.ie>
2018-01-01 19:34 ` [PATCH v2 20/34] clk: nxp: change lpc18xx_pll0_round_rate() return logic Bryan O'Donoghue
2018-01-01 19:34 ` [PATCH v2 21/34] clk: lpc32xx: change clk_hclk_pll_round_rate() " Bryan O'Donoghue
@ 2018-01-01 19:34 ` Bryan O'Donoghue
2018-01-01 19:34 ` [PATCH v2 29/34] clk: zte: change zx_audio_round_rate() return logic Bryan O'Donoghue
2018-01-01 19:34 ` [PATCH v2 33/34] clk: lpc32xx: change round_rate() " Bryan O'Donoghue
4 siblings, 0 replies; 5+ messages in thread
From: Bryan O'Donoghue @ 2018-01-01 19:34 UTC (permalink / raw)
To: linux-arm-kernel
Due to the old function signature of clk_ops->round_rate
pll_clk_round_rate does a cast of an internal unsigned long
to a long. After updating clk_ops->round_rate() to be an unsigned long
though the cast isn't necessary. Remove the cast now.
Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Barry Song <baohua@kernel.org>
Cc: linux-clk at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Cc: Barry Song <Baohua.Song@csr.com>
---
drivers/clk/sirf/clk-common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/sirf/clk-common.c b/drivers/clk/sirf/clk-common.c
index 3ce6741..bfa3f4b 100644
--- a/drivers/clk/sirf/clk-common.c
+++ b/drivers/clk/sirf/clk-common.c
@@ -121,7 +121,7 @@ static unsigned long pll_clk_round_rate(struct clk_hw *hw, unsigned long rate,
dividend = (u64)fin * nf;
do_div(dividend, nr * od);
- return (long)dividend;
+ return dividend;
}
static int pll_clk_set_rate(struct clk_hw *hw, unsigned long rate,
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 29/34] clk: zte: change zx_audio_round_rate() return logic
[not found] <1514835300-381-1-git-send-email-pure.logic@nexus-software.ie>
` (2 preceding siblings ...)
2018-01-01 19:34 ` [PATCH v2 23/34] clk: sirf: remove unnecessary long cast on return Bryan O'Donoghue
@ 2018-01-01 19:34 ` Bryan O'Donoghue
2018-01-01 19:34 ` [PATCH v2 33/34] clk: lpc32xx: change round_rate() " Bryan O'Donoghue
4 siblings, 0 replies; 5+ messages in thread
From: Bryan O'Donoghue @ 2018-01-01 19:34 UTC (permalink / raw)
To: linux-arm-kernel
This patch updates the round_rate() logic here to return zero instead of a
negative number on error.
In conjunction with higher-level changes associated with acting on the
return value of clk_ops->round_rate() it is then possible to have
clk_ops->round_rate() return values from 1 Hz to ULONG_MAX Hz instead of
the current limitation of 1 Hz to LONG_MAX Hz.
Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Cc: Jun Nie <jun.nie@linaro.org>
Cc: Baoyou Xie <baoyou.xie@linaro.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-clk at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
---
drivers/clk/zte/clk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/zte/clk.c b/drivers/clk/zte/clk.c
index df91842..6afdc4a 100644
--- a/drivers/clk/zte/clk.c
+++ b/drivers/clk/zte/clk.c
@@ -247,7 +247,7 @@ static unsigned long zx_audio_round_rate(struct clk_hw *hw, unsigned long rate,
u32 reg;
if (rate * 2 > *prate)
- return -EINVAL;
+ return 0;
reg = calc_reg(*prate, rate);
return calc_rate(reg, *prate);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 33/34] clk: lpc32xx: change round_rate() return logic
[not found] <1514835300-381-1-git-send-email-pure.logic@nexus-software.ie>
` (3 preceding siblings ...)
2018-01-01 19:34 ` [PATCH v2 29/34] clk: zte: change zx_audio_round_rate() return logic Bryan O'Donoghue
@ 2018-01-01 19:34 ` Bryan O'Donoghue
4 siblings, 0 replies; 5+ messages in thread
From: Bryan O'Donoghue @ 2018-01-01 19:34 UTC (permalink / raw)
To: linux-arm-kernel
This patch updates the round_rate() logic here to return zero instead of a
negative number on error.
In conjunction with higher-level changes associated with acting on the
return value of clk_ops->round_rate() it is then possible to have
clk_ops->round_rate() return values from 1 Hz to ULONG_MAX Hz instead of
the current limitation of 1 Hz to LONG_MAX Hz.
Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: Sylvain Lemieux <slemieux.tyco@gmail.com>
Cc: Gabriel Fernandez <gabriel.fernandez@st.com>
Cc: linux-clk at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
---
drivers/clk/nxp/clk-lpc32xx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/nxp/clk-lpc32xx.c b/drivers/clk/nxp/clk-lpc32xx.c
index 76c17f4..0e0d258 100644
--- a/drivers/clk/nxp/clk-lpc32xx.c
+++ b/drivers/clk/nxp/clk-lpc32xx.c
@@ -664,17 +664,17 @@ static unsigned long clk_usb_pll_round_rate(struct clk_hw *hw,
* USB divider, USB PLL N and M parameters.
*/
if (rate != 48000000)
- return -EINVAL;
+ return 0;
/* USB divider clock */
usb_div_hw = clk_hw_get_parent_by_index(hw, 0);
if (!usb_div_hw)
- return -EINVAL;
+ return 0;
/* Main oscillator clock */
osc_hw = clk_hw_get_parent_by_index(usb_div_hw, 0);
if (!osc_hw)
- return -EINVAL;
+ return 0;
o = clk_hw_get_rate(osc_hw); /* must be in range 1..20 MHz */
/* Check if valid USB divider and USB PLL parameters exists */
@@ -697,7 +697,7 @@ static unsigned long clk_usb_pll_round_rate(struct clk_hw *hw,
}
}
- return -EINVAL;
+ return 0;
}
#define LPC32XX_DEFINE_PLL_OPS(_name, _rc, _sr, _rr) \
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-01 19:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1514835300-381-1-git-send-email-pure.logic@nexus-software.ie>
2018-01-01 19:34 ` [PATCH v2 20/34] clk: nxp: change lpc18xx_pll0_round_rate() return logic Bryan O'Donoghue
2018-01-01 19:34 ` [PATCH v2 21/34] clk: lpc32xx: change clk_hclk_pll_round_rate() " Bryan O'Donoghue
2018-01-01 19:34 ` [PATCH v2 23/34] clk: sirf: remove unnecessary long cast on return Bryan O'Donoghue
2018-01-01 19:34 ` [PATCH v2 29/34] clk: zte: change zx_audio_round_rate() return logic Bryan O'Donoghue
2018-01-01 19:34 ` [PATCH v2 33/34] clk: lpc32xx: change round_rate() " Bryan O'Donoghue
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).