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)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D25080
This commit is contained in:
Emmanuel Vadot 2020-06-09 09:42:39 +00:00
parent 26161fcfca
commit 4707401c75
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=361964

View File

@ -52,9 +52,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 {
@ -110,12 +110,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);
}
@ -144,7 +144,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);
@ -156,7 +156,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);
}
@ -170,10 +170,10 @@ cpufreq_dt_set(device_t dev, const struct cf_setting *set)
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);
}
@ -205,26 +205,26 @@ cpufreq_dt_set(device_t dev, const struct cf_setting *set)
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,
@ -233,13 +233,13 @@ cpufreq_dt_set(device_t dev, const struct cf_setting *set)
}
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);
@ -270,7 +270,7 @@ cpufreq_dt_settings(device_t dev, struct cf_setting *sets, int *count)
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);
@ -464,7 +464,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);
@ -518,12 +518,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,
@ -532,7 +532,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++;