svn commit: r309537 - head/sys/dev/extres/clk

Michal Meloun mmel at FreeBSD.org
Sun Dec 4 16:03:01 UTC 2016


Author: mmel
Date: Sun Dec  4 16:02:59 2016
New Revision: 309537
URL: https://svnweb.freebsd.org/changeset/base/309537

Log:
  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().
  
  MFC after: 3 weeks

Modified:
  head/sys/dev/extres/clk/clk.c

Modified: head/sys/dev/extres/clk/clk.c
==============================================================================
--- head/sys/dev/extres/clk/clk.c	Sun Dec  4 16:00:25 2016	(r309536)
+++ head/sys/dev/extres/clk/clk.c	Sun Dec  4 16:02:59 2016	(r309537)
@@ -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);


More information about the svn-src-head mailing list