All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/thermal: tmon: include pthread and time headers in tmon.h
@ 2020-06-17 23:58 Markus Mayer
  2020-06-18  2:52 ` Florian Fainelli
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Mayer @ 2020-06-17 23:58 UTC (permalink / raw)
  To: Daniel Lezcano, Sumeet Pawnikar, Zhang Rui, Brian Norris
  Cc: Markus Mayer, Broadcom Kernel List, Linux Kernel Mailing List

Include sys/time.h and pthread.h in tmon.h, so that types
"pthread_mutex_t" and "struct timeval tv" are known when tmon.h
references them.

Without these headers, compiling tmon against musl-libc will fail with
these errors:

In file included from sysfs.c:31:0:
tmon.h:47:8: error: unknown type name 'pthread_mutex_t'
 extern pthread_mutex_t input_lock;
        ^~~~~~~~~~~~~~~
make[3]: *** [<builtin>: sysfs.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from tui.c:31:0:
tmon.h:54:17: error: field 'tv' has incomplete type
  struct timeval tv;
                 ^~
make[3]: *** [<builtin>: tui.o] Error 1
make[2]: *** [Makefile:83: tmon] Error 2

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---

The issue was discovered cross-compiling tmon for aarch64 with musl-libc.
The build succeeds with glibc, because the required headers are included
implicitly. This is not the case with musl-libc.

 tools/thermal/tmon/tmon.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/thermal/tmon/tmon.h b/tools/thermal/tmon/tmon.h
index c9066ec104dd..44d16d778f04 100644
--- a/tools/thermal/tmon/tmon.h
+++ b/tools/thermal/tmon/tmon.h
@@ -27,6 +27,9 @@
 #define NR_LINES_TZDATA 1
 #define TMON_LOG_FILE "/var/tmp/tmon.log"
 
+#include <sys/time.h>
+#include <pthread.h>
+
 extern unsigned long ticktime;
 extern double time_elapsed;
 extern unsigned long target_temp_user;
-- 
2.17.1


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

* Re: [PATCH] tools/thermal: tmon: include pthread and time headers in tmon.h
  2020-06-17 23:58 [PATCH] tools/thermal: tmon: include pthread and time headers in tmon.h Markus Mayer
@ 2020-06-18  2:52 ` Florian Fainelli
  2020-06-23 17:17   ` Pawnikar, Sumeet R
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2020-06-18  2:52 UTC (permalink / raw)
  To: Markus Mayer, Daniel Lezcano, Sumeet Pawnikar, Zhang Rui, Brian Norris
  Cc: Broadcom Kernel List, Linux Kernel Mailing List



On 6/17/2020 4:58 PM, Markus Mayer wrote:
> Include sys/time.h and pthread.h in tmon.h, so that types
> "pthread_mutex_t" and "struct timeval tv" are known when tmon.h
> references them.
> 
> Without these headers, compiling tmon against musl-libc will fail with
> these errors:
> 
> In file included from sysfs.c:31:0:
> tmon.h:47:8: error: unknown type name 'pthread_mutex_t'
>  extern pthread_mutex_t input_lock;
>         ^~~~~~~~~~~~~~~
> make[3]: *** [<builtin>: sysfs.o] Error 1
> make[3]: *** Waiting for unfinished jobs....
> In file included from tui.c:31:0:
> tmon.h:54:17: error: field 'tv' has incomplete type
>   struct timeval tv;
>                  ^~
> make[3]: *** [<builtin>: tui.o] Error 1
> make[2]: *** [Makefile:83: tmon] Error 2
> 
> Signed-off-by: Markus Mayer <mmayer@broadcom.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* RE: [PATCH] tools/thermal: tmon: include pthread and time headers in tmon.h
  2020-06-18  2:52 ` Florian Fainelli
@ 2020-06-23 17:17   ` Pawnikar, Sumeet R
  2020-08-09 12:57     ` Alejandro González
  0 siblings, 1 reply; 4+ messages in thread
From: Pawnikar, Sumeet R @ 2020-06-23 17:17 UTC (permalink / raw)
  To: Florian Fainelli, Markus Mayer, Daniel Lezcano, Zhang, Rui, Brian Norris
  Cc: Broadcom Kernel List, Linux Kernel Mailing List

