* [PATCH v8 00/55] MC next generation patches
@ 2015-08-30 3:06 Mauro Carvalho Chehab
2015-08-30 3:06 ` [PATCH v8 01/55] [media] media: create a macro to get entity ID Mauro Carvalho Chehab
` (4 more replies)
0 siblings, 5 replies; 17+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-30 3:06 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: devel, Lars-Peter Clausen, Sylwester Nawrocki,
Mauro Carvalho Chehab, Greg Kroah-Hartman, linux-sh, Shuah Khan,
Mauro Carvalho Chehab, Hans Verkuil, Javier Martinez Canillas,
linux-samsung-soc, Laurent Pinchart, Sakari Ailus, linux-api,
linux-arm-kernel
That's the 8th version of the MC next generation patches.
Differences from version 7:
- Patches reworked to make the reviewers happy;
- Bug fixes;
- ALSA changes got their own separate patches;
- Javier patches got integrated into this series;
- media-entity.h structs are now properly documented;
- Tested on both au0828 and omap3isp.
Due to the complexity of this change, other platform drivers may
require some fixes.
As the patch series sent before, this is not meant to be sent
upstream yet. Its goal is to merge it for Kernel 4.4, in order to
give people enough time to review and fix pending issues.
Regards,
Mauro
Javier Martinez Canillas (6):
[media] staging: omap4iss: get entity ID using media_entity_id()
[media] omap3isp: get entity ID using media_entity_id()
[media] media: use entity.graph_obj.mdev instead of .parent
[media] media: remove media entity .parent field
[media] omap3isp: separate links creation from entities init
[media] omap3isp: create links after all subdevs have been bound
Mauro Carvalho Chehab (49):
[media] media: create a macro to get entity ID
[media] media: add a common struct to be embed on media graph objects
[media] media: use media_gobj inside entities
[media] media: use media_gobj inside pads
[media] media: use media_gobj inside links
[media] media: add messages when media device gets (un)registered
[media] media: add a debug message to warn about gobj creation/removal
[media] media: rename the function that create pad links
[media] uapi/media.h: Declare interface types for V4L2 and DVB
[media] media: add functions to allow creating interfaces
[media] uapi/media.h: Declare interface types for ALSA
[media] media: Don't accept early-created links
[media] media: convert links from array to list
[media] media: make add link more generic
[media] media: make media_link more generic to handle interace links
[media] media: make link debug printk more generic
[media] media: add support to link interfaces and entities
[media] media-entity: add a helper function to create interface
[media] dvbdev: add support for interfaces
[media] media: add a linked list to track interfaces by mdev
[media] dvbdev: add support for indirect interface links
[media] uapi/media.h: Fix entity namespace
[media] replace all occurrences of MEDIA_ENT_T_DEVNODE_V4L
[media] replace all occurrences of MEDIA_ENT_T_DEVNODE_DVB
[media] media: add macros to check if subdev or V4L2 DMA
[media] media: use macros to check for V4L2 subdev entities
[media] omap3/omap4/davinci: get rid of MEDIA_ENT_T_V4L2_SUBDEV abuse
[media] s5c73m3: fix subdev type
[media] s5k5baf: fix subdev type
[media] davinci_vbpe: stop MEDIA_ENT_T_V4L2_SUBDEV abuse
[media] omap4iss: stop MEDIA_ENT_T_V4L2_SUBDEV abuse
[media] v4l2-subdev: use MEDIA_ENT_T_UNKNOWN for new subdevs
[media] media controller: get rid of entity subtype on Kernel
[media] media.h: don't use legacy entity macros at Kernel
[media] DocBook: update descriptions for the media controller entities
[media] dvb: modify core to implement interfaces/entities at MC new
gen
[media] media: report if a pad is sink or source at debug msg
[media] uapi/media.h: Add MEDIA_IOC_G_TOPOLOGY ioctl
[media] media: Use a macro to interate between all interfaces
[media] media: move mdev list init to gobj
[media] media-device: add pads and links to media_device
[media] media_device: add a topology version field
[media] media-device: add support for MEDIA_IOC_G_TOPOLOGY ioctl
[media] media-entity: unregister entity links
[media] remove interface links at media_entity_unregister()
[media] media-device: remove interfaces and interface links
[media] v4l2-core: create MC interfaces for devnodes
[media] au0828: unregister MC at the end
[media] media-entity.h: document all the structs
.../DocBook/media/v4l/media-ioc-enum-entities.xml | 57 +--
Documentation/media-framework.txt | 2 +-
drivers/media/dvb-core/dmxdev.c | 4 +-
drivers/media/dvb-core/dvb_ca_en50221.c | 2 +-
drivers/media/dvb-core/dvb_frontend.c | 11 +-
drivers/media/dvb-core/dvb_net.c | 2 +-
drivers/media/dvb-core/dvbdev.c | 278 +++++++++---
drivers/media/dvb-core/dvbdev.h | 10 +-
drivers/media/firewire/firedtv-ci.c | 2 +-
drivers/media/i2c/s5c73m3/s5c73m3-core.c | 8 +-
drivers/media/i2c/s5k5baf.c | 4 +-
drivers/media/i2c/smiapp/smiapp-core.c | 4 +-
drivers/media/media-device.c | 245 +++++++++--
drivers/media/media-entity.c | 473 +++++++++++++++++----
drivers/media/pci/bt8xx/dst_ca.c | 3 +-
drivers/media/pci/ddbridge/ddbridge-core.c | 2 +-
drivers/media/pci/ngene/ngene-core.c | 2 +-
drivers/media/pci/ttpci/av7110.c | 2 +-
drivers/media/pci/ttpci/av7110_av.c | 4 +-
drivers/media/pci/ttpci/av7110_ca.c | 2 +-
drivers/media/platform/exynos4-is/common.c | 3 +-
drivers/media/platform/exynos4-is/fimc-capture.c | 5 +-
drivers/media/platform/exynos4-is/fimc-isp-video.c | 9 +-
drivers/media/platform/exynos4-is/fimc-lite.c | 18 +-
drivers/media/platform/exynos4-is/media-dev.c | 25 +-
drivers/media/platform/exynos4-is/media-dev.h | 8 +-
drivers/media/platform/omap3isp/isp.c | 202 +++++----
drivers/media/platform/omap3isp/ispccdc.c | 39 +-
drivers/media/platform/omap3isp/ispccdc.h | 1 +
drivers/media/platform/omap3isp/ispccp2.c | 35 +-
drivers/media/platform/omap3isp/ispccp2.h | 1 +
drivers/media/platform/omap3isp/ispcsi2.c | 33 +-
drivers/media/platform/omap3isp/ispcsi2.h | 1 +
drivers/media/platform/omap3isp/isppreview.c | 48 ++-
drivers/media/platform/omap3isp/isppreview.h | 1 +
drivers/media/platform/omap3isp/ispresizer.c | 46 +-
drivers/media/platform/omap3isp/ispresizer.h | 1 +
drivers/media/platform/omap3isp/ispvideo.c | 17 +-
drivers/media/platform/s3c-camif/camif-capture.c | 2 +-
drivers/media/platform/s3c-camif/camif-core.c | 4 +-
drivers/media/platform/vsp1/vsp1_drv.c | 4 +-
drivers/media/platform/vsp1/vsp1_rpf.c | 2 +-
drivers/media/platform/vsp1/vsp1_video.c | 15 +-
drivers/media/platform/vsp1/vsp1_wpf.c | 2 +-
drivers/media/platform/xilinx/xilinx-dma.c | 10 +-
drivers/media/platform/xilinx/xilinx-vipp.c | 4 +-
drivers/media/usb/au0828/au0828-core.c | 18 +-
drivers/media/usb/au0828/au0828-video.c | 8 +-
drivers/media/usb/cx231xx/cx231xx-cards.c | 6 +-
drivers/media/usb/cx231xx/cx231xx-video.c | 8 +-
drivers/media/usb/uvc/uvc_entity.c | 2 +-
drivers/media/v4l2-core/v4l2-dev.c | 105 ++++-
drivers/media/v4l2-core/v4l2-device.c | 10 +-
drivers/media/v4l2-core/v4l2-subdev.c | 6 +-
drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 9 +-
drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 15 +-
drivers/staging/media/davinci_vpfe/dm365_isif.c | 15 +-
drivers/staging/media/davinci_vpfe/dm365_resizer.c | 33 +-
.../staging/media/davinci_vpfe/vpfe_mc_capture.c | 10 +-
drivers/staging/media/davinci_vpfe/vpfe_video.c | 17 +-
drivers/staging/media/omap4iss/iss.c | 32 +-
drivers/staging/media/omap4iss/iss_csi2.c | 13 +-
drivers/staging/media/omap4iss/iss_ipipe.c | 9 +-
drivers/staging/media/omap4iss/iss_ipipeif.c | 15 +-
drivers/staging/media/omap4iss/iss_resizer.c | 13 +-
drivers/staging/media/omap4iss/iss_video.c | 9 +-
include/media/media-device.h | 34 +-
include/media/media-entity.h | 305 +++++++++++--
include/media/v4l2-dev.h | 1 +
include/uapi/linux/media.h | 205 ++++++++-
70 files changed, 1924 insertions(+), 627 deletions(-)
--
2.4.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v8 01/55] [media] media: create a macro to get entity ID
2015-08-30 3:06 [PATCH v8 00/55] MC next generation patches Mauro Carvalho Chehab
@ 2015-08-30 3:06 ` Mauro Carvalho Chehab
2015-09-10 13:58 ` Javier Martinez Canillas
2015-12-06 3:20 ` Laurent Pinchart
2015-08-30 3:06 ` [PATCH v8 10/55] [media] media: rename the function that create pad links Mauro Carvalho Chehab
` (3 subsequent siblings)
4 siblings, 2 replies; 17+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-30 3:06 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Laurent Pinchart,
linux-sh
Instead of accessing directly entity.id, let's create a macro,
as this field will be moved into a common struct later on.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index c55ab5029323..e429605ca2c3 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -77,8 +77,8 @@ static struct media_entity *find_entity(struct media_device *mdev, u32 id)
spin_lock(&mdev->lock);
media_device_for_each_entity(entity, mdev) {
- if ((entity->id = id && !next) ||
- (entity->id > id && next)) {
+ if (((media_entity_id(entity) = id) && !next) ||
+ ((media_entity_id(entity) > id) && next)) {
spin_unlock(&mdev->lock);
return entity;
}
@@ -104,7 +104,7 @@ static long media_device_enum_entities(struct media_device *mdev,
if (ent = NULL)
return -EINVAL;
- u_ent.id = ent->id;
+ u_ent.id = media_entity_id(ent);
if (ent->name)
strlcpy(u_ent.name, ent->name, sizeof(u_ent.name));
u_ent.type = ent->type;
@@ -122,7 +122,7 @@ static long media_device_enum_entities(struct media_device *mdev,
static void media_device_kpad_to_upad(const struct media_pad *kpad,
struct media_pad_desc *upad)
{
- upad->entity = kpad->entity->id;
+ upad->entity = media_entity_id(kpad->entity);
upad->index = kpad->index;
upad->flags = kpad->flags;
}
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 949e5f92cbdc..cb0ac4e0dfa5 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -140,10 +140,10 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph,
graph->stack[graph->top].entity = NULL;
bitmap_zero(graph->entities, MEDIA_ENTITY_ENUM_MAX_ID);
- if (WARN_ON(entity->id >= MEDIA_ENTITY_ENUM_MAX_ID))
+ if (WARN_ON(media_entity_id(entity) >= MEDIA_ENTITY_ENUM_MAX_ID))
return;
- __set_bit(entity->id, graph->entities);
+ __set_bit(media_entity_id(entity), graph->entities);
stack_push(graph, entity);
}
EXPORT_SYMBOL_GPL(media_entity_graph_walk_start);
@@ -184,11 +184,11 @@ media_entity_graph_walk_next(struct media_entity_graph *graph)
/* Get the entity in the other end of the link . */
next = media_entity_other(entity, link);
- if (WARN_ON(next->id >= MEDIA_ENTITY_ENUM_MAX_ID))
+ if (WARN_ON(media_entity_id(next) >= MEDIA_ENTITY_ENUM_MAX_ID))
return NULL;
/* Has the entity already been visited? */
- if (__test_and_set_bit(next->id, graph->entities)) {
+ if (__test_and_set_bit(media_entity_id(next), graph->entities)) {
link_top(graph)++;
continue;
}
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
index 17f08973f835..debe4e539df6 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -352,10 +352,10 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
break;
/* Ensure the branch has no loop. */
- if (entities & (1 << entity->subdev.entity.id))
+ if (entities & (1 << media_entity_id(&entity->subdev.entity)))
return -EPIPE;
- entities |= 1 << entity->subdev.entity.id;
+ entities |= 1 << media_entity_id(&entity->subdev.entity);
/* UDS can't be chained. */
if (entity->type = VSP1_ENTITY_UDS) {
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 8b21a4d920d9..0a66fc225559 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -113,6 +113,11 @@ static inline u32 media_entity_subtype(struct media_entity *entity)
return entity->type & MEDIA_ENT_SUBTYPE_MASK;
}
+static inline u32 media_entity_id(struct media_entity *entity)
+{
+ return entity->id;
+}
+
#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16
#define MEDIA_ENTITY_ENUM_MAX_ID 64
--
2.4.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v8 10/55] [media] media: rename the function that create pad links
2015-08-30 3:06 [PATCH v8 00/55] MC next generation patches Mauro Carvalho Chehab
2015-08-30 3:06 ` [PATCH v8 01/55] [media] media: create a macro to get entity ID Mauro Carvalho Chehab
@ 2015-08-30 3:06 ` Mauro Carvalho Chehab
2015-09-10 14:16 ` Javier Martinez Canillas
2015-08-30 3:06 ` [PATCH v8 11/55] [media] media: use entity.graph_obj.mdev instead of .parent Mauro Carvalho Chehab
` (2 subsequent siblings)
4 siblings, 1 reply; 17+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-30 3:06 UTC (permalink / raw)
To: linux-arm-kernel
With the new API, a link can be either between two PADs or between an interface
and an entity. So, we need to use a better name for the function that create
links between two pads.
So, rename the such function to media_create_pad_link().
No functional changes.
This patch was created via this shell script:
for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' -type f) ; do sed s,media_entity_create_link,media_create_pad_link,g <$i >a && mv a $i; done
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/Documentation/media-framework.txt b/Documentation/media-framework.txt
index 6903b2503577..b424de6c3bb3 100644
--- a/Documentation/media-framework.txt
+++ b/Documentation/media-framework.txt
@@ -199,7 +199,7 @@ pre-allocated and grows dynamically as needed.
Drivers create links by calling
- media_entity_create_link(struct media_entity *source, u16 source_pad,
+ media_create_pad_link(struct media_entity *source, u16 source_pad,
struct media_entity *sink, u16 sink_pad,
u32 flags);
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 2fdcbb5f000a..65f59f2124b4 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -412,16 +412,16 @@ void dvb_create_media_graph(struct dvb_adapter *adap)
}
if (tuner && fe)
- media_entity_create_link(tuner, 0, fe, 0, 0);
+ media_create_pad_link(tuner, 0, fe, 0, 0);
if (fe && demux)
- media_entity_create_link(fe, 1, demux, 0, MEDIA_LNK_FL_ENABLED);
+ media_create_pad_link(fe, 1, demux, 0, MEDIA_LNK_FL_ENABLED);
if (demux && dvr)
- media_entity_create_link(demux, 1, dvr, 0, MEDIA_LNK_FL_ENABLED);
+ media_create_pad_link(demux, 1, dvr, 0, MEDIA_LNK_FL_ENABLED);
if (demux && ca)
- media_entity_create_link(demux, 1, ca, 0, MEDIA_LNK_FL_ENABLED);
+ media_create_pad_link(demux, 1, ca, 0, MEDIA_LNK_FL_ENABLED);
}
EXPORT_SYMBOL_GPL(dvb_create_media_graph);
#endif
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index 6d167428727d..c81bfbfea32f 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -1482,11 +1482,11 @@ static int s5c73m3_oif_registered(struct v4l2_subdev *sd)
return ret;
}
- ret = media_entity_create_link(&state->sensor_sd.entity,
+ ret = media_create_pad_link(&state->sensor_sd.entity,
S5C73M3_ISP_PAD, &state->oif_sd.entity, OIF_ISP_PAD,
MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
- ret = media_entity_create_link(&state->sensor_sd.entity,
+ ret = media_create_pad_link(&state->sensor_sd.entity,
S5C73M3_JPEG_PAD, &state->oif_sd.entity, OIF_JPEG_PAD,
MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
index 30a9ca62e034..d3bff30bcb6f 100644
--- a/drivers/media/i2c/s5k5baf.c
+++ b/drivers/media/i2c/s5k5baf.c
@@ -1756,7 +1756,7 @@ static int s5k5baf_registered(struct v4l2_subdev *sd)
v4l2_err(sd, "failed to register subdev %s\n",
state->cis_sd.name);
else
- ret = media_entity_create_link(&state->cis_sd.entity, PAD_CIS,
+ ret = media_create_pad_link(&state->cis_sd.entity, PAD_CIS,
&state->sd.entity, PAD_CIS,
MEDIA_LNK_FL_IMMUTABLE |
MEDIA_LNK_FL_ENABLED);
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 308613ea0aed..5aa49eb393a9 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2495,7 +2495,7 @@ static int smiapp_register_subdevs(struct smiapp_sensor *sensor)
return rval;
}
- rval = media_entity_create_link(&this->sd.entity,
+ rval = media_create_pad_link(&this->sd.entity,
this->source_pad,
&last->sd.entity,
last->sink_pad,
@@ -2503,7 +2503,7 @@ static int smiapp_register_subdevs(struct smiapp_sensor *sensor)
MEDIA_LNK_FL_IMMUTABLE);
if (rval) {
dev_err(&client->dev,
- "media_entity_create_link failed\n");
+ "media_create_pad_link failed\n");
return rval;
}
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 6d515e149d7f..35e52cd1fc5a 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -542,7 +542,7 @@ static struct media_link *media_entity_add_link(struct media_entity *entity)
}
int
-media_entity_create_link(struct media_entity *source, u16 source_pad,
+media_create_pad_link(struct media_entity *source, u16 source_pad,
struct media_entity *sink, u16 sink_pad, u32 flags)
{
struct media_link *link;
@@ -586,7 +586,7 @@ media_entity_create_link(struct media_entity *source, u16 source_pad,
return 0;
}
-EXPORT_SYMBOL_GPL(media_entity_create_link);
+EXPORT_SYMBOL_GPL(media_create_pad_link);
void __media_entity_remove_links(struct media_entity *entity)
{
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index 4f5586a4cbff..3ba76940eef5 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -729,7 +729,7 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd,
flags = ((1 << i) & link_mask) ? MEDIA_LNK_FL_ENABLED : 0;
sink = &fmd->fimc[i]->vid_cap.subdev.entity;
- ret = media_entity_create_link(source, pad, sink,
+ ret = media_create_pad_link(source, pad, sink,
FIMC_SD_PAD_SINK_CAM, flags);
if (ret)
return ret;
@@ -749,7 +749,7 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd,
continue;
sink = &fmd->fimc_lite[i]->subdev.entity;
- ret = media_entity_create_link(source, pad, sink,
+ ret = media_create_pad_link(source, pad, sink,
FLITE_SD_PAD_SINK, 0);
if (ret)
return ret;
@@ -781,13 +781,13 @@ static int __fimc_md_create_flite_source_links(struct fimc_md *fmd)
source = &fimc->subdev.entity;
sink = &fimc->ve.vdev.entity;
/* FIMC-LITE's subdev and video node */
- ret = media_entity_create_link(source, FLITE_SD_PAD_SOURCE_DMA,
+ ret = media_create_pad_link(source, FLITE_SD_PAD_SOURCE_DMA,
sink, 0, 0);
if (ret)
break;
/* Link from FIMC-LITE to IS-ISP subdev */
sink = &fmd->fimc_is->isp.subdev.entity;
- ret = media_entity_create_link(source, FLITE_SD_PAD_SOURCE_ISP,
+ ret = media_create_pad_link(source, FLITE_SD_PAD_SOURCE_ISP,
sink, 0, 0);
if (ret)
break;
@@ -811,7 +811,7 @@ static int __fimc_md_create_fimc_is_links(struct fimc_md *fmd)
/* Link from FIMC-IS-ISP subdev to FIMC */
sink = &fmd->fimc[i]->vid_cap.subdev.entity;
- ret = media_entity_create_link(source, FIMC_ISP_SD_PAD_SRC_FIFO,
+ ret = media_create_pad_link(source, FIMC_ISP_SD_PAD_SRC_FIFO,
sink, FIMC_SD_PAD_SINK_FIFO, 0);
if (ret)
return ret;
@@ -824,7 +824,7 @@ static int __fimc_md_create_fimc_is_links(struct fimc_md *fmd)
if (sink->num_pads = 0)
return 0;
- return media_entity_create_link(source, FIMC_ISP_SD_PAD_SRC_DMA,
+ return media_create_pad_link(source, FIMC_ISP_SD_PAD_SRC_DMA,
sink, 0, 0);
}
@@ -873,7 +873,7 @@ static int fimc_md_create_links(struct fimc_md *fmd)
return -EINVAL;
pad = sensor->entity.num_pads - 1;
- ret = media_entity_create_link(&sensor->entity, pad,
+ ret = media_create_pad_link(&sensor->entity, pad,
&csis->entity, CSIS_PAD_SINK,
MEDIA_LNK_FL_IMMUTABLE |
MEDIA_LNK_FL_ENABLED);
@@ -927,7 +927,7 @@ static int fimc_md_create_links(struct fimc_md *fmd)
source = &fmd->fimc[i]->vid_cap.subdev.entity;
sink = &fmd->fimc[i]->vid_cap.ve.vdev.entity;
- ret = media_entity_create_link(source, FIMC_SD_PAD_SOURCE,
+ ret = media_create_pad_link(source, FIMC_SD_PAD_SOURCE,
sink, 0, flags);
if (ret)
break;
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index e08183f9d0f7..6351f35b0a65 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -1865,7 +1865,7 @@ static int isp_link_entity(
return -EINVAL;
}
- return media_entity_create_link(entity, i, input, pad, flags);
+ return media_create_pad_link(entity, i, input, pad, flags);
}
static int isp_register_entities(struct isp_device *isp)
@@ -2004,51 +2004,51 @@ static int isp_initialize_modules(struct isp_device *isp)
}
/* Connect the submodules. */
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&isp->isp_csi2a.subdev.entity, CSI2_PAD_SOURCE,
&isp->isp_ccdc.subdev.entity, CCDC_PAD_SINK, 0);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&isp->isp_ccp2.subdev.entity, CCP2_PAD_SOURCE,
&isp->isp_ccdc.subdev.entity, CCDC_PAD_SINK, 0);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
&isp->isp_prev.subdev.entity, PREV_PAD_SINK, 0);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_OF,
&isp->isp_res.subdev.entity, RESZ_PAD_SINK, 0);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&isp->isp_prev.subdev.entity, PREV_PAD_SOURCE,
&isp->isp_res.subdev.entity, RESZ_PAD_SINK, 0);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
&isp->isp_aewb.subdev.entity, 0,
MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
&isp->isp_af.subdev.entity, 0,
MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP,
&isp->isp_hist.subdev.entity, 0,
MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
index d96e3be5e252..27555e4f4aa8 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -2667,7 +2667,7 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc)
goto error_video;
/* Connect the CCDC subdev to the video node. */
- ret = media_entity_create_link(&ccdc->subdev.entity, CCDC_PAD_SOURCE_OF,
+ ret = media_create_pad_link(&ccdc->subdev.entity, CCDC_PAD_SOURCE_OF,
&ccdc->video_out.video.entity, 0, 0);
if (ret < 0)
goto error_link;
diff --git a/drivers/media/platform/omap3isp/ispccp2.c b/drivers/media/platform/omap3isp/ispccp2.c
index e1b5f5bea541..b215eb5049d6 100644
--- a/drivers/media/platform/omap3isp/ispccp2.c
+++ b/drivers/media/platform/omap3isp/ispccp2.c
@@ -1100,7 +1100,7 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2)
goto error_video;
/* Connect the video node to the ccp2 subdev. */
- ret = media_entity_create_link(&ccp2->video_in.video.entity, 0,
+ ret = media_create_pad_link(&ccp2->video_in.video.entity, 0,
&ccp2->subdev.entity, CCP2_PAD_SINK, 0);
if (ret < 0)
goto error_link;
diff --git a/drivers/media/platform/omap3isp/ispcsi2.c b/drivers/media/platform/omap3isp/ispcsi2.c
index 6fff92f0813a..fcefc1e74881 100644
--- a/drivers/media/platform/omap3isp/ispcsi2.c
+++ b/drivers/media/platform/omap3isp/ispcsi2.c
@@ -1265,7 +1265,7 @@ static int csi2_init_entities(struct isp_csi2_device *csi2)
goto error_video;
/* Connect the CSI2 subdev to the video node. */
- ret = media_entity_create_link(&csi2->subdev.entity, CSI2_PAD_SOURCE,
+ ret = media_create_pad_link(&csi2->subdev.entity, CSI2_PAD_SOURCE,
&csi2->video_out.video.entity, 0, 0);
if (ret < 0)
goto error_link;
diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c
index b440c6342ca4..ad38d20c7770 100644
--- a/drivers/media/platform/omap3isp/isppreview.c
+++ b/drivers/media/platform/omap3isp/isppreview.c
@@ -2312,12 +2312,12 @@ static int preview_init_entities(struct isp_prev_device *prev)
goto error_video_out;
/* Connect the video nodes to the previewer subdev. */
- ret = media_entity_create_link(&prev->video_in.video.entity, 0,
+ ret = media_create_pad_link(&prev->video_in.video.entity, 0,
&prev->subdev.entity, PREV_PAD_SINK, 0);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(&prev->subdev.entity, PREV_PAD_SOURCE,
+ ret = media_create_pad_link(&prev->subdev.entity, PREV_PAD_SOURCE,
&prev->video_out.video.entity, 0, 0);
if (ret < 0)
goto error_link;
diff --git a/drivers/media/platform/omap3isp/ispresizer.c b/drivers/media/platform/omap3isp/ispresizer.c
index 3deb1ec4a973..b48ad4d4b834 100644
--- a/drivers/media/platform/omap3isp/ispresizer.c
+++ b/drivers/media/platform/omap3isp/ispresizer.c
@@ -1756,12 +1756,12 @@ static int resizer_init_entities(struct isp_res_device *res)
res->video_out.video.entity.flags |= MEDIA_ENT_FL_DEFAULT;
/* Connect the video nodes to the resizer subdev. */
- ret = media_entity_create_link(&res->video_in.video.entity, 0,
+ ret = media_create_pad_link(&res->video_in.video.entity, 0,
&res->subdev.entity, RESZ_PAD_SINK, 0);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(&res->subdev.entity, RESZ_PAD_SOURCE,
+ ret = media_create_pad_link(&res->subdev.entity, RESZ_PAD_SOURCE,
&res->video_out.video.entity, 0, 0);
if (ret < 0)
goto error_link;
diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c
index f47b332f0418..3e33c60be004 100644
--- a/drivers/media/platform/s3c-camif/camif-core.c
+++ b/drivers/media/platform/s3c-camif/camif-core.c
@@ -263,7 +263,7 @@ static int camif_create_media_links(struct camif_dev *camif)
{
int i, ret;
- ret = media_entity_create_link(&camif->sensor.sd->entity, 0,
+ ret = media_create_pad_link(&camif->sensor.sd->entity, 0,
&camif->subdev.entity, CAMIF_SD_PAD_SINK,
MEDIA_LNK_FL_IMMUTABLE |
MEDIA_LNK_FL_ENABLED);
@@ -271,7 +271,7 @@ static int camif_create_media_links(struct camif_dev *camif)
return ret;
for (i = 1; i < CAMIF_SD_PADS_NUM && !ret; i++) {
- ret = media_entity_create_link(&camif->subdev.entity, i,
+ ret = media_create_pad_link(&camif->subdev.entity, i,
&camif->vp[i - 1].vdev.entity, 0,
MEDIA_LNK_FL_IMMUTABLE |
MEDIA_LNK_FL_ENABLED);
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index 4e61886384e3..9cd94a76a9ed 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -101,7 +101,7 @@ static int vsp1_create_links(struct vsp1_device *vsp1, struct vsp1_entity *sink)
if (!(entity->pads[pad].flags & MEDIA_PAD_FL_SINK))
continue;
- ret = media_entity_create_link(&source->subdev.entity,
+ ret = media_create_pad_link(&source->subdev.entity,
source->source_pad,
entity, pad, flags);
if (ret < 0)
@@ -262,7 +262,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
}
if (vsp1->pdata.features & VSP1_HAS_LIF) {
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&vsp1->wpf[0]->entity.subdev.entity, RWPF_PAD_SOURCE,
&vsp1->lif->entity.subdev.entity, LIF_PAD_SINK, 0);
if (ret < 0)
diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c
index 3294529a3108..b60a528a8fe8 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -278,7 +278,7 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index)
rpf->entity.video = video;
/* Connect the video device to the RPF. */
- ret = media_entity_create_link(&rpf->video.video.entity, 0,
+ ret = media_create_pad_link(&rpf->video.video.entity, 0,
&rpf->entity.subdev.entity,
RWPF_PAD_SINK,
MEDIA_LNK_FL_ENABLED |
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c
index 1d2b3a2f1573..d39aa4b8aea1 100644
--- a/drivers/media/platform/vsp1/vsp1_wpf.c
+++ b/drivers/media/platform/vsp1/vsp1_wpf.c
@@ -284,7 +284,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
if (!(vsp1->pdata.features & VSP1_HAS_LIF) || index != 0)
flags |= MEDIA_LNK_FL_IMMUTABLE;
- ret = media_entity_create_link(&wpf->entity.subdev.entity,
+ ret = media_create_pad_link(&wpf->entity.subdev.entity,
RWPF_PAD_SOURCE,
&wpf->video.video.entity, 0, flags);
if (ret < 0)
diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/platform/xilinx/xilinx-vipp.c
index 7b7cb9c28d2c..79d4be7ce9a5 100644
--- a/drivers/media/platform/xilinx/xilinx-vipp.c
+++ b/drivers/media/platform/xilinx/xilinx-vipp.c
@@ -156,7 +156,7 @@ static int xvip_graph_build_one(struct xvip_composite_device *xdev,
local->name, local_pad->index,
remote->name, remote_pad->index);
- ret = media_entity_create_link(local, local_pad->index,
+ ret = media_create_pad_link(local, local_pad->index,
remote, remote_pad->index,
link_flags);
if (ret < 0) {
@@ -270,7 +270,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
source->name, source_pad->index,
sink->name, sink_pad->index);
- ret = media_entity_create_link(source, source_pad->index,
+ ret = media_create_pad_link(source, source_pad->index,
sink, sink_pad->index,
link_flags);
if (ret < 0) {
diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
index 0378a2c99ebb..a55eb524ea21 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -260,13 +260,13 @@ static void au0828_create_media_graph(struct au0828_dev *dev)
return;
if (tuner)
- media_entity_create_link(tuner, 0, decoder, 0,
+ media_create_pad_link(tuner, 0, decoder, 0,
MEDIA_LNK_FL_ENABLED);
if (dev->vdev.entity.links)
- media_entity_create_link(decoder, 1, &dev->vdev.entity, 0,
+ media_create_pad_link(decoder, 1, &dev->vdev.entity, 0,
MEDIA_LNK_FL_ENABLED);
if (dev->vbi_dev.entity.links)
- media_entity_create_link(decoder, 2, &dev->vbi_dev.entity, 0,
+ media_create_pad_link(decoder, 2, &dev->vbi_dev.entity, 0,
MEDIA_LNK_FL_ENABLED);
#endif
}
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
index 4a117a58c39a..3b5c9ae39ad3 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -1264,11 +1264,11 @@ static void cx231xx_create_media_graph(struct cx231xx *dev)
return;
if (tuner)
- media_entity_create_link(tuner, 0, decoder, 0,
+ media_create_pad_link(tuner, 0, decoder, 0,
MEDIA_LNK_FL_ENABLED);
- media_entity_create_link(decoder, 1, &dev->vdev.entity, 0,
+ media_create_pad_link(decoder, 1, &dev->vdev.entity, 0,
MEDIA_LNK_FL_ENABLED);
- media_entity_create_link(decoder, 2, &dev->vbi_dev.entity, 0,
+ media_create_pad_link(decoder, 2, &dev->vbi_dev.entity, 0,
MEDIA_LNK_FL_ENABLED);
#endif
}
diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index 245445491516..429e428ccd93 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -56,7 +56,7 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
continue;
remote_pad = remote->num_pads - 1;
- ret = media_entity_create_link(source, remote_pad,
+ ret = media_create_pad_link(source, remote_pad,
sink, i, flags);
if (ret < 0)
return ret;
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
index 8fb676186898..d96bdaaae50e 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
@@ -971,7 +971,7 @@ vpfe_ipipeif_register_entities(struct vpfe_ipipeif_device *ipipeif,
ipipeif->video_in.vpfe_dev = vpfe_dev;
flags = 0;
- ret = media_entity_create_link(&ipipeif->video_in.video_dev.entity, 0,
+ ret = media_create_pad_link(&ipipeif->video_in.video_dev.entity, 0,
&ipipeif->subdev.entity, 0, flags);
if (ret < 0)
goto fail;
diff --git a/drivers/staging/media/davinci_vpfe/dm365_isif.c b/drivers/staging/media/davinci_vpfe/dm365_isif.c
index b1f01adfa7c8..df77288b0ec0 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_isif.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_isif.c
@@ -1817,7 +1817,7 @@ int vpfe_isif_register_entities(struct vpfe_isif_device *isif,
isif->video_out.vpfe_dev = vpfe_dev;
flags = 0;
/* connect isif to video node */
- ret = media_entity_create_link(&isif->subdev.entity, 1,
+ ret = media_create_pad_link(&isif->subdev.entity, 1,
&isif->video_out.video_dev.entity,
0, flags);
if (ret < 0)
diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
index 692789aa22f4..ae942de3a23d 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
@@ -1831,27 +1831,27 @@ int vpfe_resizer_register_entities(struct vpfe_resizer_device *resizer,
resizer->resizer_b.video_out.vpfe_dev = vpfe_dev;
/* create link between Resizer Crop----> Resizer A*/
- ret = media_entity_create_link(&resizer->crop_resizer.subdev.entity, 1,
+ ret = media_create_pad_link(&resizer->crop_resizer.subdev.entity, 1,
&resizer->resizer_a.subdev.entity,
0, flags);
if (ret < 0)
goto out_create_link;
/* create link between Resizer Crop----> Resizer B*/
- ret = media_entity_create_link(&resizer->crop_resizer.subdev.entity, 2,
+ ret = media_create_pad_link(&resizer->crop_resizer.subdev.entity, 2,
&resizer->resizer_b.subdev.entity,
0, flags);
if (ret < 0)
goto out_create_link;
/* create link between Resizer A ----> video out */
- ret = media_entity_create_link(&resizer->resizer_a.subdev.entity, 1,
+ ret = media_create_pad_link(&resizer->resizer_a.subdev.entity, 1,
&resizer->resizer_a.video_out.video_dev.entity, 0, flags);
if (ret < 0)
goto out_create_link;
/* create link between Resizer B ----> video out */
- ret = media_entity_create_link(&resizer->resizer_b.subdev.entity, 1,
+ ret = media_create_pad_link(&resizer->resizer_b.subdev.entity, 1,
&resizer->resizer_b.video_out.video_dev.entity, 0, flags);
if (ret < 0)
goto out_create_link;
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
index 57426199ad7a..08c8a5f967d3 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
@@ -445,32 +445,32 @@ static int vpfe_register_entities(struct vpfe_device *vpfe_dev)
/* if entity has no pads (ex: amplifier),
cant establish link */
if (vpfe_dev->sd[i]->entity.num_pads) {
- ret = media_entity_create_link(&vpfe_dev->sd[i]->entity,
+ ret = media_create_pad_link(&vpfe_dev->sd[i]->entity,
0, &vpfe_dev->vpfe_isif.subdev.entity,
0, flags);
if (ret < 0)
goto out_resizer_register;
}
- ret = media_entity_create_link(&vpfe_dev->vpfe_isif.subdev.entity, 1,
+ ret = media_create_pad_link(&vpfe_dev->vpfe_isif.subdev.entity, 1,
&vpfe_dev->vpfe_ipipeif.subdev.entity,
0, flags);
if (ret < 0)
goto out_resizer_register;
- ret = media_entity_create_link(&vpfe_dev->vpfe_ipipeif.subdev.entity, 1,
+ ret = media_create_pad_link(&vpfe_dev->vpfe_ipipeif.subdev.entity, 1,
&vpfe_dev->vpfe_ipipe.subdev.entity,
0, flags);
if (ret < 0)
goto out_resizer_register;
- ret = media_entity_create_link(&vpfe_dev->vpfe_ipipe.subdev.entity,
+ ret = media_create_pad_link(&vpfe_dev->vpfe_ipipe.subdev.entity,
1, &vpfe_dev->vpfe_resizer.crop_resizer.subdev.entity,
0, flags);
if (ret < 0)
goto out_resizer_register;
- ret = media_entity_create_link(&vpfe_dev->vpfe_ipipeif.subdev.entity, 1,
+ ret = media_create_pad_link(&vpfe_dev->vpfe_ipipeif.subdev.entity, 1,
&vpfe_dev->vpfe_resizer.crop_resizer.subdev.entity,
0, flags);
if (ret < 0)
diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
index e54a7afd31de..7226553ceb2f 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -1259,7 +1259,7 @@ static int iss_register_entities(struct iss_device *iss)
goto done;
}
- ret = media_entity_create_link(&sensor->entity, 0, input, pad,
+ ret = media_create_pad_link(&sensor->entity, 0, input, pad,
flags);
if (ret < 0)
goto done;
@@ -1317,31 +1317,31 @@ static int iss_initialize_modules(struct iss_device *iss)
}
/* Connect the submodules. */
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&iss->csi2a.subdev.entity, CSI2_PAD_SOURCE,
&iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&iss->csi2b.subdev.entity, CSI2_PAD_SOURCE,
&iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
&iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
&iss->ipipe.subdev.entity, IPIPE_PAD_SINK, 0);
if (ret < 0)
goto error_link;
- ret = media_entity_create_link(
+ ret = media_create_pad_link(
&iss->ipipe.subdev.entity, IPIPE_PAD_SOURCE_VP,
&iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
if (ret < 0)
diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c
index e936cfc218cb..6b4dcbfa9425 100644
--- a/drivers/staging/media/omap4iss/iss_csi2.c
+++ b/drivers/staging/media/omap4iss/iss_csi2.c
@@ -1291,7 +1291,7 @@ static int csi2_init_entities(struct iss_csi2_device *csi2, const char *subname)
goto error_video;
/* Connect the CSI2 subdev to the video node. */
- ret = media_entity_create_link(&csi2->subdev.entity, CSI2_PAD_SOURCE,
+ ret = media_create_pad_link(&csi2->subdev.entity, CSI2_PAD_SOURCE,
&csi2->video_out.video.entity, 0, 0);
if (ret < 0)
goto error_link;
diff --git a/drivers/staging/media/omap4iss/iss_ipipeif.c b/drivers/staging/media/omap4iss/iss_ipipeif.c
index be5f80d7b5dc..44c432ef2ac5 100644
--- a/drivers/staging/media/omap4iss/iss_ipipeif.c
+++ b/drivers/staging/media/omap4iss/iss_ipipeif.c
@@ -762,7 +762,7 @@ static int ipipeif_init_entities(struct iss_ipipeif_device *ipipeif)
return ret;
/* Connect the IPIPEIF subdev to the video node. */
- ret = media_entity_create_link(&ipipeif->subdev.entity,
+ ret = media_create_pad_link(&ipipeif->subdev.entity,
IPIPEIF_PAD_SOURCE_ISIF_SF,
&ipipeif->video_out.video.entity, 0, 0);
if (ret < 0)
diff --git a/drivers/staging/media/omap4iss/iss_resizer.c b/drivers/staging/media/omap4iss/iss_resizer.c
index 91e724085dba..b659e465cb56 100644
--- a/drivers/staging/media/omap4iss/iss_resizer.c
+++ b/drivers/staging/media/omap4iss/iss_resizer.c
@@ -806,7 +806,7 @@ static int resizer_init_entities(struct iss_resizer_device *resizer)
return ret;
/* Connect the RESIZER subdev to the video node. */
- ret = media_entity_create_link(&resizer->subdev.entity,
+ ret = media_create_pad_link(&resizer->subdev.entity,
RESIZER_PAD_SOURCE_MEM,
&resizer->video_out.video.entity, 0, 0);
if (ret < 0)
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index af6646ddf6db..e0e4b014ce62 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -208,7 +208,7 @@ int media_entity_init(struct media_entity *entity, u16 num_pads,
struct media_pad *pads);
void media_entity_cleanup(struct media_entity *entity);
-int media_entity_create_link(struct media_entity *source, u16 source_pad,
+int media_create_pad_link(struct media_entity *source, u16 source_pad,
struct media_entity *sink, u16 sink_pad, u32 flags);
void __media_entity_remove_links(struct media_entity *entity);
void media_entity_remove_links(struct media_entity *entity);
--
2.4.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v8 11/55] [media] media: use entity.graph_obj.mdev instead of .parent
2015-08-30 3:06 [PATCH v8 00/55] MC next generation patches Mauro Carvalho Chehab
2015-08-30 3:06 ` [PATCH v8 01/55] [media] media: create a macro to get entity ID Mauro Carvalho Chehab
2015-08-30 3:06 ` [PATCH v8 10/55] [media] media: rename the function that create pad links Mauro Carvalho Chehab
@ 2015-08-30 3:06 ` Mauro Carvalho Chehab
2015-08-30 3:06 ` [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities Mauro Carvalho Chehab
2015-08-30 14:27 ` [PATCH v8 00/55] MC next generation patches Mauro Carvalho Chehab
4 siblings, 0 replies; 17+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-30 3:06 UTC (permalink / raw)
To: linux-arm-kernel
From: Javier Martinez Canillas <javier@osg.samsung.com>
The struct media_entity has a .parent field that stores a pointer
to the parent struct media_device. But recently a media_gobj was
embedded into the entities and since struct media_gojb already has
a pointer to a struct media_device in the .mdev field, the .parent
field becomes redundant and can be removed.
This patch replaces all the usage of .parent by .graph_obj.mdev so
that field will become unused and can be removed on a later patch.
No functional changes.
The transformation was made using the following coccinelle spatch:
@@
struct media_entity *me;
@@
- me->parent
+ me->graph_obj.mdev
@@
struct media_entity *link;
@@
- link->source->entity->parent
+ link->source->entity->graph_obj.mdev
@@
struct exynos_video_entity *ve;
@@
- ve->vdev.entity.parent
+ ve->vdev.entity.graph_obj.mdev
Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 0f3844470147..138b18416460 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -435,8 +435,8 @@ int __must_check media_device_register_entity(struct media_device *mdev,
int i;
/* Warn if we apparently re-register an entity */
- WARN_ON(entity->parent != NULL);
- entity->parent = mdev;
+ WARN_ON(entity->graph_obj.mdev != NULL);
+ entity->graph_obj.mdev = mdev;
spin_lock(&mdev->lock);
/* Initialize media_gobj embedded at the entity */
@@ -471,7 +471,7 @@ EXPORT_SYMBOL_GPL(media_device_register_entity);
void media_device_unregister_entity(struct media_entity *entity)
{
int i;
- struct media_device *mdev = entity->parent;
+ struct media_device *mdev = entity->graph_obj.mdev;
if (mdev = NULL)
return;
@@ -484,7 +484,7 @@ void media_device_unregister_entity(struct media_entity *entity)
media_gobj_remove(&entity->graph_obj);
list_del(&entity->list);
spin_unlock(&mdev->lock);
- entity->parent = NULL;
+ entity->graph_obj.mdev = NULL;
}
EXPORT_SYMBOL_GPL(media_device_unregister_entity);
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 35e52cd1fc5a..a23c93369a04 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -332,7 +332,7 @@ EXPORT_SYMBOL_GPL(media_entity_graph_walk_next);
__must_check int media_entity_pipeline_start(struct media_entity *entity,
struct media_pipeline *pipe)
{
- struct media_device *mdev = entity->parent;
+ struct media_device *mdev = entity->graph_obj.mdev;
struct media_entity_graph graph;
struct media_entity *entity_err = entity;
int ret;
@@ -387,7 +387,7 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity,
ret = entity->ops->link_validate(link);
if (ret < 0 && ret != -ENOIOCTLCMD) {
- dev_dbg(entity->parent->dev,
+ dev_dbg(entity->graph_obj.mdev->dev,
"link validation failed for \"%s\":%u -> \"%s\":%u, error %d\n",
link->source->entity->name,
link->source->index,
@@ -401,7 +401,7 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity,
if (!bitmap_full(active, entity->num_pads)) {
ret = -EPIPE;
- dev_dbg(entity->parent->dev,
+ dev_dbg(entity->graph_obj.mdev->dev,
"\"%s\":%u must be connected by an enabled link\n",
entity->name,
(unsigned)find_first_zero_bit(
@@ -454,7 +454,7 @@ EXPORT_SYMBOL_GPL(media_entity_pipeline_start);
*/
void media_entity_pipeline_stop(struct media_entity *entity)
{
- struct media_device *mdev = entity->parent;
+ struct media_device *mdev = entity->graph_obj.mdev;
struct media_entity_graph graph;
mutex_lock(&mdev->graph_mutex);
@@ -490,8 +490,8 @@ struct media_entity *media_entity_get(struct media_entity *entity)
if (entity = NULL)
return NULL;
- if (entity->parent->dev &&
- !try_module_get(entity->parent->dev->driver->owner))
+ if (entity->graph_obj.mdev->dev &&
+ !try_module_get(entity->graph_obj.mdev->dev->driver->owner))
return NULL;
return entity;
@@ -511,8 +511,8 @@ void media_entity_put(struct media_entity *entity)
if (entity = NULL)
return;
- if (entity->parent->dev)
- module_put(entity->parent->dev->driver->owner);
+ if (entity->graph_obj.mdev->dev)
+ module_put(entity->graph_obj.mdev->dev->driver->owner);
}
EXPORT_SYMBOL_GPL(media_entity_put);
@@ -561,7 +561,8 @@ media_create_pad_link(struct media_entity *source, u16 source_pad,
link->flags = flags;
/* Initialize graph object embedded at the new link */
- media_gobj_init(source->parent, MEDIA_GRAPH_LINK, &link->graph_obj);
+ media_gobj_init(source->graph_obj.mdev, MEDIA_GRAPH_LINK,
+ &link->graph_obj);
/* Create the backlink. Backlinks are used to help graph traversal and
* are not reported to userspace.
@@ -577,7 +578,8 @@ media_create_pad_link(struct media_entity *source, u16 source_pad,
backlink->flags = flags;
/* Initialize graph object embedded at the new link */
- media_gobj_init(sink->parent, MEDIA_GRAPH_LINK, &backlink->graph_obj);
+ media_gobj_init(sink->graph_obj.mdev, MEDIA_GRAPH_LINK,
+ &backlink->graph_obj);
link->reverse = backlink;
backlink->reverse = link;
@@ -629,12 +631,12 @@ EXPORT_SYMBOL_GPL(__media_entity_remove_links);
void media_entity_remove_links(struct media_entity *entity)
{
/* Do nothing if the entity is not registered. */
- if (entity->parent = NULL)
+ if (entity->graph_obj.mdev = NULL)
return;
- mutex_lock(&entity->parent->graph_mutex);
+ mutex_lock(&entity->graph_obj.mdev->graph_mutex);
__media_entity_remove_links(entity);
- mutex_unlock(&entity->parent->graph_mutex);
+ mutex_unlock(&entity->graph_obj.mdev->graph_mutex);
}
EXPORT_SYMBOL_GPL(media_entity_remove_links);
@@ -703,7 +705,7 @@ int __media_entity_setup_link(struct media_link *link, u32 flags)
(source->stream_count || sink->stream_count))
return -EBUSY;
- mdev = source->parent;
+ mdev = source->graph_obj.mdev;
if (mdev->link_notify) {
ret = mdev->link_notify(link, flags,
@@ -724,9 +726,9 @@ int media_entity_setup_link(struct media_link *link, u32 flags)
{
int ret;
- mutex_lock(&link->source->entity->parent->graph_mutex);
+ mutex_lock(&link->source->entity->graph_obj.mdev->graph_mutex);
ret = __media_entity_setup_link(link, flags);
- mutex_unlock(&link->source->entity->parent->graph_mutex);
+ mutex_unlock(&link->source->entity->graph_obj.mdev->graph_mutex);
return ret;
}
diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
index b7dc5ac66e36..3d9ccbf5f10f 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
@@ -288,7 +288,7 @@ static int isp_video_open(struct file *file)
goto rel_fh;
if (v4l2_fh_is_singular_file(file)) {
- mutex_lock(&me->parent->graph_mutex);
+ mutex_lock(&me->graph_obj.mdev->graph_mutex);
ret = fimc_pipeline_call(ve, open, me, true);
@@ -296,7 +296,7 @@ static int isp_video_open(struct file *file)
if (ret = 0)
me->use_count++;
- mutex_unlock(&me->parent->graph_mutex);
+ mutex_unlock(&me->graph_obj.mdev->graph_mutex);
}
if (!ret)
goto unlock;
@@ -312,7 +312,7 @@ static int isp_video_release(struct file *file)
struct fimc_isp *isp = video_drvdata(file);
struct fimc_is_video *ivc = &isp->video_capture;
struct media_entity *entity = &ivc->ve.vdev.entity;
- struct media_device *mdev = entity->parent;
+ struct media_device *mdev = entity->graph_obj.mdev;
mutex_lock(&isp->video_lock);
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
index e8f707d1729b..b2607da4ad14 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite.c
+++ b/drivers/media/platform/exynos4-is/fimc-lite.c
@@ -500,7 +500,7 @@ static int fimc_lite_open(struct file *file)
atomic_read(&fimc->out_path) != FIMC_IO_DMA)
goto unlock;
- mutex_lock(&me->parent->graph_mutex);
+ mutex_lock(&me->graph_obj.mdev->graph_mutex);
ret = fimc_pipeline_call(&fimc->ve, open, me, true);
@@ -508,7 +508,7 @@ static int fimc_lite_open(struct file *file)
if (ret = 0)
me->use_count++;
- mutex_unlock(&me->parent->graph_mutex);
+ mutex_unlock(&me->graph_obj.mdev->graph_mutex);
if (!ret) {
fimc_lite_clear_event_counters(fimc);
@@ -541,9 +541,9 @@ static int fimc_lite_release(struct file *file)
fimc_pipeline_call(&fimc->ve, close);
clear_bit(ST_FLITE_IN_USE, &fimc->state);
- mutex_lock(&entity->parent->graph_mutex);
+ mutex_lock(&entity->graph_obj.mdev->graph_mutex);
entity->use_count--;
- mutex_unlock(&entity->parent->graph_mutex);
+ mutex_unlock(&entity->graph_obj.mdev->graph_mutex);
}
_vb2_fop_release(file, NULL);
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index 3ba76940eef5..92dbade2fffc 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -1046,7 +1046,7 @@ static int __fimc_md_modify_pipeline(struct media_entity *entity, bool enable)
return ret;
}
-/* Locking: called with entity->parent->graph_mutex mutex held. */
+/* Locking: called with entity->graph_obj.mdev->graph_mutex mutex held. */
static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
{
struct media_entity *entity_err = entity;
diff --git a/drivers/media/platform/exynos4-is/media-dev.h b/drivers/media/platform/exynos4-is/media-dev.h
index 03214541f149..9a69913b31cb 100644
--- a/drivers/media/platform/exynos4-is/media-dev.h
+++ b/drivers/media/platform/exynos4-is/media-dev.h
@@ -164,8 +164,8 @@ struct fimc_sensor_info *source_to_sensor_info(struct fimc_source_info *si)
static inline struct fimc_md *entity_to_fimc_mdev(struct media_entity *me)
{
- return me->parent = NULL ? NULL :
- container_of(me->parent, struct fimc_md, media_dev);
+ return me->graph_obj.mdev = NULL ? NULL :
+ container_of(me->graph_obj.mdev, struct fimc_md, media_dev);
}
static inline struct fimc_md *notifier_to_fimc_md(struct v4l2_async_notifier *n)
@@ -175,12 +175,12 @@ static inline struct fimc_md *notifier_to_fimc_md(struct v4l2_async_notifier *n)
static inline void fimc_md_graph_lock(struct exynos_video_entity *ve)
{
- mutex_lock(&ve->vdev.entity.parent->graph_mutex);
+ mutex_lock(&ve->vdev.entity.graph_obj.mdev->graph_mutex);
}
static inline void fimc_md_graph_unlock(struct exynos_video_entity *ve)
{
- mutex_unlock(&ve->vdev.entity.parent->graph_mutex);
+ mutex_unlock(&ve->vdev.entity.graph_obj.mdev->graph_mutex);
}
int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on);
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index 6351f35b0a65..aa13b17d19a0 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -787,7 +787,7 @@ int omap3isp_pipeline_pm_use(struct media_entity *entity, int use)
int change = use ? 1 : -1;
int ret;
- mutex_lock(&entity->parent->graph_mutex);
+ mutex_lock(&entity->graph_obj.mdev->graph_mutex);
/* Apply use count to node. */
entity->use_count += change;
@@ -798,7 +798,7 @@ int omap3isp_pipeline_pm_use(struct media_entity *entity, int use)
if (ret < 0)
entity->use_count -= change;
- mutex_unlock(&entity->parent->graph_mutex);
+ mutex_unlock(&entity->graph_obj.mdev->graph_mutex);
return ret;
}
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
index 6c89dc40df85..4c367352b1f7 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -226,7 +226,7 @@ static int isp_video_get_graph_data(struct isp_video *video,
{
struct media_entity_graph graph;
struct media_entity *entity = &video->video.entity;
- struct media_device *mdev = entity->parent;
+ struct media_device *mdev = entity->graph_obj.mdev;
struct isp_video *far_end = NULL;
mutex_lock(&mdev->graph_mutex);
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
index debe4e539df6..1f94c1a54e00 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -409,7 +409,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,
{
struct media_entity_graph graph;
struct media_entity *entity = &video->video.entity;
- struct media_device *mdev = entity->parent;
+ struct media_device *mdev = entity->graph_obj.mdev;
unsigned int i;
int ret;
diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
index f7f9aa353a55..92e8116dc28f 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.c
+++ b/drivers/media/platform/xilinx/xilinx-dma.c
@@ -181,7 +181,7 @@ static int xvip_pipeline_validate(struct xvip_pipeline *pipe,
{
struct media_entity_graph graph;
struct media_entity *entity = &start->video.entity;
- struct media_device *mdev = entity->parent;
+ struct media_device *mdev = entity->graph_obj.mdev;
unsigned int num_inputs = 0;
unsigned int num_outputs = 0;
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index 61a8d5beff58..92573fa852a9 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -130,7 +130,7 @@ __vpfe_video_get_format(struct vpfe_video_device *video,
static void vpfe_prepare_pipeline(struct vpfe_video_device *video)
{
struct media_entity *entity = &video->video_dev.entity;
- struct media_device *mdev = entity->parent;
+ struct media_device *mdev = entity->graph_obj.mdev;
struct vpfe_pipeline *pipe = &video->pipe;
struct vpfe_video_device *far_end = NULL;
struct media_entity_graph graph;
@@ -288,7 +288,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline *pipe)
else
entity = &pipe->inputs[0]->video_dev.entity;
- mdev = entity->parent;
+ mdev = entity->graph_obj.mdev;
mutex_lock(&mdev->graph_mutex);
media_entity_graph_walk_start(&graph, entity);
while ((entity = media_entity_graph_walk_next(&graph))) {
@@ -328,7 +328,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe)
else
entity = &pipe->inputs[0]->video_dev.entity;
- mdev = entity->parent;
+ mdev = entity->graph_obj.mdev;
mutex_lock(&mdev->graph_mutex);
media_entity_graph_walk_start(&graph, entity);
diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
index 7226553ceb2f..40591963b42b 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -494,7 +494,7 @@ int omap4iss_pipeline_pm_use(struct media_entity *entity, int use)
int change = use ? 1 : -1;
int ret;
- mutex_lock(&entity->parent->graph_mutex);
+ mutex_lock(&entity->graph_obj.mdev->graph_mutex);
/* Apply use count to node. */
entity->use_count += change;
@@ -505,7 +505,7 @@ int omap4iss_pipeline_pm_use(struct media_entity *entity, int use)
if (ret < 0)
entity->use_count -= change;
- mutex_unlock(&entity->parent->graph_mutex);
+ mutex_unlock(&entity->graph_obj.mdev->graph_mutex);
return ret;
}
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
index 25e9e7a6b99d..45a3f2d778fc 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -207,7 +207,7 @@ iss_video_far_end(struct iss_video *video)
{
struct media_entity_graph graph;
struct media_entity *entity = &video->video.entity;
- struct media_device *mdev = entity->parent;
+ struct media_device *mdev = entity->graph_obj.mdev;
struct iss_video *far_end = NULL;
mutex_lock(&mdev->graph_mutex);
--
2.4.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities
2015-08-30 3:06 [PATCH v8 00/55] MC next generation patches Mauro Carvalho Chehab
` (2 preceding siblings ...)
2015-08-30 3:06 ` [PATCH v8 11/55] [media] media: use entity.graph_obj.mdev instead of .parent Mauro Carvalho Chehab
@ 2015-08-30 3:06 ` Mauro Carvalho Chehab
2015-10-11 21:07 ` Sakari Ailus
2015-12-06 2:16 ` [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities Laurent Pinchart
2015-08-30 14:27 ` [PATCH v8 00/55] MC next generation patches Mauro Carvalho Chehab
4 siblings, 2 replies; 17+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-30 3:06 UTC (permalink / raw)
To: linux-arm-kernel
Instead of relying on media subtype, use the new macros to detect
if an entity is a subdev or an A/V DMA entity.
Please note that most drivers assume that there's just AV_DMA or
V4L2 subdevs. This is not true anymore, as we've added MC support
for DVB, and there are plans to add support for ALSA and FB/DRM
too.
Ok, on the current pipelines supported by those drivers, just V4L
stuff are there, but, assuming that some day a pipeline that also
works with other subsystems will ever added, it is better to add
explicit checks for the AV_DMA stuff.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/platform/exynos4-is/common.c b/drivers/media/platform/exynos4-is/common.c
index 0eb34ecb8ee4..8c9a29e0e294 100644
--- a/drivers/media/platform/exynos4-is/common.c
+++ b/drivers/media/platform/exynos4-is/common.c
@@ -22,8 +22,7 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)
while (pad->flags & MEDIA_PAD_FL_SINK) {
/* source pad */
pad = media_entity_remote_pad(pad);
- if (pad = NULL ||
- media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
break;
sd = media_entity_to_v4l2_subdev(pad->entity);
diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
index 0627a93b2f3b..e9810fee4c30 100644
--- a/drivers/media/platform/exynos4-is/fimc-capture.c
+++ b/drivers/media/platform/exynos4-is/fimc-capture.c
@@ -1141,8 +1141,7 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc)
}
}
- if (src_pad = NULL ||
- media_entity_type(src_pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!src_pad || !is_media_entity_v4l2_subdev(src_pad->entity))
break;
/* Don't call FIMC subdev operation to avoid nested locking */
@@ -1397,7 +1396,7 @@ static int fimc_link_setup(struct media_entity *entity,
struct fimc_vid_cap *vc = &fimc->vid_cap;
struct v4l2_subdev *sensor;
- if (media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!is_media_entity_v4l2_subdev(remote->entity))
return -EINVAL;
if (WARN_ON(fimc = NULL))
diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
index 3d9ccbf5f10f..5fbaf5e39903 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
@@ -467,8 +467,7 @@ static int isp_video_pipeline_validate(struct fimc_isp *isp)
/* Retrieve format at the source pad */
pad = media_entity_remote_pad(pad);
- if (pad = NULL ||
- media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
break;
sd = media_entity_to_v4l2_subdev(pad->entity);
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
index b2607da4ad14..c2327147b360 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite.c
+++ b/drivers/media/platform/exynos4-is/fimc-lite.c
@@ -814,8 +814,7 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc)
}
/* Retrieve format at the source pad */
pad = media_entity_remote_pad(pad);
- if (pad = NULL ||
- media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
break;
sd = media_entity_to_v4l2_subdev(pad->entity);
@@ -988,7 +987,6 @@ static int fimc_lite_link_setup(struct media_entity *entity,
{
struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
struct fimc_lite *fimc = v4l2_get_subdevdata(sd);
- unsigned int remote_ent_type = media_entity_type(remote->entity);
int ret = 0;
if (WARN_ON(fimc = NULL))
@@ -1000,7 +998,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
switch (local->index) {
case FLITE_SD_PAD_SINK:
- if (remote_ent_type != MEDIA_ENT_T_V4L2_SUBDEV) {
+ if (!is_media_entity_v4l2_subdev(remote->entity)) {
ret = -EINVAL;
break;
}
@@ -1018,7 +1016,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
case FLITE_SD_PAD_SOURCE_DMA:
if (!(flags & MEDIA_LNK_FL_ENABLED))
atomic_set(&fimc->out_path, FIMC_IO_NONE);
- else if (remote_ent_type = MEDIA_ENT_T_DEVNODE)
+ else if (is_media_entity_v4l2_io(remote->entity))
atomic_set(&fimc->out_path, FIMC_IO_DMA);
else
ret = -EINVAL;
@@ -1027,7 +1025,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
case FLITE_SD_PAD_SOURCE_ISP:
if (!(flags & MEDIA_LNK_FL_ENABLED))
atomic_set(&fimc->out_path, FIMC_IO_NONE);
- else if (remote_ent_type = MEDIA_ENT_T_V4L2_SUBDEV)
+ else if (is_media_entity_v4l2_subdev(remote->entity))
atomic_set(&fimc->out_path, FIMC_IO_ISP);
else
ret = -EINVAL;
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index 92dbade2fffc..4a25df9dd869 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -88,8 +88,7 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,
break;
}
- if (pad = NULL ||
- media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
break;
sd = media_entity_to_v4l2_subdev(pad->entity);
@@ -1062,7 +1061,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
media_entity_graph_walk_start(&graph, entity);
while ((entity = media_entity_graph_walk_next(&graph))) {
- if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
+ if (!is_media_entity_v4l2_io(entity))
continue;
ret = __fimc_md_modify_pipeline(entity, enable);
@@ -1076,7 +1075,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
media_entity_graph_walk_start(&graph, entity_err);
while ((entity_err = media_entity_graph_walk_next(&graph))) {
- if (media_entity_type(entity_err) != MEDIA_ENT_T_DEVNODE)
+ if (!is_media_entity_v4l2_io(entity_err))
continue;
__fimc_md_modify_pipeline(entity_err, !enable);
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index 69e7733d36cd..cb8ac90086c1 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -691,7 +691,7 @@ static int isp_pipeline_pm_use_count(struct media_entity *entity)
media_entity_graph_walk_start(&graph, entity);
while ((entity = media_entity_graph_walk_next(&graph))) {
- if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
+ if (is_media_entity_v4l2_io(entity))
use += entity->use_count;
}
@@ -714,7 +714,7 @@ static int isp_pipeline_pm_power_one(struct media_entity *entity, int change)
struct v4l2_subdev *subdev;
int ret;
- subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
+ subdev = is_media_entity_v4l2_subdev(entity)
? media_entity_to_v4l2_subdev(entity) : NULL;
if (entity->use_count = 0 && change > 0 && subdev != NULL) {
@@ -754,7 +754,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)
media_entity_graph_walk_start(&graph, entity);
while (!ret && (entity = media_entity_graph_walk_next(&graph)))
- if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
+ if (is_media_entity_v4l2_subdev(entity))
ret = isp_pipeline_pm_power_one(entity, change);
if (!ret)
@@ -764,7 +764,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)
while ((first = media_entity_graph_walk_next(&graph))
&& first != entity)
- if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
+ if (is_media_entity_v4l2_subdev(first))
isp_pipeline_pm_power_one(first, -change);
return ret;
@@ -897,8 +897,7 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
break;
pad = media_entity_remote_pad(pad);
- if (pad = NULL ||
- media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
break;
entity = pad->entity;
@@ -988,8 +987,7 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe)
break;
pad = media_entity_remote_pad(pad);
- if (pad = NULL ||
- media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
break;
entity = pad->entity;
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
index 4c367352b1f7..52843ac2a9ca 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -210,8 +210,7 @@ isp_video_remote_subdev(struct isp_video *video, u32 *pad)
remote = media_entity_remote_pad(&video->pad);
- if (remote = NULL ||
- media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
return NULL;
if (pad)
@@ -243,7 +242,7 @@ static int isp_video_get_graph_data(struct isp_video *video,
if (entity = &video->video.entity)
continue;
- if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
+ if (!is_media_entity_v4l2_io(entity))
continue;
__video = to_isp_video(media_entity_to_video_device(entity));
@@ -917,7 +916,7 @@ static int isp_video_check_external_subdevs(struct isp_video *video,
return -EINVAL;
}
- if (media_entity_type(source) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!is_media_entity_v4l2_subdev(source))
return 0;
pipe->external = media_entity_to_v4l2_subdev(source);
diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
index eae667eab1b9..fb5b016cc0a1 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -837,7 +837,7 @@ static int camif_pipeline_validate(struct camif_dev *camif)
/* Retrieve format at the sensor subdev source pad */
pad = media_entity_remote_pad(&camif->pads[0]);
- if (!pad || media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
return -EPIPE;
src_fmt.pad = pad->index;
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
index 1f94c1a54e00..f74158224b93 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -160,8 +160,7 @@ vsp1_video_remote_subdev(struct media_pad *local, u32 *pad)
struct media_pad *remote;
remote = media_entity_remote_pad(local);
- if (remote = NULL ||
- media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
return NULL;
if (pad)
@@ -326,7 +325,7 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
return -EPIPE;
/* We've reached a video node, that shouldn't have happened. */
- if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!is_media_entity_v4l2_subdev(pad->entity))
return -EPIPE;
entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
@@ -423,7 +422,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,
struct vsp1_rwpf *rwpf;
struct vsp1_entity *e;
- if (media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV) {
+ if (is_media_entity_v4l2_io(entity)) {
pipe->num_video++;
continue;
}
@@ -692,7 +691,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
pad = media_entity_remote_pad(&input->pads[RWPF_PAD_SOURCE]);
while (pad) {
- if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!is_media_entity_v4l2_subdev(pad->entity))
break;
entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
index 88cd789cdaf7..8e14841bf445 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.c
+++ b/drivers/media/platform/xilinx/xilinx-dma.c
@@ -49,8 +49,7 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad)
struct media_pad *remote;
remote = media_entity_remote_pad(local);
- if (remote = NULL ||
- media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
return NULL;
if (pad)
@@ -113,8 +112,7 @@ static int xvip_pipeline_start_stop(struct xvip_pipeline *pipe, bool start)
break;
pad = media_entity_remote_pad(pad);
- if (pad = NULL ||
- media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
break;
entity = pad->entity;
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index e6e1115d8215..60da43772de9 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -526,7 +526,7 @@ static int
v4l2_subdev_link_validate_get_format(struct media_pad *pad,
struct v4l2_subdev_format *fmt)
{
- if (media_entity_type(pad->entity) = MEDIA_ENT_T_V4L2_SUBDEV) {
+ if (is_media_entity_v4l2_subdev(pad->entity)) {
struct v4l2_subdev *sd media_entity_to_v4l2_subdev(pad->entity);
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index 92573fa852a9..16763e0831f2 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -148,7 +148,7 @@ static void vpfe_prepare_pipeline(struct vpfe_video_device *video)
while ((entity = media_entity_graph_walk_next(&graph))) {
if (entity = &video->video_dev.entity)
continue;
- if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
+ if ((!is_media_entity_v4l2_io(remote->entity))
continue;
far_end = to_vpfe_video(media_entity_to_video_device(entity));
if (far_end->type = V4L2_BUF_TYPE_VIDEO_OUTPUT)
@@ -293,7 +293,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline *pipe)
media_entity_graph_walk_start(&graph, entity);
while ((entity = media_entity_graph_walk_next(&graph))) {
- if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
+ if !is_media_entity_v4l2_subdev(entity))
continue;
subdev = media_entity_to_v4l2_subdev(entity);
ret = v4l2_subdev_call(subdev, video, s_stream, 1);
@@ -334,7 +334,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe)
while ((entity = media_entity_graph_walk_next(&graph))) {
- if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
+ if (!is_media_entity_v4l2_subdev(entity))
continue;
subdev = media_entity_to_v4l2_subdev(entity);
ret = v4l2_subdev_call(subdev, video, s_stream, 0);
diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
index 40591963b42b..44b88ff3ba83 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -397,7 +397,7 @@ static int iss_pipeline_pm_use_count(struct media_entity *entity)
media_entity_graph_walk_start(&graph, entity);
while ((entity = media_entity_graph_walk_next(&graph))) {
- if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
+ if (is_media_entity_v4l2_io(entity))
use += entity->use_count;
}
@@ -419,7 +419,7 @@ static int iss_pipeline_pm_power_one(struct media_entity *entity, int change)
{
struct v4l2_subdev *subdev;
- subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
+ subdev = is_media_entity_v4l2_subdev(entity)
? media_entity_to_v4l2_subdev(entity) : NULL;
if (entity->use_count = 0 && change > 0 && subdev != NULL) {
@@ -461,7 +461,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)
media_entity_graph_walk_start(&graph, entity);
while (!ret && (entity = media_entity_graph_walk_next(&graph)))
- if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
+ if (is_media_entity_v4l2_subdev(entity))
ret = iss_pipeline_pm_power_one(entity, change);
if (!ret)
@@ -471,7 +471,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)
while ((first = media_entity_graph_walk_next(&graph))
&& first != entity)
- if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
+ if (is_media_entity_v4l2_subdev(first))
iss_pipeline_pm_power_one(first, -change);
return ret;
@@ -590,8 +590,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe,
break;
pad = media_entity_remote_pad(pad);
- if (pad = NULL ||
- media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
break;
entity = pad->entity;
@@ -658,8 +657,7 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,
break;
pad = media_entity_remote_pad(pad);
- if (pad = NULL ||
- media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
break;
entity = pad->entity;
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
index 45a3f2d778fc..cbe5783735dc 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -191,8 +191,7 @@ iss_video_remote_subdev(struct iss_video *video, u32 *pad)
remote = media_entity_remote_pad(&video->pad);
- if (remote = NULL ||
- media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
+ if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
return NULL;
if (pad)
@@ -217,7 +216,7 @@ iss_video_far_end(struct iss_video *video)
if (entity = &video->video.entity)
continue;
- if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
+ if (!is_media_entity_v4l2_io(entity))
continue;
far_end = to_iss_video(media_entity_to_video_device(entity));
--
2.4.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v8 00/55] MC next generation patches
2015-08-30 3:06 [PATCH v8 00/55] MC next generation patches Mauro Carvalho Chehab
` (3 preceding siblings ...)
2015-08-30 3:06 ` [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities Mauro Carvalho Chehab
@ 2015-08-30 14:27 ` Mauro Carvalho Chehab
4 siblings, 0 replies; 17+ messages in thread
From: Mauro Carvalho Chehab @ 2015-08-30 14:27 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: devel, Lars-Peter Clausen, Sylwester Nawrocki, linux-sh,
Greg Kroah-Hartman, Shuah Khan, Mauro Carvalho Chehab,
Hans Verkuil, Javier Martinez Canillas, linux-samsung-soc,
Laurent Pinchart, Sakari Ailus, linux-api, linux-arm-kernel
Em Sun, 30 Aug 2015 00:06:11 -0300
Mauro Carvalho Chehab <mchehab@osg.samsung.com> escreveu:
> That's the 8th version of the MC next generation patches.
>
> Differences from version 7:
>
> - Patches reworked to make the reviewers happy;
> - Bug fixes;
> - ALSA changes got their own separate patches;
> - Javier patches got integrated into this series;
> - media-entity.h structs are now properly documented;
> - Tested on both au0828 and omap3isp.
>
> Due to the complexity of this change, other platform drivers may
> require some fixes.
>
> As the patch series sent before, this is not meant to be sent
> upstream yet. Its goal is to merge it for Kernel 4.4, in order to
> give people enough time to review and fix pending issues.
As on the previous series, the patches are available on my experimental
tree:
http://git.linuxtv.org/cgit.cgi/mchehab/experimental.git/log/?h=mc_next_gen
There's one additional patch there that removes the backlinks from G_TOPOLOGY
ioctl. I'll be posting it in separate at the ML.
I also added a new branch:
http://git.linuxtv.org/cgit.cgi/mchehab/experimental.git/log/?h=mc_next_gen_test
Based on the first one. It contains a hack for au0828 that exposes the tuner
also via subdev devnode, and reduces the number of output pads of the DVB
demux to just 5, as the default is too high to produce a .dot file that
would be useful. Of course, this patch should never leave my experimental
tree ;)
There are a few other from Javier there meant to allow testing the omap3isp
on my Beaglebone (that doesn't have any sensor on it) and on his omap3
devices.
I added support at the mc_nextgen_test tool to produce Graphviz .dot
files. It is still experimental, but it is good enough to already produce
some useful graphs. The newest version is at:
http://git.linuxtv.org/cgit.cgi/mchehab/experimental-v4l-utils.git/log/?h=mc-next-gen
I added some graphs produced by it at:
https://mchehab.fedorapeople.org/mc-next-gen/
Regards,
Mauro
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v8 01/55] [media] media: create a macro to get entity ID
2015-08-30 3:06 ` [PATCH v8 01/55] [media] media: create a macro to get entity ID Mauro Carvalho Chehab
@ 2015-09-10 13:58 ` Javier Martinez Canillas
2015-12-06 3:20 ` Laurent Pinchart
1 sibling, 0 replies; 17+ messages in thread
From: Javier Martinez Canillas @ 2015-09-10 13:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Media Mailing List, Mauro Carvalho Chehab, Laurent Pinchart,
linux-sh
On Sun, Aug 30, 2015 at 5:06 AM, Mauro Carvalho Chehab
<mchehab@osg.samsung.com> wrote:
> Instead of accessing directly entity.id, let's create a macro,
> as this field will be moved into a common struct later on.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Best regards,
Javier
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v8 10/55] [media] media: rename the function that create pad links
2015-08-30 3:06 ` [PATCH v8 10/55] [media] media: rename the function that create pad links Mauro Carvalho Chehab
@ 2015-09-10 14:16 ` Javier Martinez Canillas
0 siblings, 0 replies; 17+ messages in thread
From: Javier Martinez Canillas @ 2015-09-10 14:16 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Aug 30, 2015 at 5:06 AM, Mauro Carvalho Chehab
<mchehab@osg.samsung.com> wrote:
> With the new API, a link can be either between two PADs or between an interface
> and an entity. So, we need to use a better name for the function that create
> links between two pads.
>
> So, rename the such function to media_create_pad_link().
>
> No functional changes.
>
> This patch was created via this shell script:
> for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' -type f) ; do sed s,media_entity_create_link,media_create_pad_link,g <$i >a && mv a $i; done
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Best regards,
Javier
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities
2015-08-30 3:06 ` [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities Mauro Carvalho Chehab
@ 2015-10-11 21:07 ` Sakari Ailus
2015-10-12 0:56 ` Mauro Carvalho Chehab
2015-12-06 2:16 ` [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities Laurent Pinchart
1 sibling, 1 reply; 17+ messages in thread
From: Sakari Ailus @ 2015-10-11 21:07 UTC (permalink / raw)
To: linux-arm-kernel
Hi Mauro,
On Sun, Aug 30, 2015 at 12:06:43AM -0300, Mauro Carvalho Chehab wrote:
> Instead of relying on media subtype, use the new macros to detect
> if an entity is a subdev or an A/V DMA entity.
>
> Please note that most drivers assume that there's just AV_DMA or
> V4L2 subdevs. This is not true anymore, as we've added MC support
> for DVB, and there are plans to add support for ALSA and FB/DRM
> too.
>
> Ok, on the current pipelines supported by those drivers, just V4L
> stuff are there, but, assuming that some day a pipeline that also
> works with other subsystems will ever added, it is better to add
> explicit checks for the AV_DMA stuff.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>
> diff --git a/drivers/media/platform/exynos4-is/common.c b/drivers/media/platform/exynos4-is/common.c
> index 0eb34ecb8ee4..8c9a29e0e294 100644
> --- a/drivers/media/platform/exynos4-is/common.c
> +++ b/drivers/media/platform/exynos4-is/common.c
> @@ -22,8 +22,7 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)
> while (pad->flags & MEDIA_PAD_FL_SINK) {
> /* source pad */
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> sd = media_entity_to_v4l2_subdev(pad->entity);
> diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
> index 0627a93b2f3b..e9810fee4c30 100644
> --- a/drivers/media/platform/exynos4-is/fimc-capture.c
> +++ b/drivers/media/platform/exynos4-is/fimc-capture.c
> @@ -1141,8 +1141,7 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc)
> }
> }
>
> - if (src_pad = NULL ||
> - media_entity_type(src_pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!src_pad || !is_media_entity_v4l2_subdev(src_pad->entity))
> break;
>
> /* Don't call FIMC subdev operation to avoid nested locking */
> @@ -1397,7 +1396,7 @@ static int fimc_link_setup(struct media_entity *entity,
> struct fimc_vid_cap *vc = &fimc->vid_cap;
> struct v4l2_subdev *sensor;
>
> - if (media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!is_media_entity_v4l2_subdev(remote->entity))
> return -EINVAL;
>
> if (WARN_ON(fimc = NULL))
> diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> index 3d9ccbf5f10f..5fbaf5e39903 100644
> --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
> +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> @@ -467,8 +467,7 @@ static int isp_video_pipeline_validate(struct fimc_isp *isp)
>
> /* Retrieve format at the source pad */
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> sd = media_entity_to_v4l2_subdev(pad->entity);
> diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
> index b2607da4ad14..c2327147b360 100644
> --- a/drivers/media/platform/exynos4-is/fimc-lite.c
> +++ b/drivers/media/platform/exynos4-is/fimc-lite.c
> @@ -814,8 +814,7 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc)
> }
> /* Retrieve format at the source pad */
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> sd = media_entity_to_v4l2_subdev(pad->entity);
> @@ -988,7 +987,6 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> {
> struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
> struct fimc_lite *fimc = v4l2_get_subdevdata(sd);
> - unsigned int remote_ent_type = media_entity_type(remote->entity);
> int ret = 0;
>
> if (WARN_ON(fimc = NULL))
> @@ -1000,7 +998,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
>
> switch (local->index) {
> case FLITE_SD_PAD_SINK:
> - if (remote_ent_type != MEDIA_ENT_T_V4L2_SUBDEV) {
> + if (!is_media_entity_v4l2_subdev(remote->entity)) {
> ret = -EINVAL;
> break;
> }
> @@ -1018,7 +1016,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> case FLITE_SD_PAD_SOURCE_DMA:
> if (!(flags & MEDIA_LNK_FL_ENABLED))
> atomic_set(&fimc->out_path, FIMC_IO_NONE);
> - else if (remote_ent_type = MEDIA_ENT_T_DEVNODE)
> + else if (is_media_entity_v4l2_io(remote->entity))
> atomic_set(&fimc->out_path, FIMC_IO_DMA);
> else
> ret = -EINVAL;
> @@ -1027,7 +1025,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> case FLITE_SD_PAD_SOURCE_ISP:
> if (!(flags & MEDIA_LNK_FL_ENABLED))
> atomic_set(&fimc->out_path, FIMC_IO_NONE);
> - else if (remote_ent_type = MEDIA_ENT_T_V4L2_SUBDEV)
> + else if (is_media_entity_v4l2_subdev(remote->entity))
> atomic_set(&fimc->out_path, FIMC_IO_ISP);
> else
> ret = -EINVAL;
> diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
> index 92dbade2fffc..4a25df9dd869 100644
> --- a/drivers/media/platform/exynos4-is/media-dev.c
> +++ b/drivers/media/platform/exynos4-is/media-dev.c
> @@ -88,8 +88,7 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,
> break;
> }
>
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
> sd = media_entity_to_v4l2_subdev(pad->entity);
>
> @@ -1062,7 +1061,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
> media_entity_graph_walk_start(&graph, entity);
>
> while ((entity = media_entity_graph_walk_next(&graph))) {
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if (!is_media_entity_v4l2_io(entity))
> continue;
>
> ret = __fimc_md_modify_pipeline(entity, enable);
> @@ -1076,7 +1075,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
> media_entity_graph_walk_start(&graph, entity_err);
>
> while ((entity_err = media_entity_graph_walk_next(&graph))) {
> - if (media_entity_type(entity_err) != MEDIA_ENT_T_DEVNODE)
> + if (!is_media_entity_v4l2_io(entity_err))
> continue;
>
> __fimc_md_modify_pipeline(entity_err, !enable);
> diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
> index 69e7733d36cd..cb8ac90086c1 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -691,7 +691,7 @@ static int isp_pipeline_pm_use_count(struct media_entity *entity)
> media_entity_graph_walk_start(&graph, entity);
>
> while ((entity = media_entity_graph_walk_next(&graph))) {
> - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_io(entity))
> use += entity->use_count;
> }
>
> @@ -714,7 +714,7 @@ static int isp_pipeline_pm_power_one(struct media_entity *entity, int change)
> struct v4l2_subdev *subdev;
> int ret;
>
> - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> + subdev = is_media_entity_v4l2_subdev(entity)
> ? media_entity_to_v4l2_subdev(entity) : NULL;
>
> if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> @@ -754,7 +754,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)
> media_entity_graph_walk_start(&graph, entity);
>
> while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_subdev(entity))
> ret = isp_pipeline_pm_power_one(entity, change);
>
> if (!ret)
> @@ -764,7 +764,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)
>
> while ((first = media_entity_graph_walk_next(&graph))
> && first != entity)
> - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_subdev(first))
> isp_pipeline_pm_power_one(first, -change);
>
> return ret;
> @@ -897,8 +897,7 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
> break;
>
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = pad->entity;
> @@ -988,8 +987,7 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe)
> break;
>
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = pad->entity;
> diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
> index 4c367352b1f7..52843ac2a9ca 100644
> --- a/drivers/media/platform/omap3isp/ispvideo.c
> +++ b/drivers/media/platform/omap3isp/ispvideo.c
> @@ -210,8 +210,7 @@ isp_video_remote_subdev(struct isp_video *video, u32 *pad)
>
> remote = media_entity_remote_pad(&video->pad);
>
> - if (remote = NULL ||
> - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> return NULL;
>
> if (pad)
> @@ -243,7 +242,7 @@ static int isp_video_get_graph_data(struct isp_video *video,
> if (entity = &video->video.entity)
> continue;
>
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if (!is_media_entity_v4l2_io(entity))
> continue;
>
> __video = to_isp_video(media_entity_to_video_device(entity));
> @@ -917,7 +916,7 @@ static int isp_video_check_external_subdevs(struct isp_video *video,
> return -EINVAL;
> }
>
> - if (media_entity_type(source) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!is_media_entity_v4l2_subdev(source))
> return 0;
>
> pipe->external = media_entity_to_v4l2_subdev(source);
> diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
> index eae667eab1b9..fb5b016cc0a1 100644
> --- a/drivers/media/platform/s3c-camif/camif-capture.c
> +++ b/drivers/media/platform/s3c-camif/camif-capture.c
> @@ -837,7 +837,7 @@ static int camif_pipeline_validate(struct camif_dev *camif)
>
> /* Retrieve format at the sensor subdev source pad */
> pad = media_entity_remote_pad(&camif->pads[0]);
> - if (!pad || media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> return -EPIPE;
>
> src_fmt.pad = pad->index;
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
> index 1f94c1a54e00..f74158224b93 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -160,8 +160,7 @@ vsp1_video_remote_subdev(struct media_pad *local, u32 *pad)
> struct media_pad *remote;
>
> remote = media_entity_remote_pad(local);
> - if (remote = NULL ||
> - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> return NULL;
>
> if (pad)
> @@ -326,7 +325,7 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
> return -EPIPE;
>
> /* We've reached a video node, that shouldn't have happened. */
> - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!is_media_entity_v4l2_subdev(pad->entity))
> return -EPIPE;
>
> entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> @@ -423,7 +422,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,
> struct vsp1_rwpf *rwpf;
> struct vsp1_entity *e;
>
> - if (media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV) {
> + if (is_media_entity_v4l2_io(entity)) {
> pipe->num_video++;
> continue;
> }
> @@ -692,7 +691,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
> pad = media_entity_remote_pad(&input->pads[RWPF_PAD_SOURCE]);
>
> while (pad) {
> - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
> index 88cd789cdaf7..8e14841bf445 100644
> --- a/drivers/media/platform/xilinx/xilinx-dma.c
> +++ b/drivers/media/platform/xilinx/xilinx-dma.c
> @@ -49,8 +49,7 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad)
> struct media_pad *remote;
>
> remote = media_entity_remote_pad(local);
> - if (remote = NULL ||
> - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> return NULL;
>
> if (pad)
> @@ -113,8 +112,7 @@ static int xvip_pipeline_start_stop(struct xvip_pipeline *pipe, bool start)
> break;
>
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = pad->entity;
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index e6e1115d8215..60da43772de9 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -526,7 +526,7 @@ static int
> v4l2_subdev_link_validate_get_format(struct media_pad *pad,
> struct v4l2_subdev_format *fmt)
> {
> - if (media_entity_type(pad->entity) = MEDIA_ENT_T_V4L2_SUBDEV) {
> + if (is_media_entity_v4l2_subdev(pad->entity)) {
> struct v4l2_subdev *sd > media_entity_to_v4l2_subdev(pad->entity);
>
> diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> index 92573fa852a9..16763e0831f2 100644
> --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
> +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> @@ -148,7 +148,7 @@ static void vpfe_prepare_pipeline(struct vpfe_video_device *video)
> while ((entity = media_entity_graph_walk_next(&graph))) {
> if (entity = &video->video_dev.entity)
> continue;
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if ((!is_media_entity_v4l2_io(remote->entity))
> continue;
> far_end = to_vpfe_video(media_entity_to_video_device(entity));
> if (far_end->type = V4L2_BUF_TYPE_VIDEO_OUTPUT)
> @@ -293,7 +293,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline *pipe)
> media_entity_graph_walk_start(&graph, entity);
> while ((entity = media_entity_graph_walk_next(&graph))) {
>
> - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> + if !is_media_entity_v4l2_subdev(entity))
> continue;
> subdev = media_entity_to_v4l2_subdev(entity);
> ret = v4l2_subdev_call(subdev, video, s_stream, 1);
> @@ -334,7 +334,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe)
>
> while ((entity = media_entity_graph_walk_next(&graph))) {
>
> - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> + if (!is_media_entity_v4l2_subdev(entity))
> continue;
> subdev = media_entity_to_v4l2_subdev(entity);
> ret = v4l2_subdev_call(subdev, video, s_stream, 0);
> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> index 40591963b42b..44b88ff3ba83 100644
> --- a/drivers/staging/media/omap4iss/iss.c
> +++ b/drivers/staging/media/omap4iss/iss.c
> @@ -397,7 +397,7 @@ static int iss_pipeline_pm_use_count(struct media_entity *entity)
> media_entity_graph_walk_start(&graph, entity);
>
> while ((entity = media_entity_graph_walk_next(&graph))) {
> - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_io(entity))
> use += entity->use_count;
> }
>
> @@ -419,7 +419,7 @@ static int iss_pipeline_pm_power_one(struct media_entity *entity, int change)
> {
> struct v4l2_subdev *subdev;
>
> - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> + subdev = is_media_entity_v4l2_subdev(entity)
> ? media_entity_to_v4l2_subdev(entity) : NULL;
>
> if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> @@ -461,7 +461,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)
> media_entity_graph_walk_start(&graph, entity);
>
> while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_subdev(entity))
> ret = iss_pipeline_pm_power_one(entity, change);
>
> if (!ret)
> @@ -471,7 +471,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)
>
> while ((first = media_entity_graph_walk_next(&graph))
> && first != entity)
> - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_subdev(first))
> iss_pipeline_pm_power_one(first, -change);
>
> return ret;
> @@ -590,8 +590,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe,
> break;
>
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = pad->entity;
> @@ -658,8 +657,7 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,
> break;
>
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = pad->entity;
> diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
> index 45a3f2d778fc..cbe5783735dc 100644
> --- a/drivers/staging/media/omap4iss/iss_video.c
> +++ b/drivers/staging/media/omap4iss/iss_video.c
> @@ -191,8 +191,7 @@ iss_video_remote_subdev(struct iss_video *video, u32 *pad)
>
> remote = media_entity_remote_pad(&video->pad);
>
> - if (remote = NULL ||
> - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> return NULL;
>
> if (pad)
> @@ -217,7 +216,7 @@ iss_video_far_end(struct iss_video *video)
> if (entity = &video->video.entity)
> continue;
>
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if (!is_media_entity_v4l2_io(entity))
> continue;
>
> far_end = to_iss_video(media_entity_to_video_device(entity));
I finally got around to test these patches eventually, and after some
debugging found this one. I think it's a good idea to have macros to
determine whether an entity exposes a V4L2 sub-device interface but it
should be more robust than is_media_entity_v4l2_subdev() right now is.
Incorrect result can have consequences from a pipeline start failure (due to
a failure in link validation) to memory corruption as struct media_entity
pointer is assumed to be a pointer to a field of another struct.
How about assigning that in V4L2 sub-device / video device registration,
for example?
--
Regards,
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities
2015-10-11 21:07 ` Sakari Ailus
@ 2015-10-12 0:56 ` Mauro Carvalho Chehab
2015-10-12 15:35 ` Sakari Ailus
2015-10-12 15:38 ` [PATCH 1/1] media: Correctly determine whether an entity is a sub-device Sakari Ailus
0 siblings, 2 replies; 17+ messages in thread
From: Mauro Carvalho Chehab @ 2015-10-12 0:56 UTC (permalink / raw)
To: linux-arm-kernel
Em Mon, 12 Oct 2015 00:07:52 +0300
Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> Hi Mauro,
>
> On Sun, Aug 30, 2015 at 12:06:43AM -0300, Mauro Carvalho Chehab wrote:
> > Instead of relying on media subtype, use the new macros to detect
> > if an entity is a subdev or an A/V DMA entity.
> >
> > Please note that most drivers assume that there's just AV_DMA or
> > V4L2 subdevs. This is not true anymore, as we've added MC support
> > for DVB, and there are plans to add support for ALSA and FB/DRM
> > too.
> >
> > Ok, on the current pipelines supported by those drivers, just V4L
> > stuff are there, but, assuming that some day a pipeline that also
> > works with other subsystems will ever added, it is better to add
> > explicit checks for the AV_DMA stuff.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> >
> > diff --git a/drivers/media/platform/exynos4-is/common.c b/drivers/media/platform/exynos4-is/common.c
> > index 0eb34ecb8ee4..8c9a29e0e294 100644
> > --- a/drivers/media/platform/exynos4-is/common.c
> > +++ b/drivers/media/platform/exynos4-is/common.c
> > @@ -22,8 +22,7 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)
> > while (pad->flags & MEDIA_PAD_FL_SINK) {
> > /* source pad */
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > sd = media_entity_to_v4l2_subdev(pad->entity);
> > diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
> > index 0627a93b2f3b..e9810fee4c30 100644
> > --- a/drivers/media/platform/exynos4-is/fimc-capture.c
> > +++ b/drivers/media/platform/exynos4-is/fimc-capture.c
> > @@ -1141,8 +1141,7 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc)
> > }
> > }
> >
> > - if (src_pad = NULL ||
> > - media_entity_type(src_pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!src_pad || !is_media_entity_v4l2_subdev(src_pad->entity))
> > break;
> >
> > /* Don't call FIMC subdev operation to avoid nested locking */
> > @@ -1397,7 +1396,7 @@ static int fimc_link_setup(struct media_entity *entity,
> > struct fimc_vid_cap *vc = &fimc->vid_cap;
> > struct v4l2_subdev *sensor;
> >
> > - if (media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!is_media_entity_v4l2_subdev(remote->entity))
> > return -EINVAL;
> >
> > if (WARN_ON(fimc = NULL))
> > diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > index 3d9ccbf5f10f..5fbaf5e39903 100644
> > --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > @@ -467,8 +467,7 @@ static int isp_video_pipeline_validate(struct fimc_isp *isp)
> >
> > /* Retrieve format at the source pad */
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > sd = media_entity_to_v4l2_subdev(pad->entity);
> > diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
> > index b2607da4ad14..c2327147b360 100644
> > --- a/drivers/media/platform/exynos4-is/fimc-lite.c
> > +++ b/drivers/media/platform/exynos4-is/fimc-lite.c
> > @@ -814,8 +814,7 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc)
> > }
> > /* Retrieve format at the source pad */
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > sd = media_entity_to_v4l2_subdev(pad->entity);
> > @@ -988,7 +987,6 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> > {
> > struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
> > struct fimc_lite *fimc = v4l2_get_subdevdata(sd);
> > - unsigned int remote_ent_type = media_entity_type(remote->entity);
> > int ret = 0;
> >
> > if (WARN_ON(fimc = NULL))
> > @@ -1000,7 +998,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> >
> > switch (local->index) {
> > case FLITE_SD_PAD_SINK:
> > - if (remote_ent_type != MEDIA_ENT_T_V4L2_SUBDEV) {
> > + if (!is_media_entity_v4l2_subdev(remote->entity)) {
> > ret = -EINVAL;
> > break;
> > }
> > @@ -1018,7 +1016,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> > case FLITE_SD_PAD_SOURCE_DMA:
> > if (!(flags & MEDIA_LNK_FL_ENABLED))
> > atomic_set(&fimc->out_path, FIMC_IO_NONE);
> > - else if (remote_ent_type = MEDIA_ENT_T_DEVNODE)
> > + else if (is_media_entity_v4l2_io(remote->entity))
> > atomic_set(&fimc->out_path, FIMC_IO_DMA);
> > else
> > ret = -EINVAL;
> > @@ -1027,7 +1025,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> > case FLITE_SD_PAD_SOURCE_ISP:
> > if (!(flags & MEDIA_LNK_FL_ENABLED))
> > atomic_set(&fimc->out_path, FIMC_IO_NONE);
> > - else if (remote_ent_type = MEDIA_ENT_T_V4L2_SUBDEV)
> > + else if (is_media_entity_v4l2_subdev(remote->entity))
> > atomic_set(&fimc->out_path, FIMC_IO_ISP);
> > else
> > ret = -EINVAL;
> > diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
> > index 92dbade2fffc..4a25df9dd869 100644
> > --- a/drivers/media/platform/exynos4-is/media-dev.c
> > +++ b/drivers/media/platform/exynos4-is/media-dev.c
> > @@ -88,8 +88,7 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,
> > break;
> > }
> >
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> > sd = media_entity_to_v4l2_subdev(pad->entity);
> >
> > @@ -1062,7 +1061,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
> > media_entity_graph_walk_start(&graph, entity);
> >
> > while ((entity = media_entity_graph_walk_next(&graph))) {
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if (!is_media_entity_v4l2_io(entity))
> > continue;
> >
> > ret = __fimc_md_modify_pipeline(entity, enable);
> > @@ -1076,7 +1075,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
> > media_entity_graph_walk_start(&graph, entity_err);
> >
> > while ((entity_err = media_entity_graph_walk_next(&graph))) {
> > - if (media_entity_type(entity_err) != MEDIA_ENT_T_DEVNODE)
> > + if (!is_media_entity_v4l2_io(entity_err))
> > continue;
> >
> > __fimc_md_modify_pipeline(entity_err, !enable);
> > diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
> > index 69e7733d36cd..cb8ac90086c1 100644
> > --- a/drivers/media/platform/omap3isp/isp.c
> > +++ b/drivers/media/platform/omap3isp/isp.c
> > @@ -691,7 +691,7 @@ static int isp_pipeline_pm_use_count(struct media_entity *entity)
> > media_entity_graph_walk_start(&graph, entity);
> >
> > while ((entity = media_entity_graph_walk_next(&graph))) {
> > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_io(entity))
> > use += entity->use_count;
> > }
> >
> > @@ -714,7 +714,7 @@ static int isp_pipeline_pm_power_one(struct media_entity *entity, int change)
> > struct v4l2_subdev *subdev;
> > int ret;
> >
> > - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> > + subdev = is_media_entity_v4l2_subdev(entity)
> > ? media_entity_to_v4l2_subdev(entity) : NULL;
> >
> > if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> > @@ -754,7 +754,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)
> > media_entity_graph_walk_start(&graph, entity);
> >
> > while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_subdev(entity))
> > ret = isp_pipeline_pm_power_one(entity, change);
> >
> > if (!ret)
> > @@ -764,7 +764,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)
> >
> > while ((first = media_entity_graph_walk_next(&graph))
> > && first != entity)
> > - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_subdev(first))
> > isp_pipeline_pm_power_one(first, -change);
> >
> > return ret;
> > @@ -897,8 +897,7 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
> > break;
> >
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = pad->entity;
> > @@ -988,8 +987,7 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe)
> > break;
> >
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = pad->entity;
> > diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
> > index 4c367352b1f7..52843ac2a9ca 100644
> > --- a/drivers/media/platform/omap3isp/ispvideo.c
> > +++ b/drivers/media/platform/omap3isp/ispvideo.c
> > @@ -210,8 +210,7 @@ isp_video_remote_subdev(struct isp_video *video, u32 *pad)
> >
> > remote = media_entity_remote_pad(&video->pad);
> >
> > - if (remote = NULL ||
> > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > return NULL;
> >
> > if (pad)
> > @@ -243,7 +242,7 @@ static int isp_video_get_graph_data(struct isp_video *video,
> > if (entity = &video->video.entity)
> > continue;
> >
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if (!is_media_entity_v4l2_io(entity))
> > continue;
> >
> > __video = to_isp_video(media_entity_to_video_device(entity));
> > @@ -917,7 +916,7 @@ static int isp_video_check_external_subdevs(struct isp_video *video,
> > return -EINVAL;
> > }
> >
> > - if (media_entity_type(source) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!is_media_entity_v4l2_subdev(source))
> > return 0;
> >
> > pipe->external = media_entity_to_v4l2_subdev(source);
> > diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
> > index eae667eab1b9..fb5b016cc0a1 100644
> > --- a/drivers/media/platform/s3c-camif/camif-capture.c
> > +++ b/drivers/media/platform/s3c-camif/camif-capture.c
> > @@ -837,7 +837,7 @@ static int camif_pipeline_validate(struct camif_dev *camif)
> >
> > /* Retrieve format at the sensor subdev source pad */
> > pad = media_entity_remote_pad(&camif->pads[0]);
> > - if (!pad || media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > return -EPIPE;
> >
> > src_fmt.pad = pad->index;
> > diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
> > index 1f94c1a54e00..f74158224b93 100644
> > --- a/drivers/media/platform/vsp1/vsp1_video.c
> > +++ b/drivers/media/platform/vsp1/vsp1_video.c
> > @@ -160,8 +160,7 @@ vsp1_video_remote_subdev(struct media_pad *local, u32 *pad)
> > struct media_pad *remote;
> >
> > remote = media_entity_remote_pad(local);
> > - if (remote = NULL ||
> > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > return NULL;
> >
> > if (pad)
> > @@ -326,7 +325,7 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
> > return -EPIPE;
> >
> > /* We've reached a video node, that shouldn't have happened. */
> > - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!is_media_entity_v4l2_subdev(pad->entity))
> > return -EPIPE;
> >
> > entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> > @@ -423,7 +422,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,
> > struct vsp1_rwpf *rwpf;
> > struct vsp1_entity *e;
> >
> > - if (media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV) {
> > + if (is_media_entity_v4l2_io(entity)) {
> > pipe->num_video++;
> > continue;
> > }
> > @@ -692,7 +691,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
> > pad = media_entity_remote_pad(&input->pads[RWPF_PAD_SOURCE]);
> >
> > while (pad) {
> > - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> > diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
> > index 88cd789cdaf7..8e14841bf445 100644
> > --- a/drivers/media/platform/xilinx/xilinx-dma.c
> > +++ b/drivers/media/platform/xilinx/xilinx-dma.c
> > @@ -49,8 +49,7 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad)
> > struct media_pad *remote;
> >
> > remote = media_entity_remote_pad(local);
> > - if (remote = NULL ||
> > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > return NULL;
> >
> > if (pad)
> > @@ -113,8 +112,7 @@ static int xvip_pipeline_start_stop(struct xvip_pipeline *pipe, bool start)
> > break;
> >
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = pad->entity;
> > diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> > index e6e1115d8215..60da43772de9 100644
> > --- a/drivers/media/v4l2-core/v4l2-subdev.c
> > +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> > @@ -526,7 +526,7 @@ static int
> > v4l2_subdev_link_validate_get_format(struct media_pad *pad,
> > struct v4l2_subdev_format *fmt)
> > {
> > - if (media_entity_type(pad->entity) = MEDIA_ENT_T_V4L2_SUBDEV) {
> > + if (is_media_entity_v4l2_subdev(pad->entity)) {
> > struct v4l2_subdev *sd > > media_entity_to_v4l2_subdev(pad->entity);
> >
> > diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > index 92573fa852a9..16763e0831f2 100644
> > --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > @@ -148,7 +148,7 @@ static void vpfe_prepare_pipeline(struct vpfe_video_device *video)
> > while ((entity = media_entity_graph_walk_next(&graph))) {
> > if (entity = &video->video_dev.entity)
> > continue;
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if ((!is_media_entity_v4l2_io(remote->entity))
> > continue;
> > far_end = to_vpfe_video(media_entity_to_video_device(entity));
> > if (far_end->type = V4L2_BUF_TYPE_VIDEO_OUTPUT)
> > @@ -293,7 +293,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline *pipe)
> > media_entity_graph_walk_start(&graph, entity);
> > while ((entity = media_entity_graph_walk_next(&graph))) {
> >
> > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > + if !is_media_entity_v4l2_subdev(entity))
> > continue;
> > subdev = media_entity_to_v4l2_subdev(entity);
> > ret = v4l2_subdev_call(subdev, video, s_stream, 1);
> > @@ -334,7 +334,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe)
> >
> > while ((entity = media_entity_graph_walk_next(&graph))) {
> >
> > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > + if (!is_media_entity_v4l2_subdev(entity))
> > continue;
> > subdev = media_entity_to_v4l2_subdev(entity);
> > ret = v4l2_subdev_call(subdev, video, s_stream, 0);
> > diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> > index 40591963b42b..44b88ff3ba83 100644
> > --- a/drivers/staging/media/omap4iss/iss.c
> > +++ b/drivers/staging/media/omap4iss/iss.c
> > @@ -397,7 +397,7 @@ static int iss_pipeline_pm_use_count(struct media_entity *entity)
> > media_entity_graph_walk_start(&graph, entity);
> >
> > while ((entity = media_entity_graph_walk_next(&graph))) {
> > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_io(entity))
> > use += entity->use_count;
> > }
> >
> > @@ -419,7 +419,7 @@ static int iss_pipeline_pm_power_one(struct media_entity *entity, int change)
> > {
> > struct v4l2_subdev *subdev;
> >
> > - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> > + subdev = is_media_entity_v4l2_subdev(entity)
> > ? media_entity_to_v4l2_subdev(entity) : NULL;
> >
> > if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> > @@ -461,7 +461,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)
> > media_entity_graph_walk_start(&graph, entity);
> >
> > while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_subdev(entity))
> > ret = iss_pipeline_pm_power_one(entity, change);
> >
> > if (!ret)
> > @@ -471,7 +471,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)
> >
> > while ((first = media_entity_graph_walk_next(&graph))
> > && first != entity)
> > - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_subdev(first))
> > iss_pipeline_pm_power_one(first, -change);
> >
> > return ret;
> > @@ -590,8 +590,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe,
> > break;
> >
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = pad->entity;
> > @@ -658,8 +657,7 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,
> > break;
> >
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = pad->entity;
> > diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
> > index 45a3f2d778fc..cbe5783735dc 100644
> > --- a/drivers/staging/media/omap4iss/iss_video.c
> > +++ b/drivers/staging/media/omap4iss/iss_video.c
> > @@ -191,8 +191,7 @@ iss_video_remote_subdev(struct iss_video *video, u32 *pad)
> >
> > remote = media_entity_remote_pad(&video->pad);
> >
> > - if (remote = NULL ||
> > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > return NULL;
> >
> > if (pad)
> > @@ -217,7 +216,7 @@ iss_video_far_end(struct iss_video *video)
> > if (entity = &video->video.entity)
> > continue;
> >
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if (!is_media_entity_v4l2_io(entity))
> > continue;
> >
> > far_end = to_iss_video(media_entity_to_video_device(entity));
>
> I finally got around to test these patches eventually, and after some
> debugging found this one. I think it's a good idea to have macros to
> determine whether an entity exposes a V4L2 sub-device interface but it
> should be more robust than is_media_entity_v4l2_subdev() right now is.
Hmm... Not sure what you're meaning... the V4L2 sub-device interface is
actually a separate graph object (interfaces). Those macros work at the
entities, not at the interface objects.
> Incorrect result can have consequences from a pipeline start failure (due to
> a failure in link validation) to memory corruption as struct media_entity
> pointer is assumed to be a pointer to a field of another struct.
Yes, an incorrect result would cause pipeline failures.
> How about assigning that in V4L2 sub-device / video device registration,
> for example?
What do you mean? Could you give an example to make it clearer?
Regards,
Mauro
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities
2015-10-12 0:56 ` Mauro Carvalho Chehab
@ 2015-10-12 15:35 ` Sakari Ailus
2015-10-12 16:00 ` Mauro Carvalho Chehab
2015-10-12 15:38 ` [PATCH 1/1] media: Correctly determine whether an entity is a sub-device Sakari Ailus
1 sibling, 1 reply; 17+ messages in thread
From: Sakari Ailus @ 2015-10-12 15:35 UTC (permalink / raw)
To: linux-arm-kernel
Hi Mauro,
On Sun, Oct 11, 2015 at 09:56:25PM -0300, Mauro Carvalho Chehab wrote:
> Em Mon, 12 Oct 2015 00:07:52 +0300
> Sakari Ailus <sakari.ailus@iki.fi> escreveu:
>
> > Hi Mauro,
> >
> > On Sun, Aug 30, 2015 at 12:06:43AM -0300, Mauro Carvalho Chehab wrote:
> > > Instead of relying on media subtype, use the new macros to detect
> > > if an entity is a subdev or an A/V DMA entity.
> > >
> > > Please note that most drivers assume that there's just AV_DMA or
> > > V4L2 subdevs. This is not true anymore, as we've added MC support
> > > for DVB, and there are plans to add support for ALSA and FB/DRM
> > > too.
> > >
> > > Ok, on the current pipelines supported by those drivers, just V4L
> > > stuff are there, but, assuming that some day a pipeline that also
> > > works with other subsystems will ever added, it is better to add
> > > explicit checks for the AV_DMA stuff.
> > >
> > > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> > >
> > > diff --git a/drivers/media/platform/exynos4-is/common.c b/drivers/media/platform/exynos4-is/common.c
> > > index 0eb34ecb8ee4..8c9a29e0e294 100644
> > > --- a/drivers/media/platform/exynos4-is/common.c
> > > +++ b/drivers/media/platform/exynos4-is/common.c
> > > @@ -22,8 +22,7 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)
> > > while (pad->flags & MEDIA_PAD_FL_SINK) {
> > > /* source pad */
> > > pad = media_entity_remote_pad(pad);
> > > - if (pad = NULL ||
> > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > break;
> > >
> > > sd = media_entity_to_v4l2_subdev(pad->entity);
> > > diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
> > > index 0627a93b2f3b..e9810fee4c30 100644
> > > --- a/drivers/media/platform/exynos4-is/fimc-capture.c
> > > +++ b/drivers/media/platform/exynos4-is/fimc-capture.c
> > > @@ -1141,8 +1141,7 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc)
> > > }
> > > }
> > >
> > > - if (src_pad = NULL ||
> > > - media_entity_type(src_pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!src_pad || !is_media_entity_v4l2_subdev(src_pad->entity))
> > > break;
> > >
> > > /* Don't call FIMC subdev operation to avoid nested locking */
> > > @@ -1397,7 +1396,7 @@ static int fimc_link_setup(struct media_entity *entity,
> > > struct fimc_vid_cap *vc = &fimc->vid_cap;
> > > struct v4l2_subdev *sensor;
> > >
> > > - if (media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!is_media_entity_v4l2_subdev(remote->entity))
> > > return -EINVAL;
> > >
> > > if (WARN_ON(fimc = NULL))
> > > diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > > index 3d9ccbf5f10f..5fbaf5e39903 100644
> > > --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > > +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > > @@ -467,8 +467,7 @@ static int isp_video_pipeline_validate(struct fimc_isp *isp)
> > >
> > > /* Retrieve format at the source pad */
> > > pad = media_entity_remote_pad(pad);
> > > - if (pad = NULL ||
> > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > break;
> > >
> > > sd = media_entity_to_v4l2_subdev(pad->entity);
> > > diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
> > > index b2607da4ad14..c2327147b360 100644
> > > --- a/drivers/media/platform/exynos4-is/fimc-lite.c
> > > +++ b/drivers/media/platform/exynos4-is/fimc-lite.c
> > > @@ -814,8 +814,7 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc)
> > > }
> > > /* Retrieve format at the source pad */
> > > pad = media_entity_remote_pad(pad);
> > > - if (pad = NULL ||
> > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > break;
> > >
> > > sd = media_entity_to_v4l2_subdev(pad->entity);
> > > @@ -988,7 +987,6 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> > > {
> > > struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
> > > struct fimc_lite *fimc = v4l2_get_subdevdata(sd);
> > > - unsigned int remote_ent_type = media_entity_type(remote->entity);
> > > int ret = 0;
> > >
> > > if (WARN_ON(fimc = NULL))
> > > @@ -1000,7 +998,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> > >
> > > switch (local->index) {
> > > case FLITE_SD_PAD_SINK:
> > > - if (remote_ent_type != MEDIA_ENT_T_V4L2_SUBDEV) {
> > > + if (!is_media_entity_v4l2_subdev(remote->entity)) {
> > > ret = -EINVAL;
> > > break;
> > > }
> > > @@ -1018,7 +1016,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> > > case FLITE_SD_PAD_SOURCE_DMA:
> > > if (!(flags & MEDIA_LNK_FL_ENABLED))
> > > atomic_set(&fimc->out_path, FIMC_IO_NONE);
> > > - else if (remote_ent_type = MEDIA_ENT_T_DEVNODE)
> > > + else if (is_media_entity_v4l2_io(remote->entity))
> > > atomic_set(&fimc->out_path, FIMC_IO_DMA);
> > > else
> > > ret = -EINVAL;
> > > @@ -1027,7 +1025,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> > > case FLITE_SD_PAD_SOURCE_ISP:
> > > if (!(flags & MEDIA_LNK_FL_ENABLED))
> > > atomic_set(&fimc->out_path, FIMC_IO_NONE);
> > > - else if (remote_ent_type = MEDIA_ENT_T_V4L2_SUBDEV)
> > > + else if (is_media_entity_v4l2_subdev(remote->entity))
> > > atomic_set(&fimc->out_path, FIMC_IO_ISP);
> > > else
> > > ret = -EINVAL;
> > > diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
> > > index 92dbade2fffc..4a25df9dd869 100644
> > > --- a/drivers/media/platform/exynos4-is/media-dev.c
> > > +++ b/drivers/media/platform/exynos4-is/media-dev.c
> > > @@ -88,8 +88,7 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,
> > > break;
> > > }
> > >
> > > - if (pad = NULL ||
> > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > break;
> > > sd = media_entity_to_v4l2_subdev(pad->entity);
> > >
> > > @@ -1062,7 +1061,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
> > > media_entity_graph_walk_start(&graph, entity);
> > >
> > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > + if (!is_media_entity_v4l2_io(entity))
> > > continue;
> > >
> > > ret = __fimc_md_modify_pipeline(entity, enable);
> > > @@ -1076,7 +1075,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
> > > media_entity_graph_walk_start(&graph, entity_err);
> > >
> > > while ((entity_err = media_entity_graph_walk_next(&graph))) {
> > > - if (media_entity_type(entity_err) != MEDIA_ENT_T_DEVNODE)
> > > + if (!is_media_entity_v4l2_io(entity_err))
> > > continue;
> > >
> > > __fimc_md_modify_pipeline(entity_err, !enable);
> > > diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
> > > index 69e7733d36cd..cb8ac90086c1 100644
> > > --- a/drivers/media/platform/omap3isp/isp.c
> > > +++ b/drivers/media/platform/omap3isp/isp.c
> > > @@ -691,7 +691,7 @@ static int isp_pipeline_pm_use_count(struct media_entity *entity)
> > > media_entity_graph_walk_start(&graph, entity);
> > >
> > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > > + if (is_media_entity_v4l2_io(entity))
> > > use += entity->use_count;
> > > }
> > >
> > > @@ -714,7 +714,7 @@ static int isp_pipeline_pm_power_one(struct media_entity *entity, int change)
> > > struct v4l2_subdev *subdev;
> > > int ret;
> > >
> > > - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> > > + subdev = is_media_entity_v4l2_subdev(entity)
> > > ? media_entity_to_v4l2_subdev(entity) : NULL;
> > >
> > > if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> > > @@ -754,7 +754,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)
> > > media_entity_graph_walk_start(&graph, entity);
> > >
> > > while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > + if (is_media_entity_v4l2_subdev(entity))
> > > ret = isp_pipeline_pm_power_one(entity, change);
> > >
> > > if (!ret)
> > > @@ -764,7 +764,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)
> > >
> > > while ((first = media_entity_graph_walk_next(&graph))
> > > && first != entity)
> > > - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> > > + if (is_media_entity_v4l2_subdev(first))
> > > isp_pipeline_pm_power_one(first, -change);
> > >
> > > return ret;
> > > @@ -897,8 +897,7 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
> > > break;
> > >
> > > pad = media_entity_remote_pad(pad);
> > > - if (pad = NULL ||
> > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > break;
> > >
> > > entity = pad->entity;
> > > @@ -988,8 +987,7 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe)
> > > break;
> > >
> > > pad = media_entity_remote_pad(pad);
> > > - if (pad = NULL ||
> > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > break;
> > >
> > > entity = pad->entity;
> > > diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
> > > index 4c367352b1f7..52843ac2a9ca 100644
> > > --- a/drivers/media/platform/omap3isp/ispvideo.c
> > > +++ b/drivers/media/platform/omap3isp/ispvideo.c
> > > @@ -210,8 +210,7 @@ isp_video_remote_subdev(struct isp_video *video, u32 *pad)
> > >
> > > remote = media_entity_remote_pad(&video->pad);
> > >
> > > - if (remote = NULL ||
> > > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > > return NULL;
> > >
> > > if (pad)
> > > @@ -243,7 +242,7 @@ static int isp_video_get_graph_data(struct isp_video *video,
> > > if (entity = &video->video.entity)
> > > continue;
> > >
> > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > + if (!is_media_entity_v4l2_io(entity))
> > > continue;
> > >
> > > __video = to_isp_video(media_entity_to_video_device(entity));
> > > @@ -917,7 +916,7 @@ static int isp_video_check_external_subdevs(struct isp_video *video,
> > > return -EINVAL;
> > > }
> > >
> > > - if (media_entity_type(source) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!is_media_entity_v4l2_subdev(source))
> > > return 0;
> > >
> > > pipe->external = media_entity_to_v4l2_subdev(source);
> > > diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
> > > index eae667eab1b9..fb5b016cc0a1 100644
> > > --- a/drivers/media/platform/s3c-camif/camif-capture.c
> > > +++ b/drivers/media/platform/s3c-camif/camif-capture.c
> > > @@ -837,7 +837,7 @@ static int camif_pipeline_validate(struct camif_dev *camif)
> > >
> > > /* Retrieve format at the sensor subdev source pad */
> > > pad = media_entity_remote_pad(&camif->pads[0]);
> > > - if (!pad || media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > return -EPIPE;
> > >
> > > src_fmt.pad = pad->index;
> > > diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
> > > index 1f94c1a54e00..f74158224b93 100644
> > > --- a/drivers/media/platform/vsp1/vsp1_video.c
> > > +++ b/drivers/media/platform/vsp1/vsp1_video.c
> > > @@ -160,8 +160,7 @@ vsp1_video_remote_subdev(struct media_pad *local, u32 *pad)
> > > struct media_pad *remote;
> > >
> > > remote = media_entity_remote_pad(local);
> > > - if (remote = NULL ||
> > > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > > return NULL;
> > >
> > > if (pad)
> > > @@ -326,7 +325,7 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
> > > return -EPIPE;
> > >
> > > /* We've reached a video node, that shouldn't have happened. */
> > > - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!is_media_entity_v4l2_subdev(pad->entity))
> > > return -EPIPE;
> > >
> > > entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> > > @@ -423,7 +422,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,
> > > struct vsp1_rwpf *rwpf;
> > > struct vsp1_entity *e;
> > >
> > > - if (media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV) {
> > > + if (is_media_entity_v4l2_io(entity)) {
> > > pipe->num_video++;
> > > continue;
> > > }
> > > @@ -692,7 +691,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
> > > pad = media_entity_remote_pad(&input->pads[RWPF_PAD_SOURCE]);
> > >
> > > while (pad) {
> > > - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!is_media_entity_v4l2_subdev(pad->entity))
> > > break;
> > >
> > > entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> > > diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
> > > index 88cd789cdaf7..8e14841bf445 100644
> > > --- a/drivers/media/platform/xilinx/xilinx-dma.c
> > > +++ b/drivers/media/platform/xilinx/xilinx-dma.c
> > > @@ -49,8 +49,7 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad)
> > > struct media_pad *remote;
> > >
> > > remote = media_entity_remote_pad(local);
> > > - if (remote = NULL ||
> > > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > > return NULL;
> > >
> > > if (pad)
> > > @@ -113,8 +112,7 @@ static int xvip_pipeline_start_stop(struct xvip_pipeline *pipe, bool start)
> > > break;
> > >
> > > pad = media_entity_remote_pad(pad);
> > > - if (pad = NULL ||
> > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > break;
> > >
> > > entity = pad->entity;
> > > diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> > > index e6e1115d8215..60da43772de9 100644
> > > --- a/drivers/media/v4l2-core/v4l2-subdev.c
> > > +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> > > @@ -526,7 +526,7 @@ static int
> > > v4l2_subdev_link_validate_get_format(struct media_pad *pad,
> > > struct v4l2_subdev_format *fmt)
> > > {
> > > - if (media_entity_type(pad->entity) = MEDIA_ENT_T_V4L2_SUBDEV) {
> > > + if (is_media_entity_v4l2_subdev(pad->entity)) {
> > > struct v4l2_subdev *sd > > > media_entity_to_v4l2_subdev(pad->entity);
> > >
> > > diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > > index 92573fa852a9..16763e0831f2 100644
> > > --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > > +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > > @@ -148,7 +148,7 @@ static void vpfe_prepare_pipeline(struct vpfe_video_device *video)
> > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > > if (entity = &video->video_dev.entity)
> > > continue;
> > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > + if ((!is_media_entity_v4l2_io(remote->entity))
> > > continue;
> > > far_end = to_vpfe_video(media_entity_to_video_device(entity));
> > > if (far_end->type = V4L2_BUF_TYPE_VIDEO_OUTPUT)
> > > @@ -293,7 +293,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline *pipe)
> > > media_entity_graph_walk_start(&graph, entity);
> > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > >
> > > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > > + if !is_media_entity_v4l2_subdev(entity))
> > > continue;
> > > subdev = media_entity_to_v4l2_subdev(entity);
> > > ret = v4l2_subdev_call(subdev, video, s_stream, 1);
> > > @@ -334,7 +334,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe)
> > >
> > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > >
> > > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > > + if (!is_media_entity_v4l2_subdev(entity))
> > > continue;
> > > subdev = media_entity_to_v4l2_subdev(entity);
> > > ret = v4l2_subdev_call(subdev, video, s_stream, 0);
> > > diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> > > index 40591963b42b..44b88ff3ba83 100644
> > > --- a/drivers/staging/media/omap4iss/iss.c
> > > +++ b/drivers/staging/media/omap4iss/iss.c
> > > @@ -397,7 +397,7 @@ static int iss_pipeline_pm_use_count(struct media_entity *entity)
> > > media_entity_graph_walk_start(&graph, entity);
> > >
> > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > > + if (is_media_entity_v4l2_io(entity))
> > > use += entity->use_count;
> > > }
> > >
> > > @@ -419,7 +419,7 @@ static int iss_pipeline_pm_power_one(struct media_entity *entity, int change)
> > > {
> > > struct v4l2_subdev *subdev;
> > >
> > > - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> > > + subdev = is_media_entity_v4l2_subdev(entity)
> > > ? media_entity_to_v4l2_subdev(entity) : NULL;
> > >
> > > if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> > > @@ -461,7 +461,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)
> > > media_entity_graph_walk_start(&graph, entity);
> > >
> > > while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > + if (is_media_entity_v4l2_subdev(entity))
> > > ret = iss_pipeline_pm_power_one(entity, change);
> > >
> > > if (!ret)
> > > @@ -471,7 +471,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)
> > >
> > > while ((first = media_entity_graph_walk_next(&graph))
> > > && first != entity)
> > > - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> > > + if (is_media_entity_v4l2_subdev(first))
> > > iss_pipeline_pm_power_one(first, -change);
> > >
> > > return ret;
> > > @@ -590,8 +590,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe,
> > > break;
> > >
> > > pad = media_entity_remote_pad(pad);
> > > - if (pad = NULL ||
> > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > break;
> > >
> > > entity = pad->entity;
> > > @@ -658,8 +657,7 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,
> > > break;
> > >
> > > pad = media_entity_remote_pad(pad);
> > > - if (pad = NULL ||
> > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > break;
> > >
> > > entity = pad->entity;
> > > diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
> > > index 45a3f2d778fc..cbe5783735dc 100644
> > > --- a/drivers/staging/media/omap4iss/iss_video.c
> > > +++ b/drivers/staging/media/omap4iss/iss_video.c
> > > @@ -191,8 +191,7 @@ iss_video_remote_subdev(struct iss_video *video, u32 *pad)
> > >
> > > remote = media_entity_remote_pad(&video->pad);
> > >
> > > - if (remote = NULL ||
> > > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > > return NULL;
> > >
> > > if (pad)
> > > @@ -217,7 +216,7 @@ iss_video_far_end(struct iss_video *video)
> > > if (entity = &video->video.entity)
> > > continue;
> > >
> > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > + if (!is_media_entity_v4l2_io(entity))
> > > continue;
> > >
> > > far_end = to_iss_video(media_entity_to_video_device(entity));
> >
> > I finally got around to test these patches eventually, and after some
> > debugging found this one. I think it's a good idea to have macros to
> > determine whether an entity exposes a V4L2 sub-device interface but it
> > should be more robust than is_media_entity_v4l2_subdev() right now is.
>
> Hmm... Not sure what you're meaning... the V4L2 sub-device interface is
> actually a separate graph object (interfaces). Those macros work at the
> entities, not at the interface objects.
is_media_entity_v4l2_subdev() will produce wrong results for a large part of
V4L2 sub-devices with these patches applied.
I checked again the original implementation, and it seems to be based only
on the type as well, albeit that's a range, not a set of different
functions.
I suppose this will change at some point in the future: the interface indeed
should not be determined by the function of the entity. At least it needs to
be fixed now until the rework. I'll submit a patch for that.
--
Regards,
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/1] media: Correctly determine whether an entity is a sub-device
2015-10-12 0:56 ` Mauro Carvalho Chehab
2015-10-12 15:35 ` Sakari Ailus
@ 2015-10-12 15:38 ` Sakari Ailus
2015-10-12 15:58 ` Mauro Carvalho Chehab
1 sibling, 1 reply; 17+ messages in thread
From: Sakari Ailus @ 2015-10-12 15:38 UTC (permalink / raw)
To: linux-arm-kernel
If the function of an entity is not one of the pre-defined ones, it is not
correctly recognised as a V4L2 sub-device.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
include/media/media-entity.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index a60872a..76e9a124 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -328,6 +328,7 @@ static inline bool is_media_entity_v4l2_subdev(struct media_entity *entity)
case MEDIA_ENT_F_LENS:
case MEDIA_ENT_F_ATV_DECODER:
case MEDIA_ENT_F_TUNER:
+ case MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN:
return true;
default:
--
2.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 1/1] media: Correctly determine whether an entity is a sub-device
2015-10-12 15:38 ` [PATCH 1/1] media: Correctly determine whether an entity is a sub-device Sakari Ailus
@ 2015-10-12 15:58 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 17+ messages in thread
From: Mauro Carvalho Chehab @ 2015-10-12 15:58 UTC (permalink / raw)
To: linux-arm-kernel
Em Mon, 12 Oct 2015 18:38:23 +0300
Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> If the function of an entity is not one of the pre-defined ones, it is not
> correctly recognised as a V4L2 sub-device.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
> include/media/media-entity.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index a60872a..76e9a124 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -328,6 +328,7 @@ static inline bool is_media_entity_v4l2_subdev(struct media_entity *entity)
> case MEDIA_ENT_F_LENS:
> case MEDIA_ENT_F_ATV_DECODER:
> case MEDIA_ENT_F_TUNER:
> + case MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN:
> return true;
OK.
Reviewed-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>
> default:
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities
2015-10-12 15:35 ` Sakari Ailus
@ 2015-10-12 16:00 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 17+ messages in thread
From: Mauro Carvalho Chehab @ 2015-10-12 16:00 UTC (permalink / raw)
To: linux-arm-kernel
Em Mon, 12 Oct 2015 18:35:05 +0300
Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> Hi Mauro,
>
> On Sun, Oct 11, 2015 at 09:56:25PM -0300, Mauro Carvalho Chehab wrote:
> > Em Mon, 12 Oct 2015 00:07:52 +0300
> > Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> >
> > > Hi Mauro,
> > >
> > > On Sun, Aug 30, 2015 at 12:06:43AM -0300, Mauro Carvalho Chehab wrote:
> > > > Instead of relying on media subtype, use the new macros to detect
> > > > if an entity is a subdev or an A/V DMA entity.
> > > >
> > > > Please note that most drivers assume that there's just AV_DMA or
> > > > V4L2 subdevs. This is not true anymore, as we've added MC support
> > > > for DVB, and there are plans to add support for ALSA and FB/DRM
> > > > too.
> > > >
> > > > Ok, on the current pipelines supported by those drivers, just V4L
> > > > stuff are there, but, assuming that some day a pipeline that also
> > > > works with other subsystems will ever added, it is better to add
> > > > explicit checks for the AV_DMA stuff.
> > > >
> > > > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> > > >
> > > > diff --git a/drivers/media/platform/exynos4-is/common.c b/drivers/media/platform/exynos4-is/common.c
> > > > index 0eb34ecb8ee4..8c9a29e0e294 100644
> > > > --- a/drivers/media/platform/exynos4-is/common.c
> > > > +++ b/drivers/media/platform/exynos4-is/common.c
> > > > @@ -22,8 +22,7 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)
> > > > while (pad->flags & MEDIA_PAD_FL_SINK) {
> > > > /* source pad */
> > > > pad = media_entity_remote_pad(pad);
> > > > - if (pad = NULL ||
> > > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > > break;
> > > >
> > > > sd = media_entity_to_v4l2_subdev(pad->entity);
> > > > diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c
> > > > index 0627a93b2f3b..e9810fee4c30 100644
> > > > --- a/drivers/media/platform/exynos4-is/fimc-capture.c
> > > > +++ b/drivers/media/platform/exynos4-is/fimc-capture.c
> > > > @@ -1141,8 +1141,7 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc)
> > > > }
> > > > }
> > > >
> > > > - if (src_pad = NULL ||
> > > > - media_entity_type(src_pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!src_pad || !is_media_entity_v4l2_subdev(src_pad->entity))
> > > > break;
> > > >
> > > > /* Don't call FIMC subdev operation to avoid nested locking */
> > > > @@ -1397,7 +1396,7 @@ static int fimc_link_setup(struct media_entity *entity,
> > > > struct fimc_vid_cap *vc = &fimc->vid_cap;
> > > > struct v4l2_subdev *sensor;
> > > >
> > > > - if (media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!is_media_entity_v4l2_subdev(remote->entity))
> > > > return -EINVAL;
> > > >
> > > > if (WARN_ON(fimc = NULL))
> > > > diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > > > index 3d9ccbf5f10f..5fbaf5e39903 100644
> > > > --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > > > +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > > > @@ -467,8 +467,7 @@ static int isp_video_pipeline_validate(struct fimc_isp *isp)
> > > >
> > > > /* Retrieve format at the source pad */
> > > > pad = media_entity_remote_pad(pad);
> > > > - if (pad = NULL ||
> > > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > > break;
> > > >
> > > > sd = media_entity_to_v4l2_subdev(pad->entity);
> > > > diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
> > > > index b2607da4ad14..c2327147b360 100644
> > > > --- a/drivers/media/platform/exynos4-is/fimc-lite.c
> > > > +++ b/drivers/media/platform/exynos4-is/fimc-lite.c
> > > > @@ -814,8 +814,7 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc)
> > > > }
> > > > /* Retrieve format at the source pad */
> > > > pad = media_entity_remote_pad(pad);
> > > > - if (pad = NULL ||
> > > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > > break;
> > > >
> > > > sd = media_entity_to_v4l2_subdev(pad->entity);
> > > > @@ -988,7 +987,6 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> > > > {
> > > > struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
> > > > struct fimc_lite *fimc = v4l2_get_subdevdata(sd);
> > > > - unsigned int remote_ent_type = media_entity_type(remote->entity);
> > > > int ret = 0;
> > > >
> > > > if (WARN_ON(fimc = NULL))
> > > > @@ -1000,7 +998,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> > > >
> > > > switch (local->index) {
> > > > case FLITE_SD_PAD_SINK:
> > > > - if (remote_ent_type != MEDIA_ENT_T_V4L2_SUBDEV) {
> > > > + if (!is_media_entity_v4l2_subdev(remote->entity)) {
> > > > ret = -EINVAL;
> > > > break;
> > > > }
> > > > @@ -1018,7 +1016,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> > > > case FLITE_SD_PAD_SOURCE_DMA:
> > > > if (!(flags & MEDIA_LNK_FL_ENABLED))
> > > > atomic_set(&fimc->out_path, FIMC_IO_NONE);
> > > > - else if (remote_ent_type = MEDIA_ENT_T_DEVNODE)
> > > > + else if (is_media_entity_v4l2_io(remote->entity))
> > > > atomic_set(&fimc->out_path, FIMC_IO_DMA);
> > > > else
> > > > ret = -EINVAL;
> > > > @@ -1027,7 +1025,7 @@ static int fimc_lite_link_setup(struct media_entity *entity,
> > > > case FLITE_SD_PAD_SOURCE_ISP:
> > > > if (!(flags & MEDIA_LNK_FL_ENABLED))
> > > > atomic_set(&fimc->out_path, FIMC_IO_NONE);
> > > > - else if (remote_ent_type = MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + else if (is_media_entity_v4l2_subdev(remote->entity))
> > > > atomic_set(&fimc->out_path, FIMC_IO_ISP);
> > > > else
> > > > ret = -EINVAL;
> > > > diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
> > > > index 92dbade2fffc..4a25df9dd869 100644
> > > > --- a/drivers/media/platform/exynos4-is/media-dev.c
> > > > +++ b/drivers/media/platform/exynos4-is/media-dev.c
> > > > @@ -88,8 +88,7 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,
> > > > break;
> > > > }
> > > >
> > > > - if (pad = NULL ||
> > > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > > break;
> > > > sd = media_entity_to_v4l2_subdev(pad->entity);
> > > >
> > > > @@ -1062,7 +1061,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
> > > > media_entity_graph_walk_start(&graph, entity);
> > > >
> > > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > > + if (!is_media_entity_v4l2_io(entity))
> > > > continue;
> > > >
> > > > ret = __fimc_md_modify_pipeline(entity, enable);
> > > > @@ -1076,7 +1075,7 @@ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable)
> > > > media_entity_graph_walk_start(&graph, entity_err);
> > > >
> > > > while ((entity_err = media_entity_graph_walk_next(&graph))) {
> > > > - if (media_entity_type(entity_err) != MEDIA_ENT_T_DEVNODE)
> > > > + if (!is_media_entity_v4l2_io(entity_err))
> > > > continue;
> > > >
> > > > __fimc_md_modify_pipeline(entity_err, !enable);
> > > > diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
> > > > index 69e7733d36cd..cb8ac90086c1 100644
> > > > --- a/drivers/media/platform/omap3isp/isp.c
> > > > +++ b/drivers/media/platform/omap3isp/isp.c
> > > > @@ -691,7 +691,7 @@ static int isp_pipeline_pm_use_count(struct media_entity *entity)
> > > > media_entity_graph_walk_start(&graph, entity);
> > > >
> > > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > > > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > > > + if (is_media_entity_v4l2_io(entity))
> > > > use += entity->use_count;
> > > > }
> > > >
> > > > @@ -714,7 +714,7 @@ static int isp_pipeline_pm_power_one(struct media_entity *entity, int change)
> > > > struct v4l2_subdev *subdev;
> > > > int ret;
> > > >
> > > > - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> > > > + subdev = is_media_entity_v4l2_subdev(entity)
> > > > ? media_entity_to_v4l2_subdev(entity) : NULL;
> > > >
> > > > if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> > > > @@ -754,7 +754,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)
> > > > media_entity_graph_walk_start(&graph, entity);
> > > >
> > > > while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> > > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > > + if (is_media_entity_v4l2_subdev(entity))
> > > > ret = isp_pipeline_pm_power_one(entity, change);
> > > >
> > > > if (!ret)
> > > > @@ -764,7 +764,7 @@ static int isp_pipeline_pm_power(struct media_entity *entity, int change)
> > > >
> > > > while ((first = media_entity_graph_walk_next(&graph))
> > > > && first != entity)
> > > > - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> > > > + if (is_media_entity_v4l2_subdev(first))
> > > > isp_pipeline_pm_power_one(first, -change);
> > > >
> > > > return ret;
> > > > @@ -897,8 +897,7 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
> > > > break;
> > > >
> > > > pad = media_entity_remote_pad(pad);
> > > > - if (pad = NULL ||
> > > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > > break;
> > > >
> > > > entity = pad->entity;
> > > > @@ -988,8 +987,7 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe)
> > > > break;
> > > >
> > > > pad = media_entity_remote_pad(pad);
> > > > - if (pad = NULL ||
> > > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > > break;
> > > >
> > > > entity = pad->entity;
> > > > diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
> > > > index 4c367352b1f7..52843ac2a9ca 100644
> > > > --- a/drivers/media/platform/omap3isp/ispvideo.c
> > > > +++ b/drivers/media/platform/omap3isp/ispvideo.c
> > > > @@ -210,8 +210,7 @@ isp_video_remote_subdev(struct isp_video *video, u32 *pad)
> > > >
> > > > remote = media_entity_remote_pad(&video->pad);
> > > >
> > > > - if (remote = NULL ||
> > > > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > > > return NULL;
> > > >
> > > > if (pad)
> > > > @@ -243,7 +242,7 @@ static int isp_video_get_graph_data(struct isp_video *video,
> > > > if (entity = &video->video.entity)
> > > > continue;
> > > >
> > > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > > + if (!is_media_entity_v4l2_io(entity))
> > > > continue;
> > > >
> > > > __video = to_isp_video(media_entity_to_video_device(entity));
> > > > @@ -917,7 +916,7 @@ static int isp_video_check_external_subdevs(struct isp_video *video,
> > > > return -EINVAL;
> > > > }
> > > >
> > > > - if (media_entity_type(source) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!is_media_entity_v4l2_subdev(source))
> > > > return 0;
> > > >
> > > > pipe->external = media_entity_to_v4l2_subdev(source);
> > > > diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
> > > > index eae667eab1b9..fb5b016cc0a1 100644
> > > > --- a/drivers/media/platform/s3c-camif/camif-capture.c
> > > > +++ b/drivers/media/platform/s3c-camif/camif-capture.c
> > > > @@ -837,7 +837,7 @@ static int camif_pipeline_validate(struct camif_dev *camif)
> > > >
> > > > /* Retrieve format at the sensor subdev source pad */
> > > > pad = media_entity_remote_pad(&camif->pads[0]);
> > > > - if (!pad || media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > > return -EPIPE;
> > > >
> > > > src_fmt.pad = pad->index;
> > > > diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
> > > > index 1f94c1a54e00..f74158224b93 100644
> > > > --- a/drivers/media/platform/vsp1/vsp1_video.c
> > > > +++ b/drivers/media/platform/vsp1/vsp1_video.c
> > > > @@ -160,8 +160,7 @@ vsp1_video_remote_subdev(struct media_pad *local, u32 *pad)
> > > > struct media_pad *remote;
> > > >
> > > > remote = media_entity_remote_pad(local);
> > > > - if (remote = NULL ||
> > > > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > > > return NULL;
> > > >
> > > > if (pad)
> > > > @@ -326,7 +325,7 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
> > > > return -EPIPE;
> > > >
> > > > /* We've reached a video node, that shouldn't have happened. */
> > > > - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!is_media_entity_v4l2_subdev(pad->entity))
> > > > return -EPIPE;
> > > >
> > > > entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> > > > @@ -423,7 +422,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,
> > > > struct vsp1_rwpf *rwpf;
> > > > struct vsp1_entity *e;
> > > >
> > > > - if (media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV) {
> > > > + if (is_media_entity_v4l2_io(entity)) {
> > > > pipe->num_video++;
> > > > continue;
> > > > }
> > > > @@ -692,7 +691,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
> > > > pad = media_entity_remote_pad(&input->pads[RWPF_PAD_SOURCE]);
> > > >
> > > > while (pad) {
> > > > - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!is_media_entity_v4l2_subdev(pad->entity))
> > > > break;
> > > >
> > > > entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> > > > diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
> > > > index 88cd789cdaf7..8e14841bf445 100644
> > > > --- a/drivers/media/platform/xilinx/xilinx-dma.c
> > > > +++ b/drivers/media/platform/xilinx/xilinx-dma.c
> > > > @@ -49,8 +49,7 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad)
> > > > struct media_pad *remote;
> > > >
> > > > remote = media_entity_remote_pad(local);
> > > > - if (remote = NULL ||
> > > > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > > > return NULL;
> > > >
> > > > if (pad)
> > > > @@ -113,8 +112,7 @@ static int xvip_pipeline_start_stop(struct xvip_pipeline *pipe, bool start)
> > > > break;
> > > >
> > > > pad = media_entity_remote_pad(pad);
> > > > - if (pad = NULL ||
> > > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > > break;
> > > >
> > > > entity = pad->entity;
> > > > diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> > > > index e6e1115d8215..60da43772de9 100644
> > > > --- a/drivers/media/v4l2-core/v4l2-subdev.c
> > > > +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> > > > @@ -526,7 +526,7 @@ static int
> > > > v4l2_subdev_link_validate_get_format(struct media_pad *pad,
> > > > struct v4l2_subdev_format *fmt)
> > > > {
> > > > - if (media_entity_type(pad->entity) = MEDIA_ENT_T_V4L2_SUBDEV) {
> > > > + if (is_media_entity_v4l2_subdev(pad->entity)) {
> > > > struct v4l2_subdev *sd > > > > media_entity_to_v4l2_subdev(pad->entity);
> > > >
> > > > diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > > > index 92573fa852a9..16763e0831f2 100644
> > > > --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > > > +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > > > @@ -148,7 +148,7 @@ static void vpfe_prepare_pipeline(struct vpfe_video_device *video)
> > > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > > > if (entity = &video->video_dev.entity)
> > > > continue;
> > > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > > + if ((!is_media_entity_v4l2_io(remote->entity))
> > > > continue;
> > > > far_end = to_vpfe_video(media_entity_to_video_device(entity));
> > > > if (far_end->type = V4L2_BUF_TYPE_VIDEO_OUTPUT)
> > > > @@ -293,7 +293,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline *pipe)
> > > > media_entity_graph_walk_start(&graph, entity);
> > > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > > >
> > > > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > > > + if !is_media_entity_v4l2_subdev(entity))
> > > > continue;
> > > > subdev = media_entity_to_v4l2_subdev(entity);
> > > > ret = v4l2_subdev_call(subdev, video, s_stream, 1);
> > > > @@ -334,7 +334,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe)
> > > >
> > > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > > >
> > > > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > > > + if (!is_media_entity_v4l2_subdev(entity))
> > > > continue;
> > > > subdev = media_entity_to_v4l2_subdev(entity);
> > > > ret = v4l2_subdev_call(subdev, video, s_stream, 0);
> > > > diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> > > > index 40591963b42b..44b88ff3ba83 100644
> > > > --- a/drivers/staging/media/omap4iss/iss.c
> > > > +++ b/drivers/staging/media/omap4iss/iss.c
> > > > @@ -397,7 +397,7 @@ static int iss_pipeline_pm_use_count(struct media_entity *entity)
> > > > media_entity_graph_walk_start(&graph, entity);
> > > >
> > > > while ((entity = media_entity_graph_walk_next(&graph))) {
> > > > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > > > + if (is_media_entity_v4l2_io(entity))
> > > > use += entity->use_count;
> > > > }
> > > >
> > > > @@ -419,7 +419,7 @@ static int iss_pipeline_pm_power_one(struct media_entity *entity, int change)
> > > > {
> > > > struct v4l2_subdev *subdev;
> > > >
> > > > - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> > > > + subdev = is_media_entity_v4l2_subdev(entity)
> > > > ? media_entity_to_v4l2_subdev(entity) : NULL;
> > > >
> > > > if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> > > > @@ -461,7 +461,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)
> > > > media_entity_graph_walk_start(&graph, entity);
> > > >
> > > > while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> > > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > > + if (is_media_entity_v4l2_subdev(entity))
> > > > ret = iss_pipeline_pm_power_one(entity, change);
> > > >
> > > > if (!ret)
> > > > @@ -471,7 +471,7 @@ static int iss_pipeline_pm_power(struct media_entity *entity, int change)
> > > >
> > > > while ((first = media_entity_graph_walk_next(&graph))
> > > > && first != entity)
> > > > - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> > > > + if (is_media_entity_v4l2_subdev(first))
> > > > iss_pipeline_pm_power_one(first, -change);
> > > >
> > > > return ret;
> > > > @@ -590,8 +590,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe,
> > > > break;
> > > >
> > > > pad = media_entity_remote_pad(pad);
> > > > - if (pad = NULL ||
> > > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > > break;
> > > >
> > > > entity = pad->entity;
> > > > @@ -658,8 +657,7 @@ static int iss_pipeline_enable(struct iss_pipeline *pipe,
> > > > break;
> > > >
> > > > pad = media_entity_remote_pad(pad);
> > > > - if (pad = NULL ||
> > > > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > > > break;
> > > >
> > > > entity = pad->entity;
> > > > diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
> > > > index 45a3f2d778fc..cbe5783735dc 100644
> > > > --- a/drivers/staging/media/omap4iss/iss_video.c
> > > > +++ b/drivers/staging/media/omap4iss/iss_video.c
> > > > @@ -191,8 +191,7 @@ iss_video_remote_subdev(struct iss_video *video, u32 *pad)
> > > >
> > > > remote = media_entity_remote_pad(&video->pad);
> > > >
> > > > - if (remote = NULL ||
> > > > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > > > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > > > return NULL;
> > > >
> > > > if (pad)
> > > > @@ -217,7 +216,7 @@ iss_video_far_end(struct iss_video *video)
> > > > if (entity = &video->video.entity)
> > > > continue;
> > > >
> > > > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > > > + if (!is_media_entity_v4l2_io(entity))
> > > > continue;
> > > >
> > > > far_end = to_iss_video(media_entity_to_video_device(entity));
> > >
> > > I finally got around to test these patches eventually, and after some
> > > debugging found this one. I think it's a good idea to have macros to
> > > determine whether an entity exposes a V4L2 sub-device interface but it
> > > should be more robust than is_media_entity_v4l2_subdev() right now is.
> >
> > Hmm... Not sure what you're meaning... the V4L2 sub-device interface is
> > actually a separate graph object (interfaces). Those macros work at the
> > entities, not at the interface objects.
>
> is_media_entity_v4l2_subdev() will produce wrong results for a large part of
> V4L2 sub-devices with these patches applied.
>
> I checked again the original implementation, and it seems to be based only
> on the type as well, albeit that's a range, not a set of different
> functions.
Yes. As we're getting rid of ranges for subdevs, we need to change the
implementation. Your patch does the job by recognizing the "unknown"
subdevs.
> I suppose this will change at some point in the future: the interface indeed
> should not be determined by the function of the entity. At least it needs to
> be fixed now until the rework. I'll submit a patch for that.
>
Thanks!
Mauro
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities
2015-08-30 3:06 ` [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities Mauro Carvalho Chehab
2015-10-11 21:07 ` Sakari Ailus
@ 2015-12-06 2:16 ` Laurent Pinchart
2015-12-08 16:03 ` Mauro Carvalho Chehab
1 sibling, 1 reply; 17+ messages in thread
From: Laurent Pinchart @ 2015-12-06 2:16 UTC (permalink / raw)
To: linux-arm-kernel
Hi Mauro,
Thank you for the patch.
On Sunday 30 August 2015 00:06:43 Mauro Carvalho Chehab wrote:
> Instead of relying on media subtype, use the new macros to detect
> if an entity is a subdev or an A/V DMA entity.
>
> Please note that most drivers assume that there's just AV_DMA or
> V4L2 subdevs. This is not true anymore, as we've added MC support
> for DVB, and there are plans to add support for ALSA and FB/DRM
> too.
>
> Ok, on the current pipelines supported by those drivers, just V4L
> stuff are there, but, assuming that some day a pipeline that also
> works with other subsystems will ever added, it is better to add
> explicit checks for the AV_DMA stuff.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>
> diff --git a/drivers/media/platform/exynos4-is/common.c
> b/drivers/media/platform/exynos4-is/common.c index
> 0eb34ecb8ee4..8c9a29e0e294 100644
> --- a/drivers/media/platform/exynos4-is/common.c
> +++ b/drivers/media/platform/exynos4-is/common.c
> @@ -22,8 +22,7 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct
> media_entity *entity) while (pad->flags & MEDIA_PAD_FL_SINK) {
> /* source pad */
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> sd = media_entity_to_v4l2_subdev(pad->entity);
> diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c
> b/drivers/media/platform/exynos4-is/fimc-capture.c index
> 0627a93b2f3b..e9810fee4c30 100644
> --- a/drivers/media/platform/exynos4-is/fimc-capture.c
> +++ b/drivers/media/platform/exynos4-is/fimc-capture.c
> @@ -1141,8 +1141,7 @@ static int fimc_pipeline_validate(struct fimc_dev
> *fimc) }
> }
>
> - if (src_pad = NULL ||
> - media_entity_type(src_pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!src_pad || !is_media_entity_v4l2_subdev(src_pad->entity))
> break;
>
> /* Don't call FIMC subdev operation to avoid nested locking */
> @@ -1397,7 +1396,7 @@ static int fimc_link_setup(struct media_entity
> *entity, struct fimc_vid_cap *vc = &fimc->vid_cap;
> struct v4l2_subdev *sensor;
>
> - if (media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!is_media_entity_v4l2_subdev(remote->entity))
> return -EINVAL;
>
> if (WARN_ON(fimc = NULL))
> diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c
> b/drivers/media/platform/exynos4-is/fimc-isp-video.c index
> 3d9ccbf5f10f..5fbaf5e39903 100644
> --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
> +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> @@ -467,8 +467,7 @@ static int isp_video_pipeline_validate(struct fimc_isp
> *isp)
>
> /* Retrieve format at the source pad */
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> sd = media_entity_to_v4l2_subdev(pad->entity);
> diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c
> b/drivers/media/platform/exynos4-is/fimc-lite.c index
> b2607da4ad14..c2327147b360 100644
> --- a/drivers/media/platform/exynos4-is/fimc-lite.c
> +++ b/drivers/media/platform/exynos4-is/fimc-lite.c
> @@ -814,8 +814,7 @@ static int fimc_pipeline_validate(struct fimc_lite
> *fimc) }
> /* Retrieve format at the source pad */
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> sd = media_entity_to_v4l2_subdev(pad->entity);
> @@ -988,7 +987,6 @@ static int fimc_lite_link_setup(struct media_entity
> *entity, {
> struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
> struct fimc_lite *fimc = v4l2_get_subdevdata(sd);
> - unsigned int remote_ent_type = media_entity_type(remote->entity);
> int ret = 0;
>
> if (WARN_ON(fimc = NULL))
> @@ -1000,7 +998,7 @@ static int fimc_lite_link_setup(struct media_entity
> *entity,
>
> switch (local->index) {
> case FLITE_SD_PAD_SINK:
> - if (remote_ent_type != MEDIA_ENT_T_V4L2_SUBDEV) {
> + if (!is_media_entity_v4l2_subdev(remote->entity)) {
> ret = -EINVAL;
> break;
> }
> @@ -1018,7 +1016,7 @@ static int fimc_lite_link_setup(struct media_entity
> *entity, case FLITE_SD_PAD_SOURCE_DMA:
> if (!(flags & MEDIA_LNK_FL_ENABLED))
> atomic_set(&fimc->out_path, FIMC_IO_NONE);
> - else if (remote_ent_type = MEDIA_ENT_T_DEVNODE)
> + else if (is_media_entity_v4l2_io(remote->entity))
> atomic_set(&fimc->out_path, FIMC_IO_DMA);
> else
> ret = -EINVAL;
> @@ -1027,7 +1025,7 @@ static int fimc_lite_link_setup(struct media_entity
> *entity, case FLITE_SD_PAD_SOURCE_ISP:
> if (!(flags & MEDIA_LNK_FL_ENABLED))
> atomic_set(&fimc->out_path, FIMC_IO_NONE);
> - else if (remote_ent_type = MEDIA_ENT_T_V4L2_SUBDEV)
> + else if (is_media_entity_v4l2_subdev(remote->entity))
> atomic_set(&fimc->out_path, FIMC_IO_ISP);
> else
> ret = -EINVAL;
> diff --git a/drivers/media/platform/exynos4-is/media-dev.c
> b/drivers/media/platform/exynos4-is/media-dev.c index
> 92dbade2fffc..4a25df9dd869 100644
> --- a/drivers/media/platform/exynos4-is/media-dev.c
> +++ b/drivers/media/platform/exynos4-is/media-dev.c
> @@ -88,8 +88,7 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,
> break;
> }
>
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
> sd = media_entity_to_v4l2_subdev(pad->entity);
>
> @@ -1062,7 +1061,7 @@ static int __fimc_md_modify_pipelines(struct
> media_entity *entity, bool enable) media_entity_graph_walk_start(&graph,
> entity);
>
> while ((entity = media_entity_graph_walk_next(&graph))) {
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if (!is_media_entity_v4l2_io(entity))
> continue;
>
> ret = __fimc_md_modify_pipeline(entity, enable);
> @@ -1076,7 +1075,7 @@ static int __fimc_md_modify_pipelines(struct
> media_entity *entity, bool enable) media_entity_graph_walk_start(&graph,
> entity_err);
>
> while ((entity_err = media_entity_graph_walk_next(&graph))) {
> - if (media_entity_type(entity_err) != MEDIA_ENT_T_DEVNODE)
> + if (!is_media_entity_v4l2_io(entity_err))
> continue;
>
> __fimc_md_modify_pipeline(entity_err, !enable);
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index 69e7733d36cd..cb8ac90086c1
> 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -691,7 +691,7 @@ static int isp_pipeline_pm_use_count(struct media_entity
> *entity) media_entity_graph_walk_start(&graph, entity);
>
> while ((entity = media_entity_graph_walk_next(&graph))) {
> - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_io(entity))
> use += entity->use_count;
> }
>
> @@ -714,7 +714,7 @@ static int isp_pipeline_pm_power_one(struct media_entity
> *entity, int change) struct v4l2_subdev *subdev;
> int ret;
>
> - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> + subdev = is_media_entity_v4l2_subdev(entity)
> ? media_entity_to_v4l2_subdev(entity) : NULL;
>
> if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> @@ -754,7 +754,7 @@ static int isp_pipeline_pm_power(struct media_entity
> *entity, int change) media_entity_graph_walk_start(&graph, entity);
>
> while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_subdev(entity))
> ret = isp_pipeline_pm_power_one(entity, change);
>
> if (!ret)
> @@ -764,7 +764,7 @@ static int isp_pipeline_pm_power(struct media_entity
> *entity, int change)
>
> while ((first = media_entity_graph_walk_next(&graph))
> && first != entity)
> - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_subdev(first))
> isp_pipeline_pm_power_one(first, -change);
>
> return ret;
> @@ -897,8 +897,7 @@ static int isp_pipeline_enable(struct isp_pipeline
> *pipe, break;
>
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = pad->entity;
> @@ -988,8 +987,7 @@ static int isp_pipeline_disable(struct isp_pipeline
> *pipe) break;
>
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = pad->entity;
> diff --git a/drivers/media/platform/omap3isp/ispvideo.c
> b/drivers/media/platform/omap3isp/ispvideo.c index
> 4c367352b1f7..52843ac2a9ca 100644
> --- a/drivers/media/platform/omap3isp/ispvideo.c
> +++ b/drivers/media/platform/omap3isp/ispvideo.c
> @@ -210,8 +210,7 @@ isp_video_remote_subdev(struct isp_video *video, u32
> *pad)
>
> remote = media_entity_remote_pad(&video->pad);
>
> - if (remote = NULL ||
> - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> return NULL;
>
> if (pad)
> @@ -243,7 +242,7 @@ static int isp_video_get_graph_data(struct isp_video
> *video, if (entity = &video->video.entity)
> continue;
>
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if (!is_media_entity_v4l2_io(entity))
> continue;
>
> __video = to_isp_video(media_entity_to_video_device(entity));
> @@ -917,7 +916,7 @@ static int isp_video_check_external_subdevs(struct
> isp_video *video, return -EINVAL;
> }
>
> - if (media_entity_type(source) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!is_media_entity_v4l2_subdev(source))
> return 0;
>
> pipe->external = media_entity_to_v4l2_subdev(source);
> diff --git a/drivers/media/platform/s3c-camif/camif-capture.c
> b/drivers/media/platform/s3c-camif/camif-capture.c index
> eae667eab1b9..fb5b016cc0a1 100644
> --- a/drivers/media/platform/s3c-camif/camif-capture.c
> +++ b/drivers/media/platform/s3c-camif/camif-capture.c
> @@ -837,7 +837,7 @@ static int camif_pipeline_validate(struct camif_dev
> *camif)
>
> /* Retrieve format at the sensor subdev source pad */
> pad = media_entity_remote_pad(&camif->pads[0]);
> - if (!pad || media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> return -EPIPE;
>
> src_fmt.pad = pad->index;
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c
> b/drivers/media/platform/vsp1/vsp1_video.c index 1f94c1a54e00..f74158224b93
> 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -160,8 +160,7 @@ vsp1_video_remote_subdev(struct media_pad *local, u32
> *pad) struct media_pad *remote;
>
> remote = media_entity_remote_pad(local);
> - if (remote = NULL ||
> - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> return NULL;
>
> if (pad)
> @@ -326,7 +325,7 @@ static int vsp1_pipeline_validate_branch(struct
> vsp1_pipeline *pipe, return -EPIPE;
>
> /* We've reached a video node, that shouldn't have happened. */
> - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!is_media_entity_v4l2_subdev(pad->entity))
> return -EPIPE;
>
> entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> @@ -423,7 +422,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline
> *pipe, struct vsp1_rwpf *rwpf;
> struct vsp1_entity *e;
>
> - if (media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV) {
> + if (is_media_entity_v4l2_io(entity)) {
> pipe->num_video++;
> continue;
> }
> @@ -692,7 +691,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline
> *pipe, pad = media_entity_remote_pad(&input->pads[RWPF_PAD_SOURCE]);
>
> while (pad) {
> - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> diff --git a/drivers/media/platform/xilinx/xilinx-dma.c
> b/drivers/media/platform/xilinx/xilinx-dma.c index
> 88cd789cdaf7..8e14841bf445 100644
> --- a/drivers/media/platform/xilinx/xilinx-dma.c
> +++ b/drivers/media/platform/xilinx/xilinx-dma.c
> @@ -49,8 +49,7 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad)
> struct media_pad *remote;
>
> remote = media_entity_remote_pad(local);
> - if (remote = NULL ||
> - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> return NULL;
>
> if (pad)
> @@ -113,8 +112,7 @@ static int xvip_pipeline_start_stop(struct xvip_pipeline
> *pipe, bool start) break;
>
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = pad->entity;
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c
> b/drivers/media/v4l2-core/v4l2-subdev.c index e6e1115d8215..60da43772de9
> 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -526,7 +526,7 @@ static int
> v4l2_subdev_link_validate_get_format(struct media_pad *pad,
> struct v4l2_subdev_format *fmt)
> {
> - if (media_entity_type(pad->entity) = MEDIA_ENT_T_V4L2_SUBDEV) {
> + if (is_media_entity_v4l2_subdev(pad->entity)) {
> struct v4l2_subdev *sd > media_entity_to_v4l2_subdev(pad->entity);
>
> diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c
> b/drivers/staging/media/davinci_vpfe/vpfe_video.c index
> 92573fa852a9..16763e0831f2 100644
> --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
> +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> @@ -148,7 +148,7 @@ static void vpfe_prepare_pipeline(struct
> vpfe_video_device *video) while ((entity > media_entity_graph_walk_next(&graph))) {
> if (entity = &video->video_dev.entity)
> continue;
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if ((!is_media_entity_v4l2_io(remote->entity))
> continue;
> far_end = to_vpfe_video(media_entity_to_video_device(entity));
> if (far_end->type = V4L2_BUF_TYPE_VIDEO_OUTPUT)
> @@ -293,7 +293,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline
> *pipe) media_entity_graph_walk_start(&graph, entity);
> while ((entity = media_entity_graph_walk_next(&graph))) {
>
> - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> + if !is_media_entity_v4l2_subdev(entity))
With these two chunks fixed,
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
I'm wondering, however, why you replace some occurrences of =
MEDIA_ENT_T_DEVNODE with !is_media_entity_v4l2_subdev and some other with
is_media_entity_v4l2_io.
> continue;
> subdev = media_entity_to_v4l2_subdev(entity);
> ret = v4l2_subdev_call(subdev, video, s_stream, 1);
> @@ -334,7 +334,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline
> *pipe)
>
> while ((entity = media_entity_graph_walk_next(&graph))) {
>
> - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> + if (!is_media_entity_v4l2_subdev(entity))
> continue;
> subdev = media_entity_to_v4l2_subdev(entity);
> ret = v4l2_subdev_call(subdev, video, s_stream, 0);
> diff --git a/drivers/staging/media/omap4iss/iss.c
> b/drivers/staging/media/omap4iss/iss.c index 40591963b42b..44b88ff3ba83
> 100644
> --- a/drivers/staging/media/omap4iss/iss.c
> +++ b/drivers/staging/media/omap4iss/iss.c
> @@ -397,7 +397,7 @@ static int iss_pipeline_pm_use_count(struct media_entity
> *entity) media_entity_graph_walk_start(&graph, entity);
>
> while ((entity = media_entity_graph_walk_next(&graph))) {
> - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_io(entity))
> use += entity->use_count;
> }
>
> @@ -419,7 +419,7 @@ static int iss_pipeline_pm_power_one(struct media_entity
> *entity, int change) {
> struct v4l2_subdev *subdev;
>
> - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> + subdev = is_media_entity_v4l2_subdev(entity)
> ? media_entity_to_v4l2_subdev(entity) : NULL;
>
> if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> @@ -461,7 +461,7 @@ static int iss_pipeline_pm_power(struct media_entity
> *entity, int change) media_entity_graph_walk_start(&graph, entity);
>
> while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_subdev(entity))
> ret = iss_pipeline_pm_power_one(entity, change);
>
> if (!ret)
> @@ -471,7 +471,7 @@ static int iss_pipeline_pm_power(struct media_entity
> *entity, int change)
>
> while ((first = media_entity_graph_walk_next(&graph))
> && first != entity)
> - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> + if (is_media_entity_v4l2_subdev(first))
> iss_pipeline_pm_power_one(first, -change);
>
> return ret;
> @@ -590,8 +590,7 @@ static int iss_pipeline_disable(struct iss_pipeline
> *pipe, break;
>
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = pad->entity;
> @@ -658,8 +657,7 @@ static int iss_pipeline_enable(struct iss_pipeline
> *pipe, break;
>
> pad = media_entity_remote_pad(pad);
> - if (pad = NULL ||
> - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> break;
>
> entity = pad->entity;
> diff --git a/drivers/staging/media/omap4iss/iss_video.c
> b/drivers/staging/media/omap4iss/iss_video.c index
> 45a3f2d778fc..cbe5783735dc 100644
> --- a/drivers/staging/media/omap4iss/iss_video.c
> +++ b/drivers/staging/media/omap4iss/iss_video.c
> @@ -191,8 +191,7 @@ iss_video_remote_subdev(struct iss_video *video, u32
> *pad)
>
> remote = media_entity_remote_pad(&video->pad);
>
> - if (remote = NULL ||
> - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> return NULL;
>
> if (pad)
> @@ -217,7 +216,7 @@ iss_video_far_end(struct iss_video *video)
> if (entity = &video->video.entity)
> continue;
>
> - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> + if (!is_media_entity_v4l2_io(entity))
> continue;
>
> far_end = to_iss_video(media_entity_to_video_device(entity));
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v8 01/55] [media] media: create a macro to get entity ID
2015-08-30 3:06 ` [PATCH v8 01/55] [media] media: create a macro to get entity ID Mauro Carvalho Chehab
2015-09-10 13:58 ` Javier Martinez Canillas
@ 2015-12-06 3:20 ` Laurent Pinchart
1 sibling, 0 replies; 17+ messages in thread
From: Laurent Pinchart @ 2015-12-06 3:20 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Media Mailing List, Mauro Carvalho Chehab, linux-sh
Hi Mauro,
Thank you for the patch.
On Sunday 30 August 2015 00:06:12 Mauro Carvalho Chehab wrote:
> Instead of accessing directly entity.id, let's create a macro,
> as this field will be moved into a common struct later on.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index c55ab5029323..e429605ca2c3 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -77,8 +77,8 @@ static struct media_entity *find_entity(struct
> media_device *mdev, u32 id) spin_lock(&mdev->lock);
>
> media_device_for_each_entity(entity, mdev) {
> - if ((entity->id = id && !next) ||
> - (entity->id > id && next)) {
> + if (((media_entity_id(entity) = id) && !next) ||
> + ((media_entity_id(entity) > id) && next)) {
> spin_unlock(&mdev->lock);
> return entity;
> }
> @@ -104,7 +104,7 @@ static long media_device_enum_entities(struct
> media_device *mdev, if (ent = NULL)
> return -EINVAL;
>
> - u_ent.id = ent->id;
> + u_ent.id = media_entity_id(ent);
> if (ent->name)
> strlcpy(u_ent.name, ent->name, sizeof(u_ent.name));
> u_ent.type = ent->type;
> @@ -122,7 +122,7 @@ static long media_device_enum_entities(struct
> media_device *mdev, static void media_device_kpad_to_upad(const struct
> media_pad *kpad, struct media_pad_desc *upad)
> {
> - upad->entity = kpad->entity->id;
> + upad->entity = media_entity_id(kpad->entity);
> upad->index = kpad->index;
> upad->flags = kpad->flags;
> }
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 949e5f92cbdc..cb0ac4e0dfa5 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -140,10 +140,10 @@ void media_entity_graph_walk_start(struct
> media_entity_graph *graph, graph->stack[graph->top].entity = NULL;
> bitmap_zero(graph->entities, MEDIA_ENTITY_ENUM_MAX_ID);
>
> - if (WARN_ON(entity->id >= MEDIA_ENTITY_ENUM_MAX_ID))
> + if (WARN_ON(media_entity_id(entity) >= MEDIA_ENTITY_ENUM_MAX_ID))
> return;
>
> - __set_bit(entity->id, graph->entities);
> + __set_bit(media_entity_id(entity), graph->entities);
> stack_push(graph, entity);
> }
> EXPORT_SYMBOL_GPL(media_entity_graph_walk_start);
> @@ -184,11 +184,11 @@ media_entity_graph_walk_next(struct media_entity_graph
> *graph)
>
> /* Get the entity in the other end of the link . */
> next = media_entity_other(entity, link);
> - if (WARN_ON(next->id >= MEDIA_ENTITY_ENUM_MAX_ID))
> + if (WARN_ON(media_entity_id(next) >= MEDIA_ENTITY_ENUM_MAX_ID))
> return NULL;
>
> /* Has the entity already been visited? */
> - if (__test_and_set_bit(next->id, graph->entities)) {
> + if (__test_and_set_bit(media_entity_id(next), graph->entities)) {
> link_top(graph)++;
> continue;
> }
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c
> b/drivers/media/platform/vsp1/vsp1_video.c index 17f08973f835..debe4e539df6
> 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -352,10 +352,10 @@ static int vsp1_pipeline_validate_branch(struct
> vsp1_pipeline *pipe, break;
>
> /* Ensure the branch has no loop. */
> - if (entities & (1 << entity->subdev.entity.id))
> + if (entities & (1 << media_entity_id(&entity->subdev.entity)))
> return -EPIPE;
>
> - entities |= 1 << entity->subdev.entity.id;
> + entities |= 1 << media_entity_id(&entity->subdev.entity);
>
> /* UDS can't be chained. */
> if (entity->type = VSP1_ENTITY_UDS) {
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 8b21a4d920d9..0a66fc225559 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -113,6 +113,11 @@ static inline u32 media_entity_subtype(struct
> media_entity *entity) return entity->type & MEDIA_ENT_SUBTYPE_MASK;
> }
>
> +static inline u32 media_entity_id(struct media_entity *entity)
> +{
> + return entity->id;
> +}
> +
> #define MEDIA_ENTITY_ENUM_MAX_DEPTH 16
> #define MEDIA_ENTITY_ENUM_MAX_ID 64
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities
2015-12-06 2:16 ` [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities Laurent Pinchart
@ 2015-12-08 16:03 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 17+ messages in thread
From: Mauro Carvalho Chehab @ 2015-12-08 16:03 UTC (permalink / raw)
To: linux-arm-kernel
Em Sun, 06 Dec 2015 04:16:15 +0200
Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:
> Hi Mauro,
>
> Thank you for the patch.
>
> On Sunday 30 August 2015 00:06:43 Mauro Carvalho Chehab wrote:
> > Instead of relying on media subtype, use the new macros to detect
> > if an entity is a subdev or an A/V DMA entity.
> >
> > Please note that most drivers assume that there's just AV_DMA or
> > V4L2 subdevs. This is not true anymore, as we've added MC support
> > for DVB, and there are plans to add support for ALSA and FB/DRM
> > too.
> >
> > Ok, on the current pipelines supported by those drivers, just V4L
> > stuff are there, but, assuming that some day a pipeline that also
> > works with other subsystems will ever added, it is better to add
> > explicit checks for the AV_DMA stuff.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> >
> > diff --git a/drivers/media/platform/exynos4-is/common.c
> > b/drivers/media/platform/exynos4-is/common.c index
> > 0eb34ecb8ee4..8c9a29e0e294 100644
> > --- a/drivers/media/platform/exynos4-is/common.c
> > +++ b/drivers/media/platform/exynos4-is/common.c
> > @@ -22,8 +22,7 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct
> > media_entity *entity) while (pad->flags & MEDIA_PAD_FL_SINK) {
> > /* source pad */
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > sd = media_entity_to_v4l2_subdev(pad->entity);
> > diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c
> > b/drivers/media/platform/exynos4-is/fimc-capture.c index
> > 0627a93b2f3b..e9810fee4c30 100644
> > --- a/drivers/media/platform/exynos4-is/fimc-capture.c
> > +++ b/drivers/media/platform/exynos4-is/fimc-capture.c
> > @@ -1141,8 +1141,7 @@ static int fimc_pipeline_validate(struct fimc_dev
> > *fimc) }
> > }
> >
> > - if (src_pad = NULL ||
> > - media_entity_type(src_pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!src_pad || !is_media_entity_v4l2_subdev(src_pad->entity))
> > break;
> >
> > /* Don't call FIMC subdev operation to avoid nested locking */
> > @@ -1397,7 +1396,7 @@ static int fimc_link_setup(struct media_entity
> > *entity, struct fimc_vid_cap *vc = &fimc->vid_cap;
> > struct v4l2_subdev *sensor;
> >
> > - if (media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!is_media_entity_v4l2_subdev(remote->entity))
> > return -EINVAL;
> >
> > if (WARN_ON(fimc = NULL))
> > diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > b/drivers/media/platform/exynos4-is/fimc-isp-video.c index
> > 3d9ccbf5f10f..5fbaf5e39903 100644
> > --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
> > @@ -467,8 +467,7 @@ static int isp_video_pipeline_validate(struct fimc_isp
> > *isp)
> >
> > /* Retrieve format at the source pad */
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > sd = media_entity_to_v4l2_subdev(pad->entity);
> > diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c
> > b/drivers/media/platform/exynos4-is/fimc-lite.c index
> > b2607da4ad14..c2327147b360 100644
> > --- a/drivers/media/platform/exynos4-is/fimc-lite.c
> > +++ b/drivers/media/platform/exynos4-is/fimc-lite.c
> > @@ -814,8 +814,7 @@ static int fimc_pipeline_validate(struct fimc_lite
> > *fimc) }
> > /* Retrieve format at the source pad */
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > sd = media_entity_to_v4l2_subdev(pad->entity);
> > @@ -988,7 +987,6 @@ static int fimc_lite_link_setup(struct media_entity
> > *entity, {
> > struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
> > struct fimc_lite *fimc = v4l2_get_subdevdata(sd);
> > - unsigned int remote_ent_type = media_entity_type(remote->entity);
> > int ret = 0;
> >
> > if (WARN_ON(fimc = NULL))
> > @@ -1000,7 +998,7 @@ static int fimc_lite_link_setup(struct media_entity
> > *entity,
> >
> > switch (local->index) {
> > case FLITE_SD_PAD_SINK:
> > - if (remote_ent_type != MEDIA_ENT_T_V4L2_SUBDEV) {
> > + if (!is_media_entity_v4l2_subdev(remote->entity)) {
> > ret = -EINVAL;
> > break;
> > }
> > @@ -1018,7 +1016,7 @@ static int fimc_lite_link_setup(struct media_entity
> > *entity, case FLITE_SD_PAD_SOURCE_DMA:
> > if (!(flags & MEDIA_LNK_FL_ENABLED))
> > atomic_set(&fimc->out_path, FIMC_IO_NONE);
> > - else if (remote_ent_type = MEDIA_ENT_T_DEVNODE)
> > + else if (is_media_entity_v4l2_io(remote->entity))
> > atomic_set(&fimc->out_path, FIMC_IO_DMA);
> > else
> > ret = -EINVAL;
> > @@ -1027,7 +1025,7 @@ static int fimc_lite_link_setup(struct media_entity
> > *entity, case FLITE_SD_PAD_SOURCE_ISP:
> > if (!(flags & MEDIA_LNK_FL_ENABLED))
> > atomic_set(&fimc->out_path, FIMC_IO_NONE);
> > - else if (remote_ent_type = MEDIA_ENT_T_V4L2_SUBDEV)
> > + else if (is_media_entity_v4l2_subdev(remote->entity))
> > atomic_set(&fimc->out_path, FIMC_IO_ISP);
> > else
> > ret = -EINVAL;
> > diff --git a/drivers/media/platform/exynos4-is/media-dev.c
> > b/drivers/media/platform/exynos4-is/media-dev.c index
> > 92dbade2fffc..4a25df9dd869 100644
> > --- a/drivers/media/platform/exynos4-is/media-dev.c
> > +++ b/drivers/media/platform/exynos4-is/media-dev.c
> > @@ -88,8 +88,7 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,
> > break;
> > }
> >
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> > sd = media_entity_to_v4l2_subdev(pad->entity);
> >
> > @@ -1062,7 +1061,7 @@ static int __fimc_md_modify_pipelines(struct
> > media_entity *entity, bool enable) media_entity_graph_walk_start(&graph,
> > entity);
> >
> > while ((entity = media_entity_graph_walk_next(&graph))) {
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if (!is_media_entity_v4l2_io(entity))
> > continue;
> >
> > ret = __fimc_md_modify_pipeline(entity, enable);
> > @@ -1076,7 +1075,7 @@ static int __fimc_md_modify_pipelines(struct
> > media_entity *entity, bool enable) media_entity_graph_walk_start(&graph,
> > entity_err);
> >
> > while ((entity_err = media_entity_graph_walk_next(&graph))) {
> > - if (media_entity_type(entity_err) != MEDIA_ENT_T_DEVNODE)
> > + if (!is_media_entity_v4l2_io(entity_err))
> > continue;
> >
> > __fimc_md_modify_pipeline(entity_err, !enable);
> > diff --git a/drivers/media/platform/omap3isp/isp.c
> > b/drivers/media/platform/omap3isp/isp.c index 69e7733d36cd..cb8ac90086c1
> > 100644
> > --- a/drivers/media/platform/omap3isp/isp.c
> > +++ b/drivers/media/platform/omap3isp/isp.c
> > @@ -691,7 +691,7 @@ static int isp_pipeline_pm_use_count(struct media_entity
> > *entity) media_entity_graph_walk_start(&graph, entity);
> >
> > while ((entity = media_entity_graph_walk_next(&graph))) {
> > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_io(entity))
> > use += entity->use_count;
> > }
> >
> > @@ -714,7 +714,7 @@ static int isp_pipeline_pm_power_one(struct media_entity
> > *entity, int change) struct v4l2_subdev *subdev;
> > int ret;
> >
> > - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> > + subdev = is_media_entity_v4l2_subdev(entity)
> > ? media_entity_to_v4l2_subdev(entity) : NULL;
> >
> > if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> > @@ -754,7 +754,7 @@ static int isp_pipeline_pm_power(struct media_entity
> > *entity, int change) media_entity_graph_walk_start(&graph, entity);
> >
> > while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_subdev(entity))
> > ret = isp_pipeline_pm_power_one(entity, change);
> >
> > if (!ret)
> > @@ -764,7 +764,7 @@ static int isp_pipeline_pm_power(struct media_entity
> > *entity, int change)
> >
> > while ((first = media_entity_graph_walk_next(&graph))
> > && first != entity)
> > - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_subdev(first))
> > isp_pipeline_pm_power_one(first, -change);
> >
> > return ret;
> > @@ -897,8 +897,7 @@ static int isp_pipeline_enable(struct isp_pipeline
> > *pipe, break;
> >
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = pad->entity;
> > @@ -988,8 +987,7 @@ static int isp_pipeline_disable(struct isp_pipeline
> > *pipe) break;
> >
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = pad->entity;
> > diff --git a/drivers/media/platform/omap3isp/ispvideo.c
> > b/drivers/media/platform/omap3isp/ispvideo.c index
> > 4c367352b1f7..52843ac2a9ca 100644
> > --- a/drivers/media/platform/omap3isp/ispvideo.c
> > +++ b/drivers/media/platform/omap3isp/ispvideo.c
> > @@ -210,8 +210,7 @@ isp_video_remote_subdev(struct isp_video *video, u32
> > *pad)
> >
> > remote = media_entity_remote_pad(&video->pad);
> >
> > - if (remote = NULL ||
> > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > return NULL;
> >
> > if (pad)
> > @@ -243,7 +242,7 @@ static int isp_video_get_graph_data(struct isp_video
> > *video, if (entity = &video->video.entity)
> > continue;
> >
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if (!is_media_entity_v4l2_io(entity))
> > continue;
> >
> > __video = to_isp_video(media_entity_to_video_device(entity));
> > @@ -917,7 +916,7 @@ static int isp_video_check_external_subdevs(struct
> > isp_video *video, return -EINVAL;
> > }
> >
> > - if (media_entity_type(source) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!is_media_entity_v4l2_subdev(source))
> > return 0;
> >
> > pipe->external = media_entity_to_v4l2_subdev(source);
> > diff --git a/drivers/media/platform/s3c-camif/camif-capture.c
> > b/drivers/media/platform/s3c-camif/camif-capture.c index
> > eae667eab1b9..fb5b016cc0a1 100644
> > --- a/drivers/media/platform/s3c-camif/camif-capture.c
> > +++ b/drivers/media/platform/s3c-camif/camif-capture.c
> > @@ -837,7 +837,7 @@ static int camif_pipeline_validate(struct camif_dev
> > *camif)
> >
> > /* Retrieve format at the sensor subdev source pad */
> > pad = media_entity_remote_pad(&camif->pads[0]);
> > - if (!pad || media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > return -EPIPE;
> >
> > src_fmt.pad = pad->index;
> > diff --git a/drivers/media/platform/vsp1/vsp1_video.c
> > b/drivers/media/platform/vsp1/vsp1_video.c index 1f94c1a54e00..f74158224b93
> > 100644
> > --- a/drivers/media/platform/vsp1/vsp1_video.c
> > +++ b/drivers/media/platform/vsp1/vsp1_video.c
> > @@ -160,8 +160,7 @@ vsp1_video_remote_subdev(struct media_pad *local, u32
> > *pad) struct media_pad *remote;
> >
> > remote = media_entity_remote_pad(local);
> > - if (remote = NULL ||
> > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > return NULL;
> >
> > if (pad)
> > @@ -326,7 +325,7 @@ static int vsp1_pipeline_validate_branch(struct
> > vsp1_pipeline *pipe, return -EPIPE;
> >
> > /* We've reached a video node, that shouldn't have happened. */
> > - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!is_media_entity_v4l2_subdev(pad->entity))
> > return -EPIPE;
> >
> > entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> > @@ -423,7 +422,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline
> > *pipe, struct vsp1_rwpf *rwpf;
> > struct vsp1_entity *e;
> >
> > - if (media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV) {
> > + if (is_media_entity_v4l2_io(entity)) {
> > pipe->num_video++;
> > continue;
> > }
> > @@ -692,7 +691,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline
> > *pipe, pad = media_entity_remote_pad(&input->pads[RWPF_PAD_SOURCE]);
> >
> > while (pad) {
> > - if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
> > diff --git a/drivers/media/platform/xilinx/xilinx-dma.c
> > b/drivers/media/platform/xilinx/xilinx-dma.c index
> > 88cd789cdaf7..8e14841bf445 100644
> > --- a/drivers/media/platform/xilinx/xilinx-dma.c
> > +++ b/drivers/media/platform/xilinx/xilinx-dma.c
> > @@ -49,8 +49,7 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad)
> > struct media_pad *remote;
> >
> > remote = media_entity_remote_pad(local);
> > - if (remote = NULL ||
> > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > return NULL;
> >
> > if (pad)
> > @@ -113,8 +112,7 @@ static int xvip_pipeline_start_stop(struct xvip_pipeline
> > *pipe, bool start) break;
> >
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = pad->entity;
> > diff --git a/drivers/media/v4l2-core/v4l2-subdev.c
> > b/drivers/media/v4l2-core/v4l2-subdev.c index e6e1115d8215..60da43772de9
> > 100644
> > --- a/drivers/media/v4l2-core/v4l2-subdev.c
> > +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> > @@ -526,7 +526,7 @@ static int
> > v4l2_subdev_link_validate_get_format(struct media_pad *pad,
> > struct v4l2_subdev_format *fmt)
> > {
> > - if (media_entity_type(pad->entity) = MEDIA_ENT_T_V4L2_SUBDEV) {
> > + if (is_media_entity_v4l2_subdev(pad->entity)) {
> > struct v4l2_subdev *sd > > media_entity_to_v4l2_subdev(pad->entity);
> >
> > diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > b/drivers/staging/media/davinci_vpfe/vpfe_video.c index
> > 92573fa852a9..16763e0831f2 100644
> > --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
> > @@ -148,7 +148,7 @@ static void vpfe_prepare_pipeline(struct
> > vpfe_video_device *video) while ((entity > > media_entity_graph_walk_next(&graph))) {
> > if (entity = &video->video_dev.entity)
> > continue;
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if ((!is_media_entity_v4l2_io(remote->entity))
> > continue;
> > far_end = to_vpfe_video(media_entity_to_video_device(entity));
> > if (far_end->type = V4L2_BUF_TYPE_VIDEO_OUTPUT)
> > @@ -293,7 +293,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline
> > *pipe) media_entity_graph_walk_start(&graph, entity);
> > while ((entity = media_entity_graph_walk_next(&graph))) {
> >
> > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > + if !is_media_entity_v4l2_subdev(entity))
>
> With these two chunks fixed,
>
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> I'm wondering, however, why you replace some occurrences of =
> MEDIA_ENT_T_DEVNODE with !is_media_entity_v4l2_subdev and some other with
> is_media_entity_v4l2_io.
For devices that don't have non-V4L2 media controller nodes, this would
work, but if we ever add ALSA, DVB, IIO, etc to the media controller,
then we may have troubles.
That's why I opted to add a macro for checking for the V4L2 subdev.
This is more future-proof, as other patches may be adding other
non-V4L2 types of MC entities have the potential of breaking codes like
the above.
>
> > continue;
> > subdev = media_entity_to_v4l2_subdev(entity);
> > ret = v4l2_subdev_call(subdev, video, s_stream, 1);
> > @@ -334,7 +334,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline
> > *pipe)
> >
> > while ((entity = media_entity_graph_walk_next(&graph))) {
> >
> > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > + if (!is_media_entity_v4l2_subdev(entity))
> > continue;
> > subdev = media_entity_to_v4l2_subdev(entity);
> > ret = v4l2_subdev_call(subdev, video, s_stream, 0);
> > diff --git a/drivers/staging/media/omap4iss/iss.c
> > b/drivers/staging/media/omap4iss/iss.c index 40591963b42b..44b88ff3ba83
> > 100644
> > --- a/drivers/staging/media/omap4iss/iss.c
> > +++ b/drivers/staging/media/omap4iss/iss.c
> > @@ -397,7 +397,7 @@ static int iss_pipeline_pm_use_count(struct media_entity
> > *entity) media_entity_graph_walk_start(&graph, entity);
> >
> > while ((entity = media_entity_graph_walk_next(&graph))) {
> > - if (media_entity_type(entity) = MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_io(entity))
> > use += entity->use_count;
> > }
> >
> > @@ -419,7 +419,7 @@ static int iss_pipeline_pm_power_one(struct media_entity
> > *entity, int change) {
> > struct v4l2_subdev *subdev;
> >
> > - subdev = media_entity_type(entity) = MEDIA_ENT_T_V4L2_SUBDEV
> > + subdev = is_media_entity_v4l2_subdev(entity)
> > ? media_entity_to_v4l2_subdev(entity) : NULL;
> >
> > if (entity->use_count = 0 && change > 0 && subdev != NULL) {
> > @@ -461,7 +461,7 @@ static int iss_pipeline_pm_power(struct media_entity
> > *entity, int change) media_entity_graph_walk_start(&graph, entity);
> >
> > while (!ret && (entity = media_entity_graph_walk_next(&graph)))
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_subdev(entity))
> > ret = iss_pipeline_pm_power_one(entity, change);
> >
> > if (!ret)
> > @@ -471,7 +471,7 @@ static int iss_pipeline_pm_power(struct media_entity
> > *entity, int change)
> >
> > while ((first = media_entity_graph_walk_next(&graph))
> > && first != entity)
> > - if (media_entity_type(first) != MEDIA_ENT_T_DEVNODE)
> > + if (is_media_entity_v4l2_subdev(first))
> > iss_pipeline_pm_power_one(first, -change);
> >
> > return ret;
> > @@ -590,8 +590,7 @@ static int iss_pipeline_disable(struct iss_pipeline
> > *pipe, break;
> >
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = pad->entity;
> > @@ -658,8 +657,7 @@ static int iss_pipeline_enable(struct iss_pipeline
> > *pipe, break;
> >
> > pad = media_entity_remote_pad(pad);
> > - if (pad = NULL ||
> > - media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
> > break;
> >
> > entity = pad->entity;
> > diff --git a/drivers/staging/media/omap4iss/iss_video.c
> > b/drivers/staging/media/omap4iss/iss_video.c index
> > 45a3f2d778fc..cbe5783735dc 100644
> > --- a/drivers/staging/media/omap4iss/iss_video.c
> > +++ b/drivers/staging/media/omap4iss/iss_video.c
> > @@ -191,8 +191,7 @@ iss_video_remote_subdev(struct iss_video *video, u32
> > *pad)
> >
> > remote = media_entity_remote_pad(&video->pad);
> >
> > - if (remote = NULL ||
> > - media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> > + if (!remote || !is_media_entity_v4l2_subdev(remote->entity))
> > return NULL;
> >
> > if (pad)
> > @@ -217,7 +216,7 @@ iss_video_far_end(struct iss_video *video)
> > if (entity = &video->video.entity)
> > continue;
> >
> > - if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
> > + if (!is_media_entity_v4l2_io(entity))
> > continue;
> >
> > far_end = to_iss_video(media_entity_to_video_device(entity));
>
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2015-12-08 16:03 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-30 3:06 [PATCH v8 00/55] MC next generation patches Mauro Carvalho Chehab
2015-08-30 3:06 ` [PATCH v8 01/55] [media] media: create a macro to get entity ID Mauro Carvalho Chehab
2015-09-10 13:58 ` Javier Martinez Canillas
2015-12-06 3:20 ` Laurent Pinchart
2015-08-30 3:06 ` [PATCH v8 10/55] [media] media: rename the function that create pad links Mauro Carvalho Chehab
2015-09-10 14:16 ` Javier Martinez Canillas
2015-08-30 3:06 ` [PATCH v8 11/55] [media] media: use entity.graph_obj.mdev instead of .parent Mauro Carvalho Chehab
2015-08-30 3:06 ` [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities Mauro Carvalho Chehab
2015-10-11 21:07 ` Sakari Ailus
2015-10-12 0:56 ` Mauro Carvalho Chehab
2015-10-12 15:35 ` Sakari Ailus
2015-10-12 16:00 ` Mauro Carvalho Chehab
2015-10-12 15:38 ` [PATCH 1/1] media: Correctly determine whether an entity is a sub-device Sakari Ailus
2015-10-12 15:58 ` Mauro Carvalho Chehab
2015-12-06 2:16 ` [PATCH v8 32/55] [media] media: use macros to check for V4L2 subdev entities Laurent Pinchart
2015-12-08 16:03 ` Mauro Carvalho Chehab
2015-08-30 14:27 ` [PATCH v8 00/55] MC next generation patches Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).