summaryrefslogtreecommitdiff
path: root/drivers/media/usb/au0828
diff options
context:
space:
mode:
authorShuah Khan <shuahkh@osg.samsung.com>2016-02-12 02:41:30 +0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-02-27 14:55:15 +0300
commit182dde7c5d4cd9fcac007c0798c9906fc5ea6889 (patch)
tree09ef7277f6651639819cee3521ab7ae37e24dfcf /drivers/media/usb/au0828
parent77fa4e072998705883c4dc672963b4bf7483cea9 (diff)
downloadlinux-182dde7c5d4cd9fcac007c0798c9906fc5ea6889.tar.xz
[media] media: au0828 change to use Managed Media Controller API
Change au0828 to use Managed Media Controller API to share media device and coordinate creating/deleting the shared media device with the snd-usb-audio driver. The shared media device is created as device resource of the parent usb device of the two drivers. Populate media device model with USB Device product name instead of au0828 device board name. This change is necessary because, if the media device is registered by the snd-usb-audio driver first, and it doesn't know the au0828 board name. [mchehab@osg.samsung.com: Fix merge conflicts] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/au0828')
-rw-r--r--drivers/media/usb/au0828/au0828-core.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
index 5fea4adef90b..4448399e73c5 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -134,10 +134,10 @@ static void au0828_unregister_media_device(struct au0828_dev *dev)
{
#ifdef CONFIG_MEDIA_CONTROLLER
- if (dev->media_dev) {
+ if (dev->media_dev &&
+ media_devnode_is_registered(&dev->media_dev->devnode)) {
media_device_unregister(dev->media_dev);
media_device_cleanup(dev->media_dev);
- kfree(dev->media_dev);
dev->media_dev = NULL;
}
#endif
@@ -191,14 +191,11 @@ static int au0828_media_device_init(struct au0828_dev *dev,
#ifdef CONFIG_MEDIA_CONTROLLER
struct media_device *mdev;
- mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
+ mdev = media_device_get_devres(&udev->dev);
if (!mdev)
return -ENOMEM;
- if (!dev->board.name)
- media_device_usb_init(mdev, udev, "unknown au0828");
- else
- media_device_usb_init(mdev, udev, dev->board.name);
+ media_device_usb_init(mdev, udev, udev->product);
dev->media_dev = mdev;
#endif