On Wed, Aug 12, 2015 at 2:14 PM, Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxx> wrote: > Removing a link is simple. Yet, better to have a separate > function for it, as we'll be also sharing it with a > public API call. > > Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxx> One thing to think about is whether or not we need some kind of callback mechanism to alert the entity on the other side of the link and other entities associated with the media device when a link is removed. This patch is fine for now and we can enhance it as and when we have the need for such notifications. -- Shuah > > diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c > index b8991d38c565..f43af2fda306 100644 > --- a/drivers/media/media-entity.c > +++ b/drivers/media/media-entity.c > @@ -484,6 +484,12 @@ static struct media_link *__media_create_link(struct media_device *mdev, > return link; > } > > +static void __media_remove_link(struct media_link *link) > +{ > + list_del(&link->list); > + kfree(link); > +} > + > static void __media_entity_remove_link(struct media_entity *entity, > struct media_link *link) > { > @@ -509,11 +515,9 @@ static void __media_entity_remove_link(struct media_entity *entity, > break; > > /* Remove the remote link */ > - list_del(&rlink->list); > - kfree(rlink); > + __media_remove_link(rlink); > } > - list_del(&link->list); > - kfree(link); > + __media_remove_link(link); > } > > int > -- > 2.4.3 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html