DVB API wrapper patch v0.2 for VDR-1.5.14

Message ID 47A77419.8020404@gmx.de
State New
Headers

Commit Message

Udo Richter Feb. 4, 2008, 8:22 p.m. UTC
  For people who encounter this bug on recent kernels:

dvb_api_wrapper.c:189: error: '__invalid_size_argument_for_IOC' cannot 
appear in a constant-expression

This is caused by an obscure kernel compile check that is supposed to do 
macro parameter checking for ioctl constants, but also prevents using 
these constants in switch statements.

(Basically, it complains that an expression like this is not allowed:
case (true ? 1234 : some_var):
The glory details are in /usr/include/asm-generic/ioctl.h)


The attached (additional, because I'm lazy) patch works around this.

Cheers,

Udo
  

Patch

--- dvb_api_wrapper.c.orig	2008-02-04 21:12:33.000000000 +0100
+++ dvb_api_wrapper.c	2008-02-04 21:10:30.000000000 +0100
@@ -185,18 +185,16 @@ 
 }
 
 int DVBFE_ioctl(int d, int request, void *data) {
-  switch (request) {
-    case DVBFE_SET_PARAMS:
-         return ioctl_DVBFE_SET_PARAMS(d, (dvbfe_params*)data);
-    case DVBFE_GET_DELSYS:
-         return ioctl_DVBFE_GET_DELSYS(d, (dvbfe_delsys*)data);
-    case DVBFE_GET_INFO:
-         return ioctl_DVBFE_GET_INFO(d, (dvbfe_info*)data);
-    case DVBFE_GET_PARAMS:
-    case DVBFE_GET_EVENT:
-         errno = EINVAL;
-         return -1;
-  }
+  if (request == (int)DVBFE_SET_PARAMS)
+     return ioctl_DVBFE_SET_PARAMS(d, (dvbfe_params*)data);
+  if (request == (int)DVBFE_GET_DELSYS)
+     return ioctl_DVBFE_GET_DELSYS(d, (dvbfe_delsys*)data);
+  if (request == (int)DVBFE_GET_INFO)
+     return ioctl_DVBFE_GET_INFO(d, (dvbfe_info*)data);
+  if (request == (int)DVBFE_GET_PARAMS || request == (int)DVBFE_GET_EVENT) {
+     errno = EINVAL;
+     return -1;
+     }
   return ioctl(d, request, data);
 }