Hi! On 12/08/2014 02:42 PM, Cyril Hrubis wrote: > On Thu, Dec 04, 2014 at 08:20:57PM +0300, Alexey Kodanev wrote: >> Signed-off-by: Alexey Kodanev <alexey.koda...@oracle.com> >> --- >> .../kernel/device-drivers/cpufreq/cpufreq_boost.c | 67 >> +++++++++++--------- >> 1 files changed, 37 insertions(+), 30 deletions(-) >> >> diff --git a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c >> b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c >> index 423188e..941e4db 100644 >> --- a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c >> +++ b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c >> @@ -1,5 +1,5 @@ >> /* >> - * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. >> + * Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved. > This should rather be "Copyright (c) 2013-2014 ..."
OK > >> * This program is free software; you can redistribute it and/or >> * modify it under the terms of the GNU General Public License as >> @@ -37,22 +37,33 @@ >> #include "safe_macros.h" >> #include "safe_stdio.h" >> >> -char *TCID = "ltp_acpi_cpufreq"; >> +char *TCID = "cpufreq_boost"; >> >> #define SYSFS_CPU_DIR "/sys/devices/system/cpu/" >> >> -const char boost[] = SYSFS_CPU_DIR "cpufreq/boost"; >> +struct cpufreq_driver_info { >> + char *name; >> + int off; >> + char *on_str; >> + char *off_str; >> + char *file; >> +}; >> +static const struct cpufreq_driver_info cdrv[] = { >> + { "acpi_cpufreq", 0, "1", "0", SYSFS_CPU_DIR "cpufreq/boost" }, >> + { "intel_pstate", 1, "0", "1", SYSFS_CPU_DIR "intel_pstate/no_turbo" }, >> +}; >> +static int id = -1; >> + >> static int boost_value; >> >> const char governor[] = SYSFS_CPU_DIR "cpu0/cpufreq/scaling_governor"; >> static char governor_name[16]; >> >> -const char setspeed[] = SYSFS_CPU_DIR "cpu0/cpufreq/scaling_setspeed"; >> const char maxspeed[] = SYSFS_CPU_DIR "cpu0/cpufreq/scaling_max_freq"; >> >> static void cleanup(void) >> { >> - SAFE_FILE_PRINTF(NULL, boost, "%d", boost_value); >> + SAFE_FILE_PRINTF(NULL, cdrv[id].file, "%d", boost_value); >> >> if (governor[0] != '\0') >> SAFE_FILE_PRINTF(NULL, governor, "%s", governor_name); >> @@ -63,22 +74,32 @@ static void cleanup(void) >> static void setup(void) >> { >> int fd; >> + unsigned int i; >> tst_require_root(NULL); >> >> - fd = open(boost, O_RDWR); >> - if (fd == -1) { >> - tst_brkm(TCONF, NULL, >> - "acpi-cpufreq not loaded or overclock not supported"); >> + for (i = 0; i < ARRAY_SIZE(cdrv); ++i) { >> + fd = open(cdrv[i].file, O_RDWR); >> + if (fd == -1) >> + continue; >> + >> + id = i; >> + close(fd); > Will simple access() suffice here or do we have to actually open the > file? We have to open it, it was changed from access to open in this commit: commit 0a91955ab91bf518ff56a44bb2969b0cb549a979 Date: Wed May 7 17:03:33 2014 +0400 device-drivers/acpi/ltp_acpi_cpufreq: fix checking for write permission If access(some_file, W_OK) is executed by root it will return success even if file has read-only permission. Use 'open' to test sysfs file for write permission. Doc updated as well: commit fb3da0a1f3a4f1b836e50033cb8acf7c6d0c5a05 Date: Tue May 13 15:34:32 2014 +0400 docs: add a paragraph about access() to Common Problems section Best regards, Alexey > > Otherwise it looks Ok. > ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list