From patchwork Fri Jul 15 06:35:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Daniel Kachhap X-Patchwork-Id: 2706 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 851E523F55 for ; Fri, 15 Jul 2011 06:36:16 +0000 (UTC) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.216.173]) by fiordland.canonical.com (Postfix) with ESMTP id 3BE63A1834C for ; Fri, 15 Jul 2011 06:36:16 +0000 (UTC) Received: by qyk10 with SMTP id 10so295967qyk.11 for ; Thu, 14 Jul 2011 23:36:15 -0700 (PDT) Received: by 10.229.68.200 with SMTP id w8mr2567233qci.114.1310711775685; Thu, 14 Jul 2011 23:36:15 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs38387qcb; Thu, 14 Jul 2011 23:36:15 -0700 (PDT) Received: by 10.204.138.205 with SMTP id b13mr1161973bku.27.1310711774711; Thu, 14 Jul 2011 23:36:14 -0700 (PDT) Received: from mail-fx0-f44.google.com (mail-fx0-f44.google.com [209.85.161.44]) by mx.google.com with ESMTPS id a10si1270915fak.66.2011.07.14.23.36.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Jul 2011 23:36:13 -0700 (PDT) Received-SPF: pass (google.com: domain of amitdanielk@gmail.com designates 209.85.161.44 as permitted sender) client-ip=209.85.161.44; Authentication-Results: mx.google.com; spf=pass (google.com: domain of amitdanielk@gmail.com designates 209.85.161.44 as permitted sender) smtp.mail=amitdanielk@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by mail-fx0-f44.google.com with SMTP id 6so1724844fxe.17 for ; Thu, 14 Jul 2011 23:36:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=7Gze8JCCzZMkDNL9LxsbVLvy9Yfki0/yowyxX06qiUQ=; b=qR4j5CVKEhoBBBXJ5dch8lHgidczqifty4W8GuXrMdBD8QEPDj6HiXjMTzzjuNC6MG Dz1REz9JcTVQQkV1uqJWC1kVxgBRVjHGI+8V3lgU0mGQhfQHE3jMp3xRSfZq9snnfwXJ 6QAyQyPbO9SZmxm7HRXRgmk+qaCf9fufplNMk= Received: by 10.223.91.75 with SMTP id l11mr4789911fam.66.1310711772965; Thu, 14 Jul 2011 23:36:12 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id e10sm582327fak.18.2011.07.14.23.36.05 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Jul 2011 23:36:11 -0700 (PDT) Sender: amit kachhap From: Amit Daniel Kachhap To: arjan@linux.intel.com, kristen@linux.intel.com, power@bughost.org Cc: linaro-dev@lists.linaro.org, amit.kachhap@linaro.org, patches@linaro.org Subject: [PATCH 1/3] powertop: Disable pci bus measurement for arm platforms Date: Fri, 15 Jul 2011 12:05:46 +0530 Message-Id: <1310711748-23531-2-git-send-email-amit.kachhap@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1310711748-23531-1-git-send-email-amit.kachhap@linaro.org> References: <1310711748-23531-1-git-send-email-amit.kachhap@linaro.org> This patch disables pci related measurement which is not needed for ARM platforms and also library libpci is not needed. Signed-off-by: Amit Daniel Kachhap --- Android.mk | 7 ++++++- devices/runtime_pm.cpp | 3 ++- lib.cpp | 7 ++++--- main.cpp | 6 ++++++ tuning/runtime.cpp | 2 ++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Android.mk b/Android.mk index 146f57a..6948011 100644 --- a/Android.mk +++ b/Android.mk @@ -4,7 +4,6 @@ include $(CLEAR_VARS) LOCAL_MODULE_TAGS := debug LOCAL_SHARED_LIBRARIES := libstlport \ libnl \ - libpci \ LOCAL_MODULE := powertop @@ -14,6 +13,12 @@ LOCAL_CPPFLAGS += -DDISABLE_NCURSES -DDISABLE_I18N -DDISABLE_TRYCATCH LOCAL_C_INCLUDES += external/stlport/stlport/ external/stlport/stlport/stl external/stlport/stlport/using/h/ bionic external/libnl/include/ +ifneq ($(TARGET_ARCH),arm) +LOCAL_SHARED_LIBRARIES += libpci +else #TARGET_ARCH != arm +LOCAL_CPPFLAGS += -DDISABLE_PCI +endif #TARGET_ARCH == arm + LOCAL_SRC_FILES += \ parameters/parameters.cpp \ parameters/persistent.cpp \ diff --git a/devices/runtime_pm.cpp b/devices/runtime_pm.cpp index 368d995..5a55426 100644 --- a/devices/runtime_pm.cpp +++ b/devices/runtime_pm.cpp @@ -200,7 +200,7 @@ static void do_bus(const char *bus) continue; dev = new class runtime_pmdevice(entry->d_name, filename); - +#ifndef DISABLE_PCI if (strcmp(bus, "pci") == 0) { uint16_t vendor = 0, device = 0; @@ -226,6 +226,7 @@ static void do_bus(const char *bus) dev->set_human_name(devname); } } +#endif//DISABLE_PCI all_devices.push_back(dev); } closedir(dir); diff --git a/lib.cpp b/lib.cpp index e6684b0..d058e4f 100644 --- a/lib.cpp +++ b/lib.cpp @@ -35,10 +35,11 @@ #include #include #include - +#ifndef DISABLE_PCI extern "C" { #include } +#endif #include "lib.h" @@ -243,7 +244,7 @@ void format_watts(double W, char *buffer, unsigned int len) #endif } - +#ifndef DISABLE_PCI static struct pci_access *pci_access; char *pci_id_to_name(uint16_t vendor, uint16_t device, char *buffer, int len) @@ -267,7 +268,7 @@ void end_pci_access(void) if (pci_access) pci_free_name_list(pci_access); } - +#endif //DISABLE_PCI int utf_ok = -1; diff --git a/main.cpp b/main.cpp index 4241d44..3ee0a7e 100644 --- a/main.cpp +++ b/main.cpp @@ -261,7 +261,9 @@ void html_report(int time, bool file) learn_parameters(50, 0); save_all_results("saved_results.powertop"); save_parameters("saved_parameters.powertop"); +#ifndef DISABLE_PCI end_pci_access(); +#endif exit(0); } @@ -370,7 +372,9 @@ int main(int argc, char **argv) if (debug_learning) { learn_parameters(1000, 1); dump_parameter_bundle(); +#ifndef DISABLE_PCI end_pci_access(); +#endif exit(0); } @@ -404,7 +408,9 @@ int main(int argc, char **argv) save_parameters("saved_parameters.powertop"); learn_parameters(500, 0); save_parameters("saved_parameters.powertop"); +#ifndef DISABLE_PCI end_pci_access(); +#endif reset_display(); return 0; diff --git a/tuning/runtime.cpp b/tuning/runtime.cpp index 03cfa0b..a543b41 100644 --- a/tuning/runtime.cpp +++ b/tuning/runtime.cpp @@ -48,6 +48,7 @@ runtime_tunable::runtime_tunable(const char *path, const char *bus, const char * if (!device_has_runtime_pm(path)) sprintf(desc, _("%s device %s has no runtime power management"), bus, dev); +#ifndef DISABLE_PCI if (strcmp(bus, "pci") == 0) { char filename[4096]; uint16_t vendor = 0, device = 0; @@ -77,6 +78,7 @@ runtime_tunable::runtime_tunable(const char *path, const char *bus, const char * } +#endif//DISABLE_PCI } int runtime_tunable::good_bad(void)