diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2013-05-31 09:37:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-12 21:16:27 -0400 |
commit | 813f5c0ac5ccf7dd9c216a8f7fbe827ca36cb83f (patch) | |
tree | f4d4ebfcea1fa7fa25d4d3b447301bef13628e6e /drivers/media/media-entity.c | |
parent | 4434adff80bf24c1c558a1605599665301185bdb (diff) |
[media] media: Change media device link_notify behaviour
Currently the media device link_notify callback is invoked before the
actual change of state of a link when the link is being enabled, and
after the actual change of state when the link is being disabled.
This doesn't allow a media device driver to perform any operations
on a full graph before a link is disabled, as well as performing
any tasks on a modified graph right after a link's state is changed.
This patch modifies signature of the link_notify callback. This
callback is now called always before and after a link's state change.
To distinguish the notifications a 'notification' argument is added
to the link_notify callback: MEDIA_DEV_NOTIFY_PRE_LINK_CH indicates
notification before link's state change and
MEDIA_DEV_NOTIFY_POST_LINK_CH corresponds to a notification after
link flags change.
[mchehab@redhat.com: whitespace cleanups]
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/media-entity.c')
-rw-r--r-- | drivers/media/media-entity.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 0438209d020a..df72f7d99d80 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c | |||
@@ -496,25 +496,17 @@ int __media_entity_setup_link(struct media_link *link, u32 flags) | |||
496 | 496 | ||
497 | mdev = source->parent; | 497 | mdev = source->parent; |
498 | 498 | ||
499 | if ((flags & MEDIA_LNK_FL_ENABLED) && mdev->link_notify) { | 499 | if (mdev->link_notify) { |
500 | ret = mdev->link_notify(link->source, link->sink, | 500 | ret = mdev->link_notify(link, flags, |
501 | MEDIA_LNK_FL_ENABLED); | 501 | MEDIA_DEV_NOTIFY_PRE_LINK_CH); |
502 | if (ret < 0) | 502 | if (ret < 0) |
503 | return ret; | 503 | return ret; |
504 | } | 504 | } |
505 | 505 | ||
506 | ret = __media_entity_setup_link_notify(link, flags); | 506 | ret = __media_entity_setup_link_notify(link, flags); |
507 | if (ret < 0) | ||
508 | goto err; | ||
509 | 507 | ||
510 | if (!(flags & MEDIA_LNK_FL_ENABLED) && mdev->link_notify) | 508 | if (mdev->link_notify) |
511 | mdev->link_notify(link->source, link->sink, 0); | 509 | mdev->link_notify(link, flags, MEDIA_DEV_NOTIFY_POST_LINK_CH); |
512 | |||
513 | return 0; | ||
514 | |||
515 | err: | ||
516 | if ((flags & MEDIA_LNK_FL_ENABLED) && mdev->link_notify) | ||
517 | mdev->link_notify(link->source, link->sink, 0); | ||
518 | 510 | ||
519 | return ret; | 511 | return ret; |
520 | } | 512 | } |