Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Jan 2018 14:47:27 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328198 - head/sys/dev/extres/clk
Message-ID:  <201801201447.w0KElRXA056693@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Sat Jan 20 14:47:27 2018
New Revision: 328198
URL: https://svnweb.freebsd.org/changeset/base/328198

Log:
  clk: Get new parent freq after set_freq
  
  During set_freq a clknode might have reparent (using a better parent that
  have a higher frequency for example), before refreshing the cache, re-get
  the parent frequency.
  
  Reviewed by:	mmel

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

Modified: head/sys/dev/extres/clk/clk.c
==============================================================================
--- head/sys/dev/extres/clk/clk.c	Sat Jan 20 14:05:55 2018	(r328197)
+++ head/sys/dev/extres/clk/clk.c	Sat Jan 20 14:47:27 2018	(r328198)
@@ -916,6 +916,14 @@ clknode_set_freq(struct clknode *clknode, uint64_t fre
 		/* Success - invalidate frequency cache for all children. */
 		if ((flags & CLK_SET_DRYRUN) == 0) {
 			clknode->freq = freq;
+			/* Clock might have reparent during set_freq */
+			if (clknode->parent_cnt > 0) {
+				rv = clknode_get_freq(clknode->parent,
+				    &parent_freq);
+				if (rv != 0) {
+					return (rv);
+				}
+			}
 			clknode_refresh_cache(clknode, parent_freq);
 		}
 	} else if (clknode->parent != NULL) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801201447.w0KElRXA056693>