Commit bc5ccdbc authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] au0828: Unregister notifiers

If au0828 gets removed, we need to remove the notifiers.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
Reviewed-by: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 88336e17
...@@ -131,22 +131,36 @@ static int recv_control_msg(struct au0828_dev *dev, u16 request, u32 value, ...@@ -131,22 +131,36 @@ static int recv_control_msg(struct au0828_dev *dev, u16 request, u32 value,
return status; return status;
} }
#ifdef CONFIG_MEDIA_CONTROLLER
static void au0828_media_graph_notify(struct media_entity *new,
void *notify_data);
#endif
static void au0828_unregister_media_device(struct au0828_dev *dev) static void au0828_unregister_media_device(struct au0828_dev *dev)
{ {
#ifdef CONFIG_MEDIA_CONTROLLER #ifdef CONFIG_MEDIA_CONTROLLER
if (dev->media_dev && struct media_device *mdev = dev->media_dev;
media_devnode_is_registered(&dev->media_dev->devnode)) { struct media_entity_notify *notify, *nextp;
/* clear enable_source, disable_source */
dev->media_dev->source_priv = NULL; if (!mdev || !media_devnode_is_registered(&mdev->devnode))
dev->media_dev->enable_source = NULL; return;
dev->media_dev->disable_source = NULL;
/* Remove au0828 entity_notify callbacks */
media_device_unregister(dev->media_dev); list_for_each_entry_safe(notify, nextp, &mdev->entity_notify, list) {
media_device_cleanup(dev->media_dev); if (notify->notify != au0828_media_graph_notify)
kfree(dev->media_dev); continue;
dev->media_dev = NULL; media_device_unregister_entity_notify(mdev, notify);
} }
/* clear enable_source, disable_source */
dev->media_dev->source_priv = NULL;
dev->media_dev->enable_source = NULL;
dev->media_dev->disable_source = NULL;
media_device_unregister(dev->media_dev);
media_device_cleanup(dev->media_dev);
kfree(dev->media_dev);
dev->media_dev = NULL;
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment