diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-11 17:35:07 (GMT) |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-16 10:43:13 (GMT) |
commit | 67873d4e751e400149df7ab61ba04cbb4cc0d449 (patch) | |
tree | d6496ef23cdc30420b72866ce7ffe81dc9093489 /drivers/media/usb/em28xx | |
parent | bb07bd6b6851120ac9b25bb315d62d9782d2c345 (diff) | |
download | linux-67873d4e751e400149df7ab61ba04cbb4cc0d449.tar.xz |
[media] use v4l2_mc_usb_media_device_init() on most USB devices
Except for the usbuvc driver (with has an embedded media_device
struct on it), the other drivers have a pointer to media_device.
On those drivers, replace their own implementation for the core
one. That warrants that those subdev drivers will fill the
media_device info the same way.
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 | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 06a09b4..389e95f 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -3019,24 +3019,17 @@ static int em28xx_media_device_init(struct em28xx *dev, #ifdef CONFIG_MEDIA_CONTROLLER struct media_device *mdev; - mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); + if (udev->product) { + mdev = v4l2_mc_usb_media_device_init(udev, udev->product); + } else if (udev->manufacturer) { + mdev = v4l2_mc_usb_media_device_init(udev, udev->manufacturer); + } else { + mdev = v4l2_mc_usb_media_device_init(udev, dev->name); + } + if (!mdev) return -ENOMEM; - mdev->dev = &udev->dev; - - if (!dev->name) - strlcpy(mdev->model, "unknown em28xx", sizeof(mdev->model)); - else - strlcpy(mdev->model, dev->name, sizeof(mdev->model)); - if (udev->serial) - strlcpy(mdev->serial, udev->serial, sizeof(mdev->serial)); - strcpy(mdev->bus_info, udev->devpath); - mdev->hw_revision = le16_to_cpu(udev->descriptor.bcdDevice); - mdev->driver_version = LINUX_VERSION_CODE; - - media_device_init(mdev); - dev->media_dev = mdev; #endif return 0; |