All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Powertop] [PATCH v3] conditionally disable pci if not supported
@ 2012-07-19 20:12 Chris Ferron
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Ferron @ 2012-07-19 20:12 UTC (permalink / raw)
  To: powertop

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

On 06/25/2012 10:14 AM, Rajagopal Venkat wrote:
> disable pci if not supported by host platform. When
> libpci is not found, define a macro which will be
> used for conditional compilation.
>
> Signed-off-by: Rajagopal Venkat <rajagopal.venkat(a)linaro.org>
> ---
>   configure.ac |    5 +++--
>   src/lib.cpp  |   20 ++++++++++++++++++--
>   src/lib.h    |    5 +++++
>   3 files changed, 26 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 <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..7093b7f 100644
> --- a/src/lib.h
> +++ b/src/lib.h
> @@ -30,6 +30,11 @@
>   #endif
>   #include <stdint.h>
>   
> +/* Include only for Automake builds */
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
>   #ifndef DISABLE_I18N
>   #define _(STRING)    gettext(STRING)
>   #else
Thank you your patch has been merged.


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [Powertop] [PATCH v3] conditionally disable pci if not supported
@ 2012-07-13  6:35 Rajagopal Venkat
  0 siblings, 0 replies; 4+ messages in thread
From: Rajagopal Venkat @ 2012-07-13  6:35 UTC (permalink / raw)
  To: powertop

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

On 13 July 2012 11:03, Ricardo Salveti <ricardo.salveti(a)linaro.org> wrote:

> On Fri, Jul 13, 2012 at 2:02 AM, Rajagopal Venkat
> <rajagopal.venkat(a)linaro.org> wrote:
> > Can someone consider this patch for merge?
>
> As we will have libpci available at most distros by default, isn't
> there a way of doing run-time detection instead of disabling it at
> build time?
>

This patch disables powertop PCI support only when libpci is not
available on a system. Nothing specific to ARM platforms.

I don't think it can be done at run-time. Without this patch if libpci
is not available, powertop compilation itself will fail.


> This is just because we'll be getting more and more ARM boards which
> have PCI-e as well, so we'll need to handle systems with and without
> any PCI available.
>
>
Cheers,
> --
> Ricardo Salveti de Araujo
>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [Powertop] [PATCH v3] conditionally disable pci if not supported
@ 2012-07-13  5:02 Rajagopal Venkat
  0 siblings, 0 replies; 4+ messages in thread
From: Rajagopal Venkat @ 2012-07-13  5:02 UTC (permalink / raw)
  To: powertop

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

Can someone consider this patch for merge?

On 25 June 2012 22:44, Rajagopal Venkat <rajagopal.venkat(a)linaro.org> wrote:

> disable pci if not supported by host platform. When
> libpci is not found, define a macro which will be
> used for conditional compilation.
>
> Signed-off-by: Rajagopal Venkat <rajagopal.venkat(a)linaro.org>
> ---
>  configure.ac |    5 +++--
>  src/lib.cpp  |   20 ++++++++++++++++++--
>  src/lib.h    |    5 +++++
>  3 files changed, 26 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 <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..7093b7f 100644
> --- a/src/lib.h
> +++ b/src/lib.h
> @@ -30,6 +30,11 @@
>  #endif
>  #include <stdint.h>
>
> +/* Include only for Automake builds */
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
>  #ifndef DISABLE_I18N
>  #define _(STRING)    gettext(STRING)
>  #else
> --
> 1.7.9.5
>
>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [Powertop] [PATCH v3] conditionally disable pci if not supported
@ 2012-06-25 17:14 Rajagopal Venkat
  0 siblings, 0 replies; 4+ messages in thread
From: Rajagopal Venkat @ 2012-06-25 17:14 UTC (permalink / raw)
  To: powertop

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

disable pci if not supported by host platform. When
libpci is not found, define a macro which will be
used for conditional compilation.

Signed-off-by: Rajagopal Venkat <rajagopal.venkat(a)linaro.org>
---
 configure.ac |    5 +++--
 src/lib.cpp  |   20 ++++++++++++++++++--
 src/lib.h    |    5 +++++
 3 files changed, 26 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 <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..7093b7f 100644
--- a/src/lib.h
+++ b/src/lib.h
@@ -30,6 +30,11 @@
 #endif
 #include <stdint.h>
 
+/* Include only for Automake builds */
+#ifdef 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] 4+ messages in thread

end of thread, other threads:[~2012-07-19 20:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-19 20:12 [Powertop] [PATCH v3] conditionally disable pci if not supported Chris Ferron
  -- strict thread matches above, loose matches on Subject: below --
2012-07-13  6:35 Rajagopal Venkat
2012-07-13  5:02 Rajagopal Venkat
2012-06-25 17:14 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.