/* * (C) 2003 - 2004 Dominik Brodowski * * Licensed under the terms of the GNU GPL License version 2. * * Based on code found in * linux/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c * and originally developed by Jeremy Fitzhardinge. * * USAGE: simply run it to decode the current settings on CPU 0, * or pass the CPU number as argument, or pass the MSR content * as argument. */ #include #include #include #include #include #include #include #include #define MCPU 32 #define MSR_IA32_PERF_STATUS 0x198 static int rdmsr(unsigned int cpu, unsigned int msr, unsigned int *lo, unsigned int *hi) { int fd; char file[20]; unsigned long long val; int retval = -1; *lo = *hi = 0; if (cpu > MCPU) goto err1; sprintf(file, "/dev/cpu/%d/msr", cpu); fd = open(file, O_RDONLY); if (fd < 0) goto err1; if (lseek(fd, msr, SEEK_CUR) == -1) goto err2; if (read(fd, &val, 8) != 8) goto err2; *lo = (uint32_t )(val & 0xffffffffull); *hi = (uint32_t )(val>>32 & 0xffffffffull); retval = 0; err2: close(fd); err1: return retval; } static void decode (unsigned int msr) { unsigned int multiplier; unsigned int mv; multiplier = ((msr >> 8) & 0xFF); mv = (((msr & 0xFF) * 16) + 700); printf("0x%x means multiplier %d @ %d mV\n", msr, multiplier, mv); } static int decode_live(unsigned int cpu) { unsigned int lo, hi; int err; err = rdmsr(cpu, MSR_IA32_PERF_STATUS, &lo, &hi); if (err) { printf("can't get MSR_IA32_PERF_STATUS for cpu %d\n", cpu); printf("Possible trouble: you don't run an Enhanced SpeedStep capable cpu\n"); printf("or you are not root, or the msr driver is not present\n"); return 1; } decode(lo); return 0; } int main (int argc, char **argv) { unsigned int cpu, mode = 0; if (argc < 2) cpu = 0; else { cpu = strtoul(argv[1], NULL, 0); if (cpu >= MCPU) mode = 1; } if (mode) decode(cpu); else decode_live(cpu); return 0; } t/drivers/usb/atm/usbatm.c?h=nds-private-remove&id=30103b5b6432a51c3822a26dc340e35d91237f39'>commitdiff
diff options
context:
space:
mode:
authorDavid Lechner <david@lechnology.com>2016-12-04 16:52:31 -0600
committerMark Brown <broonie@kernel.org>2016-12-05 11:38:30 +0000
commit30103b5b6432a51c3822a26dc340e35d91237f39 (patch)
tree0806755f1615c0bc8598558b4a845ab1cf9c8291 /drivers/usb/atm/usbatm.c
parent1b5b42216469b05ef4b5916cb40b127dfab1da88 (diff)
regulator: Fix regulator_get_error_flags() signature mismatch
The function signature of does not match regulator_get_error_flags() when CONFIG_REGULATOR is not defined vs. when it is not defined. This makes both declarations match to prevent compiler errors. Signed-off-by: David Lechner <david@lechnology.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/usb/atm/usbatm.c')