X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=include%2Fmedia%2Fmedia-device.h;h=2d144fed936e59b7dda12c8fcc1fcb6381c93f24;hb=41b44e35ba9b34e50a65c05ecf7642c07bd3e8aa;hp=d3855898c3fc6767fe7f7fb30895173845e8548f;hpb=2c9b3ebd5913c2d1371b749a8057ac32972b410d;p=karo-tx-linux.git diff --git a/include/media/media-device.h b/include/media/media-device.h index d3855898c3fc..2d144fed936e 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h @@ -268,6 +268,10 @@ struct device; * struct media_device - Media device * @dev: Parent device * @devnode: Media device node + * @driver_name: Optional device driver name. If not set, calls to + * %MEDIA_IOC_DEVICE_INFO will return dev->driver->name. + * This is needed for USB drivers for example, as otherwise + * they'll all appear as if the driver name was "usb". * @model: Device model name * @serial: Device serial number (optional) * @bus_info: Unique and stable device location identifier @@ -303,6 +307,7 @@ struct media_device { struct media_devnode devnode; char model[32]; + char driver_name[32]; char serial[40]; char bus_info[32]; u32 hw_revision; @@ -328,6 +333,10 @@ struct media_device { unsigned int notification); }; +/* We don't need to include pci.h or usb.h here */ +struct pci_dev; +struct usb_device; + #ifdef CONFIG_MEDIA_CONTROLLER /* Supported link_notify @notification values. */ @@ -536,6 +545,35 @@ struct media_device *media_device_find_devres(struct device *dev); /* Iterate over all links. */ #define media_device_for_each_link(link, mdev) \ list_for_each_entry(link, &(mdev)->links, graph_obj.list) + +/** + * media_device_pci_init() - create and initialize a + * struct &media_device from a PCI device. + * + * @pci_dev: pointer to struct pci_dev + * @name: media device name. If %NULL, the routine will use the default + * name for the pci device, given by pci_name() macro. + */ +struct media_device *media_device_pci_init(struct pci_dev *pci_dev, + const char *name); +/** + * __media_device_usb_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 media_device_usb_init() instead, as + * such macro fills driver_name with %KBUILD_MODNAME. + */ +struct media_device *__media_device_usb_init(struct usb_device *udev, + const char *board_name, + const char *driver_name); + #else static inline int media_device_register(struct media_device *mdev) { @@ -560,5 +598,25 @@ static inline struct media_device *media_device_find_devres(struct device *dev) { return NULL; } + +static inline +struct media_device *media_device_pci_init(struct pci_dev *pci_dev, + char *name) +{ + return NULL; +} + +static inline +struct media_device *__media_device_usb_init(struct usb_device *udev, + char *board_name, + char *driver_name) +{ + return NULL; +} + #endif /* CONFIG_MEDIA_CONTROLLER */ + +#define media_device_usb_init(udev, name) \ + __media_device_usb_init(udev, name, KBUILD_MODNAME) + #endif