Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jun 2020 19:33:19 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r362417 - stable/12/sys/dev/cpufreq
Message-ID:  <202006191933.05JJXJkj006796@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Fri Jun 19 19:33:19 2020
New Revision: 362417
URL: https://svnweb.freebsd.org/changeset/base/362417

Log:
  MFC r361964:
  
  coufreq_dt: Rename DEBUG to DPRINTF
  
  DEBUG is a kernel configuration flag and if used cpufreq_dt.c will fail the
  build of kernel.
  
  PR:		246867
  Submitted by:	Oskar Holmund (oskar.holmlund@ohdata.se)
  Differential Revision:	https://reviews.freebsd.org/D25080

Modified:
  stable/12/sys/dev/cpufreq/cpufreq_dt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/cpufreq/cpufreq_dt.c
==============================================================================
--- stable/12/sys/dev/cpufreq/cpufreq_dt.c	Fri Jun 19 19:33:06 2020	(r362416)
+++ stable/12/sys/dev/cpufreq/cpufreq_dt.c	Fri Jun 19 19:33:19 2020	(r362417)
@@ -53,9 +53,9 @@ __FBSDID("$FreeBSD$");
 #include "cpufreq_if.h"
 
 #if 0
-#define DEBUG(dev, msg...) device_printf(dev, "cpufreq_dt: " msg);
+#define DPRINTF(dev, msg...) device_printf(dev, "cpufreq_dt: " msg);
 #else
-#define DEBUG(dev, msg...)
+#define DPRINTF(dev, msg...)
 #endif
 
 enum opp_version {
@@ -111,12 +111,12 @@ cpufreq_dt_find_opp(device_t dev, uint64_t freq)
 
 	sc = device_get_softc(dev);
 
-	DEBUG(dev, "Looking for freq %ju\n", freq);
+	DPRINTF(dev, "Looking for freq %ju\n", freq);
 	for (n = 0; n < sc->nopp; n++)
 		if (CPUFREQ_CMP(sc->opp[n].freq, freq))
 			return (&sc->opp[n]);
 
-	DEBUG(dev, "Couldn't find one\n");
+	DPRINTF(dev, "Couldn't find one\n");
 	return (NULL);
 }
 
@@ -145,7 +145,7 @@ cpufreq_dt_get(device_t dev, struct cf_setting *set)
 
 	sc = device_get_softc(dev);
 
-	DEBUG(dev, "cpufreq_dt_get\n");
+	DPRINTF(dev, "cpufreq_dt_get\n");
 	if (clk_get_freq(sc->clk, &freq) != 0)
 		return (ENXIO);
 
@@ -157,7 +157,7 @@ cpufreq_dt_get(device_t dev, struct cf_setting *set)
 
 	cpufreq_dt_opp_to_setting(dev, opp, set);
 
-	DEBUG(dev, "Current freq %dMhz\n", set->freq);
+	DPRINTF(dev, "Current freq %dMhz\n", set->freq);
 	return (0);
 }
 
