diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-11 15:21:46 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-16 08:38:59 -0200 |
commit | eee7d353a19032b48c0f71504081de84a0ee79d8 (patch) | |
tree | a9161248e5606ee9ea2730e40c43c25dc1e2a3cd /include/media | |
parent | db152276ce720baadcbd6bccebbeb17da001d312 (diff) | |
download | linux-eee7d353a19032b48c0f71504081de84a0ee79d8.tar.bz2 |
[media] v4l2-mc: add a routine to create USB media_device
Instead of copying exactly the same code on all USB devices,
add an ancillary routine that will create and fill the
struct media_device with the values imported from the USB
device.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/v4l2-mc.h | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/include/media/v4l2-mc.h b/include/media/v4l2-mc.h index 20f1ee285947..79d84bb3573c 100644 --- a/include/media/v4l2-mc.h +++ b/include/media/v4l2-mc.h @@ -95,8 +95,9 @@ enum demod_pad_index { DEMOD_NUM_PADS }; - -struct pci_dev; /* We don't need to include pci.h here */ +/* We don't need to include pci.h or usb.h here */ +struct pci_dev; +struct usb_device; #ifdef CONFIG_MEDIA_CONTROLLER /** @@ -124,8 +125,24 @@ int v4l2_mc_create_media_graph(struct media_device *mdev); * name for the pci device, given by pci_name() macro. */ struct media_device *v4l2_mc_pci_media_device_init(struct pci_dev *pci_dev, - char *name); - + const char *name); +/** + * __v4l2_mc_usb_media_device_init() - create and initialize a + * struct &media_device from a PCI device. + * + * @udev: pointer to struct usb_device + * @board_name: media device name. If %NULL, the routine will use the usb + * product name, if available. + * @driver_name: name of the driver. if %NULL, the routine will use the name + * given by udev->dev->driver->name, with is usually the wrong + * thing to do. + * + * NOTE: It is better to call v4l2_mc_usb_media_device_init() instead, as + * such macro fills driver_name with %KBUILD_MODNAME. + */ +struct media_device *__v4l2_mc_usb_media_device_init(struct usb_device *udev, + const char *board_name, + const char *driver_name); #else static inline int v4l2_mc_create_media_graph(struct media_device *mdev) @@ -133,11 +150,23 @@ static inline int v4l2_mc_create_media_graph(struct media_device *mdev) return 0; } +static inline struct media_device *v4l2_mc_pci_media_device_init(struct pci_dev *pci_dev, - char *name) { + char *name) +{ return NULL; } +static inline +struct media_device *__v4l2_mc_usb_media_device_init(struct usb_device *udev, + char *board_name, + char *driver_name) +{ + return NULL; +} #endif +#define v4l2_mc_usb_media_device_init(udev, name) \ + __v4l2_mc_usb_media_device_init(udev, name, KBUILD_MODNAME) + #endif |