diff mbox

[1/2,media] remove include/linux/dvb/dmx.h

Message ID 1350643392-2193-1-git-send-email-mchehab@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mauro Carvalho Chehab Oct. 19, 2012, 10:43 a.m. UTC
The only reason for this header is to make sure that include
linux/time.h were added before uapi/*/dmx.h. Just push down the
time.h header on the few places where this is used, and drop
this new header.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/media/dvb-core/dmxdev.h    |  1 +
 drivers/media/firewire/firedtv.h   |  1 +
 drivers/media/pci/ttpci/av7110.h   |  1 +
 drivers/media/usb/tlg2300/pd-dvb.c |  1 +
 include/linux/dvb/dmx.h            | 29 -----------------------------
 5 files changed, 4 insertions(+), 29 deletions(-)
 delete mode 100644 include/linux/dvb/dmx.h

Comments

Laurent Pinchart Oct. 19, 2012, 12:20 p.m. UTC | #1
Hi Mauro,

(CC'ing LKML)

On Friday 19 October 2012 08:21:16 Mauro Carvalho Chehab wrote:
> Em Fri, 19 Oct 2012 07:43:11 -0300
> 
> Mauro Carvalho Chehab <mchehab@redhat.com> escreveu:
> > -#include <linux/time.h>
> > -#include <uapi/linux/dvb/dmx.h>
> > -
> > -#endif /*_DVBDMX_H_*/
> 
> Just to not discard a valid comment on IRC, Laurent proposed that we
> should investigate if we can, instead, move:
> 
> 	#include <linux/time.h>
> 
> to both dmx.h and videodev2.h, letting it to be included by both userspace
> and Kernelspace.
> 
> I remember this used to cause compilation breakage in the past, as some
> userspace programs need to include <sys/time.h> and this used to conflict
> with <linux/time.h>.
> 
> I'm not sure if this got fixed there. if so, Laurent has a point.

It's still not solved, but that's what the proper fix should be.

Several UAPI headers use struct timeval or struct timespec. Kernel code and 
user space code thus need to include the header(s) that define those 
structures, either directly or indirectly.

In kernel space struct timeval and struct timespec are defined in 
include/uapi/linux/time.h. In user space they're defined in <sys/time.h>. No 
proper conditional compilation exists in those headers to guard against 
multiple definitions, so they can't be included together.

On the kernel side <sys/time.h> isn't available, so we can include 
<linux/time.h> in the headers that use the timeval and timespec structures. 
This "self-contained" headers mechanism avoids forcing all users of those 
headers to explicitly include <linux/time.h>.

However, this then breaks user space applications that include both 
<sys/time.h> and a kernel header that includes <linux/time.h>. The way we've 
dealt with that until now is by including either <linux/time.h> or 
<sys/time.h> depending on __KERNEL__

#ifdef __KERNEL__
#include <linux/time.h>
#else
#include <sys/kernel.h>
#endif

in our user-facing headers. The recent UAPI disintegration patches resulted in 
nearly empty headers in include/linux/ that just #include both <linux/time.h> 
and the corresponding UAPI header. For instance include/linux/videodev2.h is 
now just

#ifndef __LINUX_VIDEODEV2_H
#define __LINUX_VIDEODEV2_H

#include <linux/time.h>     /* need struct timeval */
#include <uapi/linux/videodev2.h>

#endif /* __LINUX_VIDEODEV2_H */

Patches have been posted to remove those headers and push the #include 
<linux/time.h> one level up, which breaks the "self-contained" headers 
concept.

How could we fix this ? Are there legitimate users of <linux/time.h> in user 
space ? A quick grep in glibc doesn't reveal anything.
diff mbox

Patch

diff --git a/drivers/media/dvb-core/dmxdev.h b/drivers/media/dvb-core/dmxdev.h
index 02ebe28..48c6cf9 100644
--- a/drivers/media/dvb-core/dmxdev.h
+++ b/drivers/media/dvb-core/dmxdev.h
@@ -26,6 +26,7 @@ 
 #include <linux/types.h>
 #include <linux/spinlock.h>
 #include <linux/kernel.h>
+#include <linux/time.h>
 #include <linux/timer.h>
 #include <linux/wait.h>
 #include <linux/fs.h>
diff --git a/drivers/media/firewire/firedtv.h b/drivers/media/firewire/firedtv.h
index 4fdcd8c..c2ba085 100644
--- a/drivers/media/firewire/firedtv.h
+++ b/drivers/media/firewire/firedtv.h
@@ -13,6 +13,7 @@ 
 #ifndef _FIREDTV_H
 #define _FIREDTV_H
 
+#include <linux/time.h>
 #include <linux/dvb/dmx.h>
 #include <linux/dvb/frontend.h>
 #include <linux/list.h>
diff --git a/drivers/media/pci/ttpci/av7110.h b/drivers/media/pci/ttpci/av7110.h
index 88b3b2d..a378662 100644
--- a/drivers/media/pci/ttpci/av7110.h
+++ b/drivers/media/pci/ttpci/av7110.h
@@ -6,6 +6,7 @@ 
 #include <linux/netdevice.h>
 #include <linux/i2c.h>
 #include <linux/input.h>
+#include <linux/time.h>
 
 #include <linux/dvb/video.h>
 #include <linux/dvb/audio.h>
diff --git a/drivers/media/usb/tlg2300/pd-dvb.c b/drivers/media/usb/tlg2300/pd-dvb.c
index 30fcb11..ca4994a 100644
--- a/drivers/media/usb/tlg2300/pd-dvb.c
+++ b/drivers/media/usb/tlg2300/pd-dvb.c
@@ -1,6 +1,7 @@ 
 #include "pd-common.h"
 #include <linux/kernel.h>
 #include <linux/usb.h>
+#include <linux/time.h>
 #include <linux/dvb/dmx.h>
 #include <linux/delay.h>
 #include <linux/gfp.h>
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
deleted file mode 100644
index 0be6d8f..0000000
--- a/include/linux/dvb/dmx.h
+++ /dev/null
@@ -1,29 +0,0 @@ 
-/*
- * dmx.h
- *
- * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
- *                  & Ralph  Metzler <ralph@convergence.de>
- *                    for convergence integrated media GmbH
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- */
-#ifndef _DVBDMX_H_
-#define _DVBDMX_H_
-
-#include <linux/time.h>
-#include <uapi/linux/dvb/dmx.h>
-
-#endif /*_DVBDMX_H_*/