All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Powertop] [PATCH] conditionally disable pci support on ARM platforms
@ 2012-06-22 18:42 Rajagopal Venkat
  0 siblings, 0 replies; 3+ messages in thread
From: Rajagopal Venkat @ 2012-06-22 18:42 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 2486 bytes --]

Signed-off-by: Rajagopal Venkat <rajagopal.venkat(a)linaro.org>
---
 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 <math.h>
 #include <stdlib.h>
 
+#include "lib.h"
+
+#ifndef HAVE_NO_PCI
 extern "C" {
 #include <pci/pci.h>
 }
-
-#include "lib.h"
+#endif
 
 #include <stdio.h>
 #include <stdint.h>
@@ -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 <stdint.h>
 
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #ifndef DISABLE_I18N
 #define _(STRING)    gettext(STRING)
 #else
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Powertop] [PATCH] conditionally disable pci support on ARM platforms
@ 2012-06-22 20:01 Arjan van de Ven
  0 siblings, 0 replies; 3+ messages in thread
From: Arjan van de Ven @ 2012-06-22 20:01 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

On 6/22/2012 11:42 AM, Rajagopal Venkat wrote:
> +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
> +

I don't like this part.

if libpci is option, it is optional.

being arm or not is completely irrelevant in this regard.
(and there will undoubtedly ARM systems at some point that will have PCI
in them)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Powertop] [PATCH] conditionally disable pci support on ARM platforms
@ 2012-06-25  5:24 Rajagopal Venkat
  0 siblings, 0 replies; 3+ messages in thread
From: Rajagopal Venkat @ 2012-06-25  5:24 UTC (permalink / raw
  To: powertop

[-- Attachment #1: Type: text/plain, Size: 1076 bytes --]

On 23 June 2012 01:31, Arjan van de Ven <arjan(a)linux.intel.com> wrote:

> On 6/22/2012 11:42 AM, Rajagopal Venkat wrote:
> > +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
> > +
>
> I don't like this part.
>
> if libpci is option, it is optional.
>
> Agree. libpci should be optional.

At present build script is enforcing to install libpci which may not be
necessarily true for all platforms. Solution can be something like,

PKG_CHECK_MODULES([PCIUTILS], [libpci],[],[
        AC_SEARCH_LIBS([pci_get_dev], [pci], [],
[AC_DEFINE([HAVE_NO_PCI],[1],[Define if pci is not supported])], [])
        ])


> being arm or not is completely irrelevant in this regard.
> (and there will undoubtedly ARM systems at some point that will have PCI
> in them)
>
>
>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 1572 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-25  5:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-22 20:01 [Powertop] [PATCH] conditionally disable pci support on ARM platforms Arjan van de Ven
  -- strict thread matches above, loose matches on Subject: below --
2012-06-25  5:24 Rajagopal Venkat
2012-06-22 18:42 Rajagopal Venkat

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.