diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-22 16:10:49 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-23 11:19:39 +0100 |
commit | 6cf5dad17e913fce1ccb0c38e199eff15b0f03cc (patch) | |
tree | b039fae16d8290e8d54e4e614a1a0fb3dfd7e34a /drivers/media/usb/em28xx | |
parent | [media] media-device: move PCI/USB helper functions from v4l2-mc (diff) | |
download | linux-6cf5dad17e913fce1ccb0c38e199eff15b0f03cc.tar.xz linux-6cf5dad17e913fce1ccb0c38e199eff15b0f03cc.zip |
[media] media_device: move allocation out of media_device_*_init
Right now, media_device_pci_init and media_device_usb_init does
media_device allocation internaly. That preents its usage when
the media_device struct is embedded on some other structure.
Move memory allocation outside it, to make it more generic.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/em28xx')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-cards.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 0bae26325253..1f4047b3f3f7 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -3019,17 +3019,17 @@ static int em28xx_media_device_init(struct em28xx *dev, #ifdef CONFIG_MEDIA_CONTROLLER struct media_device *mdev; - if (udev->product) { - mdev = media_device_usb_init(udev, udev->product); - } else if (udev->manufacturer) { - mdev = media_device_usb_init(udev, udev->manufacturer); - } else { - mdev = media_device_usb_init(udev, dev->name); - } - + mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); if (!mdev) return -ENOMEM; + if (udev->product) + media_device_usb_init(mdev, udev, udev->product); + else if (udev->manufacturer) + media_device_usb_init(mdev, udev, udev->manufacturer); + else + media_device_usb_init(mdev, udev, dev->name); + dev->media_dev = mdev; #endif return 0; |