Author: mmel
Date: Sun Apr 16 08:01:57 2017
New Revision: 317009
URL: https://svnweb.freebsd.org/changeset/base/317009

Log:
  MFC r309537:
  
    Clock framework fixes:
     - The clk_test_freq() (aka CLK_SET_DRYRUN) doesn't change frequency,
       don't cache it result.
     - Fix busy condition for clk_set_freq().

Modified:
  stable/11/sys/dev/extres/clk/clk.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/extres/clk/clk.c
==============================================================================
--- stable/11/sys/dev/extres/clk/clk.c  Sun Apr 16 07:58:41 2017        
(r317008)
+++ stable/11/sys/dev/extres/clk/clk.c  Sun Apr 16 08:01:57 2017        
(r317009)
@@ -830,9 +830,10 @@ clknode_set_freq(struct clknode *clknode
         * OR
         *   clock is glitch free and is enabled by calling consumer only
         */
-       if ((clknode->enable_cnt > 1) &&
-           ((clknode->enable_cnt > enablecnt) ||
-           !(clknode->flags & CLK_NODE_GLITCH_FREE))) {
+       if ((flags & CLK_SET_DRYRUN) == 0 &&
+           clknode->enable_cnt > 1 &&
+           clknode->enable_cnt > enablecnt &&
+           (clknode->flags & CLK_NODE_GLITCH_FREE) == 0) {
                return (EBUSY);
        }
 
@@ -856,9 +857,10 @@ clknode_set_freq(struct clknode *clknode
 
        if (done) {
                /* Success - invalidate frequency cache for all children. */
-               clknode->freq = freq;
-               if ((flags & CLK_SET_DRYRUN) == 0)
+               if ((flags & CLK_SET_DRYRUN) == 0) {
+                       clknode->freq = freq;
                        clknode_refresh_cache(clknode, parent_freq);
+               }
        } else if (clknode->parent != NULL) {
                /* Nothing changed, pass request to parent. */
                rv = clknode_set_freq(clknode->parent, freq, flags, enablecnt);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to