From patchwork Mon Jun 25 16:00:41 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: 9608 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 50D2923EE3 for ; Mon, 25 Jun 2012 16:01:29 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 15E3FA187E7 for ; Mon, 25 Jun 2012 16:01:28 +0000 (UTC) Received: by ggnf1 with SMTP id f1so3214325ggn.11 for ; Mon, 25 Jun 2012 09:01:28 -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=P8SWsy2r8mMysKpG8EXtyxwGhMhgiPNCLOzpFR9IPR4=; b=pgbdMGbTUThad6tCyu8RQA+634/qilFuSbWf3zgdoTPvPX3dRXiQ331oxCXbuKO9bW JnNSXNaxrCumrlq787VoqbGH3Qtj5x7W4IEqLNiCrvnbA7nYAz72HMMi0Xm68MhOfY8S v1Ohyt5GNRS5GxIVIr//NduNkk+eXYjky/E6+tHCJ6EBQ8rcmg2ZRn+AUG4rgTU27oCq sOF8egq2wZgONd/vWOacKtVP3qPvyTbsJArNd9SnVQv/TM/VP/CPwd3gKoiFP/0Filxc LWsxO4qGC83FcLW95UoliWiOCjXTRKaYGCYotp9Bcl9lGhoU71nNbSf2soNk214Wp1pD KEaw== Received: by 10.50.46.232 with SMTP id y8mr8463419igm.57.1340640088357; Mon, 25 Jun 2012 09:01:28 -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 v20csp52369ibb; Mon, 25 Jun 2012 09:01:27 -0700 (PDT) Received: by 10.50.171.40 with SMTP id ar8mr8590026igc.14.1340640087842; Mon, 25 Jun 2012 09:01:27 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id ud3si8516531igb.4.2012.06.25.09.01.27 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jun 2012 09:01:27 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.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 pbbrr4 with SMTP id rr4so8063226pbb.37 for ; Mon, 25 Jun 2012 09:01:27 -0700 (PDT) Received: by 10.68.227.163 with SMTP id sb3mr42759684pbc.74.1340640082359; Mon, 25 Jun 2012 09:01:22 -0700 (PDT) Received: from localhost.localdomain ([115.242.193.40]) by mx.google.com with ESMTPS id os9sm8878389pbb.62.2012.06.25.09.01.17 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jun 2012 09:01:21 -0700 (PDT) From: Rajagopal Venkat To: powertop@lists.01.org Cc: patches@linaro.org, linaro-dev@lists.linaro.org, Rajagopal Venkat Subject: [Powertop][PATCH v2] conditionally disable pci if not supported Date: Mon, 25 Jun 2012 21:30:41 +0530 Message-Id: <1340640041-27358-1-git-send-email-rajagopal.venkat@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQmCVDZqPQ5HaqYdcoYoAJxHq0BfJdkSPFh7bn4oSmDQOydQ2VjeckCweL7PpX/beZTW91HA Signed-off-by: Rajagopal Venkat --- configure.ac | 5 +++-- src/lib.cpp | 20 ++++++++++++++++++-- src/lib.h | 4 ++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 4da4eea..3cbc7b0 100644 --- a/configure.ac +++ b/configure.ac @@ -48,8 +48,9 @@ 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]), []) -]) + AC_SEARCH_LIBS([pci_get_dev], [pci], [], AC_DEFINE([HAVE_NO_PCI],[1],[Define if pci is not supported]), []) +]) + 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