> -----Original Message-----
> From: Florian Fainelli <f.fainelli@gmail.com>
> Sent: Thursday, June 18, 2020 8:23 AM
> To: Markus Mayer <markus.mayer@broadcom.com>; Daniel Lezcano
> <daniel.lezcano@linaro.org>; Pawnikar, Sumeet R
> <sumeet.r.pawnikar@intel.com>; Zhang, Rui <rui.zhang@intel.com>; Brian
> Norris <computersforpeace@gmail.com>
> Cc: Broadcom Kernel List <bcm-kernel-feedback-list@broadcom.com>; Linux
> Kernel Mailing List <linux-kernel@vger.kernel.org>
> Subject: Re: [PATCH] tools/thermal: tmon: include pthread and time headers
> in tmon.h
> 
> 
> 
> On 6/17/2020 4:58 PM, Markus Mayer wrote:
> > Include sys/time.h and pthread.h in tmon.h, so that types
> > "pthread_mutex_t" and "struct timeval tv" are known when tmon.h
> > references them.
> >
> > Without these headers, compiling tmon against musl-libc will fail with
> > these errors:
> >
> > In file included from sysfs.c:31:0:
> > tmon.h:47:8: error: unknown type name 'pthread_mutex_t'
> >  extern pthread_mutex_t input_lock;
> >         ^~~~~~~~~~~~~~~
> > make[3]: *** [<builtin>: sysfs.o] Error 1
> > make[3]: *** Waiting for unfinished jobs....
> > In file included from tui.c:31:0:
> > tmon.h:54:17: error: field 'tv' has incomplete type
> >   struct timeval tv;
> >                  ^~
> > make[3]: *** [<builtin>: tui.o] Error 1
> > make[2]: *** [Makefile:83: tmon] Error 2
> >
> > Signed-off-by: Markus Mayer <mmayer@broadcom.com>
> 
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> --
> Florian

Reviewed-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>

Thanks,
Sumeet.

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

* RE: [PATCH] tools/thermal: tmon: include pthread and time headers in tmon.h
  2020-06-23 17:17   ` Pawnikar, Sumeet R
@ 2020-08-09 12:57     ` Alejandro González
  0 siblings, 0 replies; 4+ messages in thread
From: Alejandro González @ 2020-08-09 12:57 UTC (permalink / raw)
  To: f.fainelli, markus.mayer, daniel.lezcano, rui.zhang, computersforpeace
  Cc: bcm-kernel-feedback-list, linux-kernel, Alejandro González

> > -----Original Message-----
> > From: Florian Fainelli <f.fainelli@gmail.com>
> > Sent: Thursday, June 18, 2020 8:23 AM
> > To: Markus Mayer <markus.mayer@broadcom.com>; Daniel Lezcano
> > <daniel.lezcano@linaro.org>; Pawnikar, Sumeet R
> > <sumeet.r.pawnikar@intel.com>; Zhang, Rui <rui.zhang@intel.com>; Brian
> > Norris <computersforpeace@gmail.com>
> > Cc: Broadcom Kernel List <bcm-kernel-feedback-list@broadcom.com>; Linux
> > Kernel Mailing List <linux-kernel@vger.kernel.org>
> > Subject: Re: [PATCH] tools/thermal: tmon: include pthread and time headers
> > in tmon.h
> > 
> > 
> > 
> > On 6/17/2020 4:58 PM, Markus Mayer wrote:
> > > Include sys/time.h and pthread.h in tmon.h, so that types
> > > "pthread_mutex_t" and "struct timeval tv" are known when tmon.h
> > > references them.
> > >
> > > Without these headers, compiling tmon against musl-libc will fail with
> > > these errors:
> > >
> > > In file included from sysfs.c:31:0:
> > > tmon.h:47:8: error: unknown type name 'pthread_mutex_t'
> > >  extern pthread_mutex_t input_lock;
> > >         ^~~~~~~~~~~~~~~
> > > make[3]: *** [<builtin>: sysfs.o] Error 1
> > > make[3]: *** Waiting for unfinished jobs....
> > > In file included from tui.c:31:0:
> > > tmon.h:54:17: error: field 'tv' has incomplete type
> > >   struct timeval tv;
> > >                  ^~
> > > make[3]: *** [<builtin>: tui.o] Error 1
> > > make[2]: *** [Makefile:83: tmon] Error 2
> > >
> > > Signed-off-by: Markus Mayer <mmayer@broadcom.com>
> > 
> > Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> > --
> > Florian
> 
> Reviewed-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
> 
> Thanks,
> Sumeet.

I've tested this patch with musl-libc for the same arch. It works like a charm.

Acked-by: Alejandro González <alejandro.gonzalez.correo@gmail.com>
Tested-by: Alejandro González <alejandro.gonzalez.correo@gmail.com>

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

end of thread, other threads:[~2020-08-09 12:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 23:58 [PATCH] tools/thermal: tmon: include pthread and time headers in tmon.h Markus Mayer
2020-06-18  2:52 ` Florian Fainelli
2020-06-23 17:17   ` Pawnikar, Sumeet R
2020-08-09 12:57     ` Alejandro González

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.