Maemo patchset 20101501+0m5
[h-e-n] / drivers / media / video / v4l2-int-device.c
index a935bae..7579f3e 100644 (file)
@@ -32,7 +32,7 @@
 static DEFINE_MUTEX(mutex);
 static LIST_HEAD(int_list);
 
-void v4l2_int_device_try_attach_all(void)
+static void __v4l2_int_device_try_attach_all(void)
 {
        struct v4l2_int_device *m, *s;
 
@@ -66,6 +66,33 @@ void v4l2_int_device_try_attach_all(void)
                }
        }
 }
+
+static struct v4l2_int_slave dummy_slave = {
+       /* Dummy pointer to avoid underflow in find_ioctl. */
+       .ioctls = (void *)0x80000000,
+       .num_ioctls = 0,
+};
+
+static struct v4l2_int_device dummy = {
+       .type = v4l2_int_type_slave,
+       .u = {
+               .slave = &dummy_slave,
+       },
+};
+
+struct v4l2_int_device *v4l2_int_device_dummy()
+{
+       return &dummy;
+}
+EXPORT_SYMBOL_GPL(v4l2_int_device_dummy);
+
+void v4l2_int_device_try_attach_all(void)
+{
+       mutex_lock(&mutex);
+       __v4l2_int_device_try_attach_all();
+       mutex_unlock(&mutex);
+}
+
 EXPORT_SYMBOL_GPL(v4l2_int_device_try_attach_all);
 
 static int ioctl_sort_cmp(const void *a, const void *b)
@@ -89,7 +116,7 @@ int v4l2_int_device_register(struct v4l2_int_device *d)
                     &ioctl_sort_cmp, NULL);
        mutex_lock(&mutex);
        list_add(&d->head, &int_list);
-       v4l2_int_device_try_attach_all();
+       __v4l2_int_device_try_attach_all();
        mutex_unlock(&mutex);
 
        return 0;