diff mbox series

[RESEND] tools/thermal: tmon: include pthread and time headers in tmon.h

Message ID 20220718031040.44714-1-f.fainelli@gmail.com (mailing list archive)
State New, archived
Delegated to: Daniel Lezcano
Headers show
Series [RESEND] tools/thermal: tmon: include pthread and time headers in tmon.h | expand

Commit Message

Florian Fainelli July 18, 2022, 3:10 a.m. UTC
From: Markus Mayer <mmayer@broadcom.com>

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>
Reviewed-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
Acked-by: Alejandro González <alejandro.gonzalez.correo@gmail.com>
Tested-by: Alejandro González <alejandro.gonzalez.correo@gmail.com>
---
This patch was first submitted here:

https://lore.kernel.org/all/20200617235809.6817-1-mmayer@broadcom.com/

but never applied, meanwhile the issue is still present

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

Comments

Florian Fainelli July 19, 2022, 4:11 p.m. UTC | #1
On 7/17/2022 8:10 PM, Florian Fainelli wrote:
> From: Markus Mayer <mmayer@broadcom.com>
> 
> 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>
> Reviewed-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
> Acked-by: Alejandro González <alejandro.gonzalez.correo@gmail.com>
> Tested-by: Alejandro González <alejandro.gonzalez.correo@gmail.com>
> ---
> This patch was first submitted here:
> 
> https://lore.kernel.org/all/20200617235809.6817-1-mmayer@broadcom.com/
> 
> but never applied, meanwhile the issue is still present

Daniel, Rafael, any chance to get that into v5.19-rc7? I should probably 
also have added:

Fixes: 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal 
subsystem")

Thanks!
Daniel Lezcano July 19, 2022, 5:06 p.m. UTC | #2
On 19/07/2022 18:11, Florian Fainelli wrote:
> 
> 
> On 7/17/2022 8:10 PM, Florian Fainelli wrote:
>> From: Markus Mayer <mmayer@broadcom.com>
>>
>> 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>
>> Reviewed-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
>> Acked-by: Alejandro González <alejandro.gonzalez.correo@gmail.com>
>> Tested-by: Alejandro González <alejandro.gonzalez.correo@gmail.com>
>> ---
>> This patch was first submitted here:
>>
>> https://lore.kernel.org/all/20200617235809.6817-1-mmayer@broadcom.com/
>>
>> but never applied, meanwhile the issue is still present
> 
> Daniel, Rafael, any chance to get that into v5.19-rc7? I should probably 
> also have added:
> 
> Fixes: 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal 
> subsystem")

Yes, I'll pick it up

Thanks for resending
diff mbox series

Patch

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;