Skip to contentSkip to conversation

v4l: videodev2: Include linux/time.h for timeval and timespec structs

PATCH In review Sakari Ailus 2 participants 4 messages Oct 27, 2016 – Nov 21, 2016 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 v4l: videodev2: Include linux/time.h for timeval and timespec structs

struct timeval and struct timespec are defined in linux/time.h. Explicitly include the header if __KERNEL__ is defined.

---
 include/uapi/linux/videodev2.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/videodev2.h +1 -0
index 4364ce6..bbab50c 100644
@@ -61,6 +61,7 @@
 #endif
 #include <linux/compiler.h>
 #include <linux/ioctl.h>
+#include <linux/time.h>
 #include <linux/types.h>
 #include <linux/v4l2-common.h>
 #include <linux/v4l2-controls.h>
Signature · 1 line
2.7.4
#1 lore raw

Em Thu, 27 Oct 2016 13:50:51 +0300
Sakari Ailus <[email protected]> escreveu:

Quoted 2 lines

struct timeval and struct timespec are defined in linux/time.h. Explicitly include the header if __KERNEL__ is defined.

The patch below doesn't do what you're mentioned above. It unconditionally include linux/time.h, and, for userspace, it will *also* include sys/time.h...

I suspect that this would cause problems on userspace.

Btw, you didn't mention on your description what's the bug you're trying to fix.

Quoted 11 lines
---
 include/uapi/linux/videodev2.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/videodev2.h +0 -0
index 4364ce6..bbab50c 100644

include/uapi/linux/videodev2.h line 67

Quoted 7 lines
include/uapi/linux/videodev2.h +1 -0
@@ -61,6 +61,7 @@
 #endif
 #include <linux/compiler.h>
 #include <linux/ioctl.h>
+#include <linux/time.h>
 #include <linux/types.h>
 #include <linux/v4l2-common.h>
 #include <linux/v4l2-controls.h>

Thanks,
Mauro

#2 lore raw

Hi Mauro,

Quoted 9 lines · Mauro Carvalho Chehab

Em Thu, 27 Oct 2016 13:50:51 +0300
Sakari Ailus <[email protected]> escreveu:

Quoted 2 lines

struct timeval and struct timespec are defined in linux/time.h. Explicitly include the header if __KERNEL__ is defined.

The patch below doesn't do what you're mentioned above. It unconditionally include linux/time.h, and, for userspace, it will *also* include sys/time.h...

My bad... I thought writing a single line patch would be easy. ;-) Will fix.

Quoted 5 lines

I suspect that this would cause problems on userspace.

Btw, you didn't mention on your description what's the bug you're trying to fix.

The problem is a compiler error due to lacking defition for a struct. I'll add that to v2.

Signature · 4 lines
Regards,

Sakari Ailus
[email protected]
#3 lore raw

Em Mon, 21 Nov 2016 15:51:56 +0200
Sakari Ailus <[email protected]> escreveu:

Quoted 16 lines

Hi Mauro,

Quoted 9 lines · Mauro Carvalho Chehab

Em Thu, 27 Oct 2016 13:50:51 +0300
Sakari Ailus <[email protected]> escreveu:

Quoted 2 lines

struct timeval and struct timespec are defined in linux/time.h. Explicitly include the header if __KERNEL__ is defined.

The patch below doesn't do what you're mentioned above. It unconditionally include linux/time.h, and, for userspace, it will *also* include sys/time.h...

My bad... I thought writing a single line patch would be easy. ;-) Will fix.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

I suspect that this would cause problems on userspace.

Btw, you didn't mention on your description what's the bug you're trying to fix.

The problem is a compiler error due to lacking defition for a struct. I'll add that to v2.

On userspace or Kernelspace? Please be clear at version 2, adding the relevant info about how you got it.

Thanks,
Mauro