@@ -171,10 +171,10 @@ cpufreq_dt_set(device_t dev, const struct cf_setting *
 
 	sc = device_get_softc(dev);
 
-	DEBUG(dev, "Working on cpu %d\n", sc->cpu);
-	DEBUG(dev, "We have %d cpu on this dev\n", CPU_COUNT(&sc->cpus));
+	DPRINTF(dev, "Working on cpu %d\n", sc->cpu);
+	DPRINTF(dev, "We have %d cpu on this dev\n", CPU_COUNT(&sc->cpus));
 	if (!CPU_ISSET(sc->cpu, &sc->cpus)) {
-		DEBUG(dev, "Not for this CPU\n");
+		DPRINTF(dev, "Not for this CPU\n");
 		return (0);
 	}
 
@@ -206,26 +206,26 @@ cpufreq_dt_set(device_t dev, const struct cf_setting *
 		device_printf(dev, "Couldn't find an opp for this freq\n");
 		return (EINVAL);
 	}
-	DEBUG(sc->dev, "Current freq %ju, uvolt: %d\n", freq, uvolt);
-	DEBUG(sc->dev, "Target freq %ju, , uvolt: %d\n",
+	DPRINTF(sc->dev, "Current freq %ju, uvolt: %d\n", freq, uvolt);
+	DPRINTF(sc->dev, "Target freq %ju, , uvolt: %d\n",
 	    opp->freq, opp->uvolt_target);
 
 	if (uvolt < opp->uvolt_target) {
-		DEBUG(dev, "Changing regulator from %u to %u\n",
+		DPRINTF(dev, "Changing regulator from %u to %u\n",
 		    uvolt, opp->uvolt_target);
 		error = regulator_set_voltage(sc->reg,
 		    opp->uvolt_min,
 		    opp->uvolt_max);
 		if (error != 0) {
-			DEBUG(dev, "Failed, backout\n");
+			DPRINTF(dev, "Failed, backout\n");
 			return (ENXIO);
 		}
 	}
 
-	DEBUG(dev, "Setting clk to %ju\n", opp->freq);
+	DPRINTF(dev, "Setting clk to %ju\n", opp->freq);
 	error = clk_set_freq(sc->clk, opp->freq, CLK_SET_ROUND_DOWN);
 	if (error != 0) {
-		DEBUG(dev, "Failed, backout\n");
+		DPRINTF(dev, "Failed, backout\n");
 		/* Restore previous voltage (best effort) */
 		error = regulator_set_voltage(sc->reg,
 		    copp->uvolt_min,
@@ -234,13 +234,13 @@ cpufreq_dt_set(device_t dev, const struct cf_setting *
 	}
 
 	if (uvolt > opp->uvolt_target) {
-		DEBUG(dev, "Changing regulator from %u to %u\n",
+		DPRINTF(dev, "Changing regulator from %u to %u\n",
 		    uvolt, opp->uvolt_target);
 		error = regulator_set_voltage(sc->reg,
 		    opp->uvolt_min,
 		    opp->uvolt_max);
 		if (error != 0) {
-			DEBUG(dev, "Failed to switch regulator to %d\n",
+			DPRINTF(dev, "Failed to switch regulator to %d\n",
 			    opp->uvolt_target);
 			/* Restore previous CPU frequency (best effort) */
 			(void)clk_set_freq(sc->clk, copp->freq, 0);
@@ -271,7 +271,7 @@ cpufreq_dt_settings(device_t dev, struct cf_setting *s
 	struct cpufreq_dt_softc *sc;
 	ssize_t n;
 
-	DEBUG(dev, "cpufreq_dt_settings\n");
+	DPRINTF(dev, "cpufreq_dt_settings\n");
 	if (sets == NULL || count == NULL)
 		return (EINVAL);
 
@@ -465,7 +465,7 @@ cpufreq_dt_attach(device_t dev)
 	node = ofw_bus_get_node(device_get_parent(dev));
 	sc->cpu = device_get_unit(device_get_parent(dev));
 
-	DEBUG(dev, "cpu=%d\n", sc->cpu);
+	DPRINTF(dev, "cpu=%d\n", sc->cpu);
 	if (sc->cpu >= mp_ncpus) {
 		device_printf(dev, "Not attaching as cpu is not present\n");
 		return (ENXIO);
@@ -519,12 +519,12 @@ cpufreq_dt_attach(device_t dev)
 		if (strcmp(device_type, "cpu") != 0)
 			continue;
 		if (cpu == sc->cpu) {
-			DEBUG(dev, "Skipping our cpu\n");
+			DPRINTF(dev, "Skipping our cpu\n");
 			CPU_SET(cpu, &sc->cpus);
 			cpu++;
 			continue;
 		}
-		DEBUG(dev, "Testing CPU %d\n", cpu);
+		DPRINTF(dev, "Testing CPU %d\n", cpu);
 		copp = -1;
 		if (version == OPP_V1)
 			OF_getencprop(cnode, "operating-points", &copp,
@@ -533,7 +533,8 @@ cpufreq_dt_attach(device_t dev)
 			OF_getencprop(cnode, "operating-points-v2",
 			    &copp, sizeof(copp));
 		if (opp == copp) {
-			DEBUG(dev, "CPU %d is using the same opp as this one (%d)\n", cpu, sc->cpu);
+			DPRINTF(dev, "CPU %d is using the same opp as this one (%d)\n",
+			    cpu, sc->cpu);
 			CPU_SET(cpu, &sc->cpus);
 		}
 		cpu++;



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