[v8,45/55,media] media: Use a macro to interate between all interfaces
diff mbox

Message ID 9e511a1a223c99f489330c29f50d099f58d0c34b.1440902901.git.mchehab@osg.samsung.com
State New
Headers show

Commit Message

Mauro Carvalho Chehab Aug. 30, 2015, 3:06 a.m. UTC
Just like we do with entities, use a similar macro for the
interfaces loop.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Comments

Hans Verkuil Aug. 31, 2015, 12:01 p.m. UTC | #1
On 08/30/2015 05:06 AM, Mauro Carvalho Chehab wrote:
> Just like we do with entities, use a similar macro for the
> interfaces loop.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

> 
> diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
> index 610d2bab1368..95b5b4b11230 100644
> --- a/drivers/media/dvb-core/dvbdev.c
> +++ b/drivers/media/dvb-core/dvbdev.c
> @@ -578,9 +578,10 @@ void dvb_create_media_graph(struct dvb_adapter *adap)
>  	}
>  
>  	/* Create indirect interface links for FE->tuner, DVR->demux and CA->ca */
> -	list_for_each_entry(intf, &mdev->interfaces, list) {
> +	media_device_for_each_intf(intf, mdev) {
>  		if (intf->type == MEDIA_INTF_T_DVB_CA && ca)
>  			media_create_intf_link(ca, intf, 0);
> +
>  		if (intf->type == MEDIA_INTF_T_DVB_FE && tuner)
>  			media_create_intf_link(tuner, intf, 0);
>  
> diff --git a/include/media/media-device.h b/include/media/media-device.h
> index 51807efa505b..f23d686aaac6 100644
> --- a/include/media/media-device.h
> +++ b/include/media/media-device.h
> @@ -113,6 +113,11 @@ 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)
>  
> +/* Iterate over all interfaces. */
> +#define media_device_for_each_intf(intf, mdev)			\
> +	list_for_each_entry(intf, &(mdev)->interfaces, list)
> +
> +
>  #else
>  static inline int media_device_register(struct media_device *mdev)
>  {
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 610d2bab1368..95b5b4b11230 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -578,9 +578,10 @@  void dvb_create_media_graph(struct dvb_adapter *adap)
 	}
 
 	/* Create indirect interface links for FE->tuner, DVR->demux and CA->ca */
-	list_for_each_entry(intf, &mdev->interfaces, list) {
+	media_device_for_each_intf(intf, mdev) {
 		if (intf->type == MEDIA_INTF_T_DVB_CA && ca)
 			media_create_intf_link(ca, intf, 0);
+
 		if (intf->type == MEDIA_INTF_T_DVB_FE && tuner)
 			media_create_intf_link(tuner, intf, 0);
 
diff --git a/include/media/media-device.h b/include/media/media-device.h
index 51807efa505b..f23d686aaac6 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -113,6 +113,11 @@  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)
 
+/* Iterate over all interfaces. */
+#define media_device_for_each_intf(intf, mdev)			\
+	list_for_each_entry(intf, &(mdev)->interfaces, list)
+
+
 #else
 static inline int media_device_register(struct media_device *mdev)
 {