#ifdef CONFIG_MEDIA_CONTROLLER
struct media_device *mdev;
- mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
- if (!mdev)
- return -ENOMEM;
-
- mdev->dev = &udev->dev;
-
if (!dev->board.name)
- strlcpy(mdev->model, "unknown au0828", sizeof(mdev->model));
+ mdev = v4l2_mc_usb_media_device_init(udev, "unknown au0828");
else
- strlcpy(mdev->model, dev->board.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);
+ mdev = v4l2_mc_usb_media_device_init(udev, dev->board.name);
+ if (!mdev)
+ return -ENOMEM;
dev->media_dev = mdev;
#endif
#ifdef CONFIG_MEDIA_CONTROLLER
struct media_device *mdev;
- mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
+ mdev = v4l2_mc_usb_media_device_init(udev, dev->board.name);
if (!mdev)
return -ENOMEM;
- mdev->dev = dev->dev;
- strlcpy(mdev->model, dev->board.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;
*/
#include "dvb_usb_common.h"
+#include <media/v4l2-mc.h>
static int dvb_usbv2_disable_rc_polling;
module_param_named(disable_rc_polling, dvb_usbv2_disable_rc_polling, int, 0644);
struct dvb_usb_device *d = adap_to_d(adap);
struct usb_device *udev = d->udev;
- mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
+ mdev = v4l2_mc_usb_media_device_init(udev, d->name);
if (!mdev)
return -ENOMEM;
- mdev->dev = &udev->dev;
- strlcpy(mdev->model, d->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);
-
dvb_register_media_controller(&adap->dvb_adap, mdev);
dev_info(&d->udev->dev, "media controller created\n");
* linux-dvb API.
*/
#include "dvb-usb-common.h"
+#include <media/v4l2-mc.h>
/* does the complete input transfer handling */
static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
struct dvb_usb_device *d = adap->dev;
struct usb_device *udev = d->udev;
- mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
- if (!mdev)
- return -ENOMEM;
-
- mdev->dev = &udev->dev;
- strlcpy(mdev->model, d->desc->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);
+ mdev = v4l2_mc_usb_media_device_init(udev, d->desc->name);
dvb_register_media_controller(&adap->dvb_adap, mdev);
#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;