Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: mc: Add num_links flag to media_pad

Maintain a counter of the links connected to a pad in the media_pad
structure. This helps checking if a pad is connected to anything, which
will be used in the pipeline building code.

Cc: stable@vger.kernel.org # 6.1
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Laurent Pinchart and committed by
Hans Verkuil
baeddf94 eb2f9321

+8
+6
drivers/media/mc/mc-entity.c
··· 1038 1038 1039 1039 /* Remove the reverse links for a data link. */ 1040 1040 if ((link->flags & MEDIA_LNK_FL_LINK_TYPE) == MEDIA_LNK_FL_DATA_LINK) { 1041 + link->source->num_links--; 1042 + link->sink->num_links--; 1043 + 1041 1044 if (link->source->entity == entity) 1042 1045 remote = link->sink->entity; 1043 1046 else ··· 1145 1142 sink->num_backlinks++; 1146 1143 sink->num_links++; 1147 1144 source->num_links++; 1145 + 1146 + link->source->num_links++; 1147 + link->sink->num_links++; 1148 1148 1149 1149 return 0; 1150 1150 }
+2
include/media/media-entity.h
··· 225 225 * @graph_obj: Embedded structure containing the media object common data 226 226 * @entity: Entity this pad belongs to 227 227 * @index: Pad index in the entity pads array, numbered from 0 to n 228 + * @num_links: Number of links connected to this pad 228 229 * @sig_type: Type of the signal inside a media pad 229 230 * @flags: Pad flags, as defined in 230 231 * :ref:`include/uapi/linux/media.h <media_header>` ··· 237 236 struct media_gobj graph_obj; /* must be first field in struct */ 238 237 struct media_entity *entity; 239 238 u16 index; 239 + u16 num_links; 240 240 enum media_pad_signal_type sig_type; 241 241 unsigned long flags; 242 242