[media] media: define Media Controller API when CONFIG_MEDIA_CONTROLLER enabled
authorShuah Khan <shuahkh@osg.samsung.com>
Fri, 5 Jun 2015 20:11:54 +0000 (17:11 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 11 Jan 2016 14:05:48 +0000 (12:05 -0200)
Change to define Media Controller API when CONFIG_MEDIA_CONTROLLER
is enabled. Define stubs for CONFIG_MEDIA_CONTROLLER disabled case.
This will help avoid drivers needing to enclose Media Controller
code within ifdef CONFIG_MEDIA_CONTROLLER block.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/media-device.c
include/media/media-device.h

index a4d5b2488c05130c685e6591fc102aa1c5afeb9c..c55ab5029323acf0b059ceeb2cfcf7e682a6f724 100644 (file)
@@ -30,6 +30,8 @@
 #include <media/media-devnode.h>
 #include <media/media-entity.h>
 
+#ifdef CONFIG_MEDIA_CONTROLLER
+
 /* -----------------------------------------------------------------------------
  * Userspace API
  */
@@ -495,3 +497,5 @@ struct media_device *media_device_find_devres(struct device *dev)
        return devres_find(dev, media_device_release_devres, NULL, NULL);
 }
 EXPORT_SYMBOL_GPL(media_device_find_devres);
+
+#endif /* CONFIG_MEDIA_CONTROLLER */
index 22792cd5b1d1aabef4c048b76d5be38e858d78d2..a44f18fdf321d8ab1bb94f8401bb490a07a8a97e 100644 (file)
@@ -80,6 +80,8 @@ struct media_device {
                           unsigned int notification);
 };
 
+#ifdef CONFIG_MEDIA_CONTROLLER
+
 /* Supported link_notify @notification values. */
 #define MEDIA_DEV_NOTIFY_PRE_LINK_CH   0
 #define MEDIA_DEV_NOTIFY_POST_LINK_CH  1
@@ -102,4 +104,29 @@ struct media_device *media_device_find_devres(struct device *dev);
 #define media_device_for_each_entity(entity, mdev)                     \
        list_for_each_entry(entity, &(mdev)->entities, list)
 
+#else
+static inline int media_device_register(struct media_device *mdev)
+{
+       return 0;
+}
+static inline void media_device_unregister(struct media_device *mdev)
+{
+}
+static inline int media_device_register_entity(struct media_device *mdev,
+                                               struct media_entity *entity)
+{
+       return 0;
+}
+static inline void media_device_unregister_entity(struct media_entity *entity)
+{
+}
+static inline struct media_device *media_device_get_devres(struct device *dev)
+{
+       return NULL;
+}
+static inline struct media_device *media_device_find_devres(struct device *dev)
+{
+       return NULL;
+}
+#endif /* CONFIG_MEDIA_CONTROLLER */
 #endif