From patchwork Tue Jan 21 09:47:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanjay Singh Rawat X-Patchwork-Id: 23429 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE71E218C5 for ; Tue, 21 Jan 2014 09:47:49 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wp4sf13185417obc.1 for ; Tue, 21 Jan 2014 01:47:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=IdJlslImaEsROQSGn0vH3xj5N8QNqKgSGsg1UrWfnh8=; b=abxPjjnQgu0ZHKYThO1VEDxqSSpNlJdSytBjnE6T1AvmYZ1zkWEXiIeqxB7UB7UlnJ ZgTI9+YkiAmzXK7AHf4ochiCMbITd5vD8MIsgCgoLFo2q38+MxxYZlNO5etyOmJzEIZB PKjKiIDyniryJ+VyFFCaI3EbQSswACPQf6GF2pUqK7YKM3wSSCClIbzZO1a+xDB3UTCt Q6k0DOoWQX44vPP/sYOPR5DPmmZsY9CcM7dzKL/szYkQ/IuE4ahkpZNERyZspO+uwSwZ U6d2BFR4yn3dPU6qvQ/b9mINJdXLrMZTnYrqMcMXQg7hmouTW8+8asyeCjALczfhCf5b x3yg== X-Gm-Message-State: ALoCoQneTE5QMMYzZUoxReVf037ZycMefz/t+YyYV84GE6bizG94rHa9/+jpHxkpz0dnNlK5Wlie X-Received: by 10.43.78.135 with SMTP id zm7mr4085005icb.27.1390297669066; Tue, 21 Jan 2014 01:47:49 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.119.231 with SMTP id kx7ls1008023qeb.29.gmail; Tue, 21 Jan 2014 01:47:48 -0800 (PST) X-Received: by 10.58.229.164 with SMTP id sr4mr12604742vec.18.1390297668960; Tue, 21 Jan 2014 01:47:48 -0800 (PST) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id x5si1688768veb.73.2014.01.21.01.47.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Jan 2014 01:47:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id id10so3349047vcb.41 for ; Tue, 21 Jan 2014 01:47:48 -0800 (PST) X-Received: by 10.221.34.211 with SMTP id st19mr13772435vcb.5.1390297668887; Tue, 21 Jan 2014 01:47:48 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp106580vcz; Tue, 21 Jan 2014 01:47:48 -0800 (PST) X-Received: by 10.66.191.42 with SMTP id gv10mr13307970pac.125.1390297667999; Tue, 21 Jan 2014 01:47:47 -0800 (PST) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by mx.google.com with ESMTPS id db2si4699457pbb.157.2014.01.21.01.47.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Jan 2014 01:47:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.172 is neither permitted nor denied by best guess record for domain of sanjay.rawat@linaro.org) client-ip=209.85.192.172; Received: by mail-pd0-f172.google.com with SMTP id p10so3713691pdj.3 for ; Tue, 21 Jan 2014 01:47:47 -0800 (PST) X-Received: by 10.68.204.4 with SMTP id ku4mr23848608pbc.66.1390297667620; Tue, 21 Jan 2014 01:47:47 -0800 (PST) Received: from srawat-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id z10sm22442184pas.6.2014.01.21.01.47.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Jan 2014 01:47:46 -0800 (PST) From: Sanjay Singh Rawat To: private-pmwg@linaro.org Cc: Sanjay Singh Rawat Subject: [PATCH] cpufreq: test feature is enabled before running Date: Tue, 21 Jan 2014 15:17:09 +0530 Message-Id: <1390297629-12374-1-git-send-email-sanjay.rawat@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sanjay.rawat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Signed-off-by: Sanjay Singh Rawat --- cpufreq/cpufreq_01.sh | 6 ++++++ cpufreq/cpufreq_02.sh | 6 ++++++ cpufreq/cpufreq_03.sh | 6 ++++++ cpufreq/cpufreq_04.sh | 6 ++++++ cpufreq/cpufreq_05.sh | 6 ++++++ cpufreq/cpufreq_06.sh | 6 ++++++ cpufreq/cpufreq_07.sh | 6 ++++++ cpufreq/cpufreq_08.sh | 6 ++++++ cpufreq/cpufreq_09.sh | 6 ++++++ include/functions.sh | 4 ++++ 10 files changed, 58 insertions(+) diff --git a/cpufreq/cpufreq_01.sh b/cpufreq/cpufreq_01.sh index 6f092fe..00dff64 100755 --- a/cpufreq/cpufreq_01.sh +++ b/cpufreq/cpufreq_01.sh @@ -27,6 +27,12 @@ source ../include/functions.sh +cpufreq_enabled +if [ $? -ne 0 ]; then + log_skip "cpufreq not supported" + exit 0 +fi + FILES="scaling_available_frequencies scaling_cur_freq scaling_setspeed" for_each_cpu check_cpufreq_files $FILES diff --git a/cpufreq/cpufreq_02.sh b/cpufreq/cpufreq_02.sh index 34e19b7..82d7244 100755 --- a/cpufreq/cpufreq_02.sh +++ b/cpufreq/cpufreq_02.sh @@ -29,5 +29,11 @@ source ../include/functions.sh FILES="scaling_available_governors scaling_governor" +cpufreq_enabled +if [ $? -ne 0 ]; then + log_skip "cpufreq not supported" + exit 0 +fi + for_each_cpu check_cpufreq_files $FILES test_status_show diff --git a/cpufreq/cpufreq_03.sh b/cpufreq/cpufreq_03.sh index 0c59ce8..85118d7 100755 --- a/cpufreq/cpufreq_03.sh +++ b/cpufreq/cpufreq_03.sh @@ -27,6 +27,12 @@ source ../include/functions.sh +cpufreq_enabled +if [ $? -ne 0 ]; then + log_skip "cpufreq not supported" + exit 0 +fi + check_governor() { local cpu=$1 diff --git a/cpufreq/cpufreq_04.sh b/cpufreq/cpufreq_04.sh index 530366a..4a07315 100755 --- a/cpufreq/cpufreq_04.sh +++ b/cpufreq/cpufreq_04.sh @@ -27,6 +27,12 @@ source ../include/functions.sh +cpufreq_enabled +if [ $? -ne 0 ]; then + log_skip "cpufreq not supported" + exit 0 +fi + check_frequency() { local cpu=$1 diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh index 7830118..3c76bc1 100755 --- a/cpufreq/cpufreq_05.sh +++ b/cpufreq/cpufreq_05.sh @@ -27,6 +27,12 @@ source ../include/functions.sh +cpufreq_enabled +if [ $? -ne 0 ]; then + log_skip "cpufreq not supported" + exit 0 +fi + if [ $(id -u) -ne 0 ]; then log_skip "run as non-root" exit 0 diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh index 25c473e..157b1ef 100755 --- a/cpufreq/cpufreq_06.sh +++ b/cpufreq/cpufreq_06.sh @@ -29,6 +29,12 @@ source ../include/functions.sh CPUCYCLE=../utils/cpucycle +cpufreq_enabled +if [ $? -ne 0 ]; then + log_skip "cpufreq not supported" + exit 0 +fi + compute_freq_ratio() { local cpu=$1 diff --git a/cpufreq/cpufreq_07.sh b/cpufreq/cpufreq_07.sh index abfad7f..10fe909 100755 --- a/cpufreq/cpufreq_07.sh +++ b/cpufreq/cpufreq_07.sh @@ -29,6 +29,12 @@ source ../include/functions.sh CPUBURN=../utils/cpuburn +cpufreq_enabled +if [ $? -ne 0 ]; then + log_skip "cpufreq not supported" + exit 0 +fi + check_ondemand() { local cpu=$1 diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh index 79008f0..8ab33b7 100755 --- a/cpufreq/cpufreq_08.sh +++ b/cpufreq/cpufreq_08.sh @@ -29,6 +29,12 @@ source ../include/functions.sh CPUBURN=../utils/cpuburn +cpufreq_enabled +if [ $? -ne 0 ]; then + log_skip "cpufreq not supported" + exit 0 +fi + check_frequency() { local cpu=$1 local freq=$2 diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh index a0c1171..832c303 100755 --- a/cpufreq/cpufreq_09.sh +++ b/cpufreq/cpufreq_09.sh @@ -29,6 +29,12 @@ source ../include/functions.sh CPUBURN=../utils/cpuburn +cpufreq_enabled +if [ $? -ne 0 ]; then + log_skip "cpufreq not supported" + exit 0 +fi + check_powersave() { local cpu=$1 diff --git a/include/functions.sh b/include/functions.sh index 7009fa3..2124ceb 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -344,3 +344,7 @@ restore_frequencies() { sigtrap() { exit 255 } + +cpufreq_enabled() { + test -d /sys/devices/system/cpu/cpufreq +}