From: Amit Sunil Dhamne <amit.sunil.dhamne@xilinx.com> To: mturquette@baylibre.com, sboyd@kernel.org, michal.simek@xilinx.com, mark.rutland@arm.com, linux-clk@vger.kernel.org Cc: rajanv@xilinx.com, jollys@xilinx.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rajan Vaja <rajan.vaja@xilinx.com>, Jolly Shah <jolly.shah@xilinx.com>, Amit Sunil Dhamne <amit.sunil.dhamne@xilinx.com> Subject: [RESEND PATCH v2 1/4] drivers: clk: zynqmp: Limit bestdiv with maxdiv Date: Fri, 1 May 2020 21:37:00 -0700 [thread overview] Message-ID: <1588394223-257635-2-git-send-email-amit.sunil.dhamne@xilinx.com> (raw) In-Reply-To: <1588394223-257635-1-git-send-email-amit.sunil.dhamne@xilinx.com> From: Rajan Vaja <rajan.vaja@xilinx.com> Clock divider value should not be greater than maximum divider value. So use minimum of best divider or maximum divider value. Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> Signed-off-by: Jolly Shah <jolly.shah@xilinx.com> Signed-off-by: Amit Sunil Dhamne <amit.sunil.dhamne@xilinx.com> --- drivers/clk/zynqmp/divider.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c index 4be2cc7..5c41ddb 100644 --- a/drivers/clk/zynqmp/divider.c +++ b/drivers/clk/zynqmp/divider.c @@ -197,6 +197,8 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw *hw, if ((clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) && divider->is_frac) bestdiv = rate % *prate ? 1 : bestdiv; + + bestdiv = min_t(u32, bestdiv, divider->max_div); *prate = rate * bestdiv; return rate; -- 2.7.4 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
WARNING: multiple messages have this Message-ID (diff)
From: Amit Sunil Dhamne <amit.sunil.dhamne@xilinx.com> To: mturquette@baylibre.com, sboyd@kernel.org, michal.simek@xilinx.com, mark.rutland@arm.com, linux-clk@vger.kernel.org Cc: Amit Sunil Dhamne <amit.sunil.dhamne@xilinx.com>, Rajan Vaja <rajan.vaja@xilinx.com>, linux-kernel@vger.kernel.org, jollys@xilinx.com, rajanv@xilinx.com, Jolly Shah <jolly.shah@xilinx.com>, linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH v2 1/4] drivers: clk: zynqmp: Limit bestdiv with maxdiv Date: Fri, 1 May 2020 21:37:00 -0700 [thread overview] Message-ID: <1588394223-257635-2-git-send-email-amit.sunil.dhamne@xilinx.com> (raw) In-Reply-To: <1588394223-257635-1-git-send-email-amit.sunil.dhamne@xilinx.com> From: Rajan Vaja <rajan.vaja@xilinx.com> Clock divider value should not be greater than maximum divider value. So use minimum of best divider or maximum divider value. Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> Signed-off-by: Jolly Shah <jolly.shah@xilinx.com> Signed-off-by: Amit Sunil Dhamne <amit.sunil.dhamne@xilinx.com> --- drivers/clk/zynqmp/divider.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c index 4be2cc7..5c41ddb 100644 --- a/drivers/clk/zynqmp/divider.c +++ b/drivers/clk/zynqmp/divider.c @@ -197,6 +197,8 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw *hw, if ((clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) && divider->is_frac) bestdiv = rate % *prate ? 1 : bestdiv; + + bestdiv = min_t(u32, bestdiv, divider->max_div); *prate = rate * bestdiv; return rate; -- 2.7.4 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-05-02 4:37 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-02 4:36 [RESEND PATCH v2 0/4] drivers: clk: zynqmp: minor bux fixes for zynqmp clock driver Amit Sunil Dhamne 2020-05-02 4:36 ` Amit Sunil Dhamne 2020-05-02 4:37 ` Amit Sunil Dhamne [this message] 2020-05-02 4:37 ` [RESEND PATCH v2 1/4] drivers: clk: zynqmp: Limit bestdiv with maxdiv Amit Sunil Dhamne 2020-05-02 4:37 ` [RESEND PATCH v2 2/4] drivers: clk: zynqmp: Fix divider2 calculation Amit Sunil Dhamne 2020-05-02 4:37 ` Amit Sunil Dhamne 2020-05-02 4:37 ` [RESEND PATCH v2 3/4] drivers: clk: zynqmp: Fix invalid clock name queries Amit Sunil Dhamne 2020-05-02 4:37 ` Amit Sunil Dhamne 2020-05-02 4:37 ` [RESEND PATCH v2 4/4] drivers: clk: zynqmp: fix memory leak in zynqmp_register_clocks Amit Sunil Dhamne 2020-05-02 4:37 ` Amit Sunil Dhamne
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1588394223-257635-2-git-send-email-amit.sunil.dhamne@xilinx.com \ --to=amit.sunil.dhamne@xilinx.com \ --cc=jolly.shah@xilinx.com \ --cc=jollys@xilinx.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-clk@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=michal.simek@xilinx.com \ --cc=mturquette@baylibre.com \ --cc=rajan.vaja@xilinx.com \ --cc=rajanv@xilinx.com \ --cc=sboyd@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.