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 <amit.kach...@linaro.org>
---
 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 <stdbool.h>
 #include <math.h>
 #include <stdlib.h>
-
+#ifndef DISABLE_PCI
 extern "C" {
 #include <pci/pci.h>
 }
+#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)
-- 
1.7.4.1


_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to