From patchwork Fri Jun 22 18:42:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: rajagopal.venkat@linaro.org X-Patchwork-Id: 9584 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 0F2E723E37 for ; Fri, 22 Jun 2012 18:43:14 +0000 (UTC) Received: from mail-yw0-f50.google.com (mail-yw0-f50.google.com [209.85.213.50]) by fiordland.canonical.com (Postfix) with ESMTP id CC3A0A18D9C for ; Fri, 22 Jun 2012 18:43:13 +0000 (UTC) Received: by yhjj63 with SMTP id j63so2150365yhj.37 for ; Fri, 22 Jun 2012 11:43:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=wVkEg4BS/UML3zBzEBJGmc15khGaYX4cnJeNpdPWCLM=; b=kTWLwbjbJI9mmDOSThBZze7acvDt6ti6iR/I3LUteZD6j3PqnBug+dcQmmfZwR4tiY f1HTJN/ju7kTBoKCao2rAk9CN16CKcQz92Ju3J/zkXlFoikkALXdphFknmiiD1cBRhFL pkI/q3xrDF6rLXNeeeDg/ZInEse65zoKsKHo7ZonTfm9U9nyA43DZZb+7UTtaoxv3YJP mn3kVYfbRE3W65j9GlvP7sYP7Lg4BT7EFl+he7yF+xknMFaWfp9NFrCXwvUbvjnhs7DO SglGnM7TPjLPoYh1vyC0Zh1FDrl4k13S+J6FenNkWtciFvRyyW9V3OkgD6M4K2hc4wJK ZJFg== Received: by 10.50.160.198 with SMTP id xm6mr2786524igb.0.1340390592944; Fri, 22 Jun 2012 11:43:12 -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.231.24.148 with SMTP id v20csp80183ibb; Fri, 22 Jun 2012 11:43:12 -0700 (PDT) Received: by 10.68.244.100 with SMTP id xf4mr11992833pbc.147.1340390592221; Fri, 22 Jun 2012 11:43:12 -0700 (PDT) Received: from mail-pz0-f50.google.com (mail-pz0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id qd2si5440885pbb.87.2012.06.22.11.43.11 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Jun 2012 11:43:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) smtp.mail=rajagopal.venkat@linaro.org Received: by danh15 with SMTP id h15so3210049dan.37 for ; Fri, 22 Jun 2012 11:43:11 -0700 (PDT) Received: by 10.68.217.40 with SMTP id ov8mr12439625pbc.131.1340390591681; Fri, 22 Jun 2012 11:43:11 -0700 (PDT) Received: from localhost.localdomain ([101.63.209.171]) by mx.google.com with ESMTPS id ua6sm39670840pbc.20.2012.06.22.11.43.06 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Jun 2012 11:43:11 -0700 (PDT) From: Rajagopal Venkat To: powertop@lists.01.org Cc: patches@linaro.org, linaro-dev@lists.linaro.org, Rajagopal Venkat Subject: [Powertop][PATCH] conditionally disable pci support on ARM platforms Date: Sat, 23 Jun 2012 00:12:47 +0530 Message-Id: <1340390567-2994-1-git-send-email-rajagopal.venkat@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQmHjIr29C1DCdW1H1XBsVzpiN1oUvO/wbj05061WaCCCEyoz6Xc0UQ3D7cYd6uzT0FPHxiI Signed-off-by: Rajagopal Venkat --- configure.ac | 16 +++++++++++++--- src/lib.cpp | 20 ++++++++++++++++++-- src/lib.h | 4 ++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 4da4eea..c2ff430 100644 --- a/configure.ac +++ b/configure.ac @@ -22,6 +22,8 @@ AC_PROG_LIBTOOL AC_PROG_CC AC_PROG_INSTALL AM_PROG_CC_C_O +AC_CANONICAL_HOST +PKG_PROG_PKG_CONFIG # Checks for libraries. # Checks for header files. @@ -47,9 +49,17 @@ AC_CHECK_FUNCS([fdatasync getpagesize gettimeofday memmove memset mkdir munmap p AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [], AC_MSG_ERROR([ncurses is required but was not found]), []) -PKG_CHECK_MODULES([PCIUTILS], [libpci],[],[ - AC_SEARCH_LIBS([pci_get_dev], [pci], [], AC_MSG_ERROR([libpci is required but was not found]), []) -]) +case "$host" in +arm*) + AC_DEFINE([HAVE_NO_PCI],[1],[Define if host platform is ARM]) + ;; +*) + PKG_CHECK_MODULES([PCIUTILS], [libpci],[],[ + AC_SEARCH_LIBS([pci_get_dev], [pci], [], AC_MSG_ERROR([libpci is required but was not found]), []) + ]) + ;; +esac + PKG_CHECK_MODULES([LIBZ], [zlib],[],[ AC_SEARCH_LIBS([deflate], [z], [], AC_MSG_ERROR([zlib is required but was not found]), []) ]) diff --git a/src/lib.cpp b/src/lib.cpp index 0f87e48..77e49a2 100644 --- a/src/lib.cpp +++ b/src/lib.cpp @@ -35,11 +35,13 @@ #include #include +#include "lib.h" + +#ifndef HAVE_NO_PCI extern "C" { #include } - -#include "lib.h" +#endif #include #include @@ -266,6 +268,7 @@ void format_watts(double W, char *buffer, unsigned int len) } +#ifndef HAVE_NO_PCI static struct pci_access *pci_access; char *pci_id_to_name(uint16_t vendor, uint16_t device, char *buffer, int len) @@ -290,6 +293,19 @@ void end_pci_access(void) pci_free_name_list(pci_access); } +#else + +char *pci_id_to_name(uint16_t vendor, uint16_t device, char *buffer, int len) +{ + return NULL; +} + +void end_pci_access(void) +{ +} + +#endif /* HAVE_NO_PCI */ + int utf_ok = -1; diff --git a/src/lib.h b/src/lib.h index 588c023..d354151 100644 --- a/src/lib.h +++ b/src/lib.h @@ -30,6 +30,10 @@ #endif #include +#if HAVE_CONFIG_H +#include "config.h" +#endif + #ifndef DISABLE_I18N #define _(STRING) gettext(STRING) #else