Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/clk If setting rate on a clock with no set_rate func...



details:   https://anonhg.NetBSD.org/src/rev/3641c81ae0b4
branches:  trunk
changeset: 323370:3641c81ae0b4
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Jun 12 23:08:37 2018 +0000

description:
If setting rate on a clock with no set_rate function, and the desired rate
matches the current rate, don't return an error.

diffstat:

 sys/dev/clk/clk.c |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (41 lines):

diff -r ee093c930872 -r 3641c81ae0b4 sys/dev/clk/clk.c
--- a/sys/dev/clk/clk.c Tue Jun 12 21:36:34 2018 +0000
+++ b/sys/dev/clk/clk.c Tue Jun 12 23:08:37 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clk.c,v 1.4 2018/04/28 15:20:33 jmcneill Exp $ */
+/* $NetBSD: clk.c,v 1.5 2018/06/12 23:08:37 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clk.c,v 1.4 2018/04/28 15:20:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clk.c,v 1.5 2018/06/12 23:08:37 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
@@ -208,14 +208,17 @@
 int
 clk_set_rate(struct clk *clk, u_int rate)
 {
-       if (clk->flags & CLK_SET_RATE_PARENT) {
+       if (clk->flags & CLK_SET_RATE_PARENT)
                return clk_set_rate(clk_get_parent(clk), rate);
-       } else if (clk->domain->funcs->set_rate) {
+
+       if (clk->domain->funcs->set_rate)
                return clk->domain->funcs->set_rate(clk->domain->priv,
                    clk, rate);
-       } else {
-               return EINVAL;
-       }
+
+       if (clk_get_rate(clk) == rate)
+               return 0;
+
+       return EINVAL;
 }
 
 u_int



Home | Main Index | Thread Index | Old Index