Set bus_info field in framework
Subsystems (38)
Sakari Ailus
maintainerv3 cover Set bus_info field in framework
Hi folks,
This innocuous-looking patchset moves setting the bus_info fields in struct media_device and struct v4l2_capability from drivers to the framework for PCI and platform devices. USB and I²C devices are possible, too, but not yet implemented. Using this is optional so that drivers which have special requirements or archaic bugs are unaffected.
If people like this, I'll see if the same could be done to the driver fields.
I have patches for USB, too, but those require changes in USB core (namely exporting the relevant functions).
since v2:
- Move non-redundant documentation on media_device_init() to the header.
- Fix struct name in media_device_register() documentation (new patch).
- media_set_bus_info() sets the bus_info field unconditionally, reflect this in the documentation.
- Document that media_set_bus_info() isn't meant to be called from drivers.
since v1:
- Make media_set_bus_info() a function, pass field size as an argument.
- Drop a few bad driver changes. Remove now-redundant local variables.
- Document the functionality for media_device_init(), V4L2 side doesn't have a proper place for documentation and I don't think it's something that should go to this set.
- Remove redundant kerneldoc in mc-device.c.
- Set bus_info in querycap unconditionally, before calling driver callback that can override it.
Sakari Ailus (4):
mc: Remove redundant documentation
mc: Provide a helper for setting bus_info field
mc: Set bus_info in media_device_init()
v4l: ioctl: Set bus_info in v4l_querycap()
drivers/media/common/saa7146/saa7146_video.c | 1 - drivers/media/mc/mc-device.c | 19 ++-------- drivers/media/pci/bt8xx/bttv-driver.c | 2 - drivers/media/pci/cx18/cx18-ioctl.c | 2 - drivers/media/pci/cx88/cx88-blackbird.c | 1 - drivers/media/pci/cx88/cx88-video.c | 1 - drivers/media/pci/dt3155/dt3155.c | 3 -- drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 6 --- drivers/media/pci/ivtv/ivtv-ioctl.c | 1 - drivers/media/pci/meye/meye.c | 1 - drivers/media/pci/saa7134/saa7134-video.c | 1 - drivers/media/pci/saa7164/saa7164-encoder.c | 1 - drivers/media/pci/saa7164/saa7164-vbi.c | 1 - .../media/pci/solo6x10/solo6x10-v4l2-enc.c | 2 - drivers/media/pci/solo6x10/solo6x10-v4l2.c | 2 - drivers/media/pci/sta2x11/sta2x11_vip.c | 2 - drivers/media/pci/tw5864/tw5864-video.c | 1 - drivers/media/pci/tw68/tw68-video.c | 3 -- drivers/media/pci/tw686x/tw686x-video.c | 2 - .../media/platform/allegro-dvt/allegro-core.c | 5 --- drivers/media/platform/davinci/vpbe_display.c | 2 - drivers/media/platform/davinci/vpif_capture.c | 2 - drivers/media/platform/davinci/vpif_display.c | 2 - drivers/media/platform/exynos-gsc/gsc-m2m.c | 5 --- drivers/media/platform/exynos4-is/common.c | 2 - drivers/media/platform/exynos4-is/fimc-lite.c | 4 -- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 4 -- .../media/platform/marvell-ccic/cafe-driver.c | 1 - .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 2 - .../media/platform/qcom/camss/camss-video.c | 4 -- drivers/media/platform/rcar-vin/rcar-core.c | 2 - drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 -- drivers/media/platform/rcar_jpu.c | 2 - drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 - drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 2 - drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 2 - drivers/media/platform/stm32/stm32-dcmi.c | 2 - .../platform/sunxi/sun4i-csi/sun4i_csi.c | 2 - .../platform/sunxi/sun4i-csi/sun4i_v4l2.c | 4 -- .../platform/sunxi/sun6i-csi/sun6i_csi.c | 2 - drivers/media/platform/ti-vpe/cal-video.c | 4 -- drivers/media/platform/ti-vpe/cal.c | 2 - drivers/media/platform/vsp1/vsp1_drv.c | 2 - drivers/media/platform/vsp1/vsp1_histo.c | 2 - drivers/media/platform/vsp1/vsp1_video.c | 2 - drivers/media/radio/radio-maxiradio.c | 2 - drivers/media/v4l2-core/v4l2-ioctl.c | 4 ++ include/media/media-device.h | 37 ++++++++++++++++--- 48 files changed, 39 insertions(+), 125 deletions(-)
Signature · 63 lines
2.30.2 Sakari Ailus (5): mc: Remove redundant documentation mc: media_device_init() initialises a media_device, not media_entity mc: Provide a helper for setting bus_info field mc: Set bus_info in media_device_init() v4l: ioctl: Set bus_info in v4l_querycap() drivers/media/common/saa7146/saa7146_video.c | 1 - drivers/media/mc/mc-device.c | 19 ++----- drivers/media/pci/bt8xx/bttv-driver.c | 2 - drivers/media/pci/cx18/cx18-ioctl.c | 2 - drivers/media/pci/cx88/cx88-blackbird.c | 1 - drivers/media/pci/cx88/cx88-video.c | 1 - drivers/media/pci/dt3155/dt3155.c | 3 -- drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 6 --- drivers/media/pci/ivtv/ivtv-ioctl.c | 1 - drivers/media/pci/meye/meye.c | 1 - drivers/media/pci/saa7134/saa7134-video.c | 1 - drivers/media/pci/saa7164/saa7164-encoder.c | 1 - drivers/media/pci/saa7164/saa7164-vbi.c | 1 - .../media/pci/solo6x10/solo6x10-v4l2-enc.c | 2 - drivers/media/pci/solo6x10/solo6x10-v4l2.c | 2 - drivers/media/pci/sta2x11/sta2x11_vip.c | 2 - drivers/media/pci/tw5864/tw5864-video.c | 1 - drivers/media/pci/tw68/tw68-video.c | 3 -- drivers/media/pci/tw686x/tw686x-video.c | 2 - .../media/platform/allegro-dvt/allegro-core.c | 5 -- drivers/media/platform/davinci/vpbe_display.c | 2 - drivers/media/platform/davinci/vpif_capture.c | 2 - drivers/media/platform/davinci/vpif_display.c | 2 - drivers/media/platform/exynos-gsc/gsc-m2m.c | 5 -- drivers/media/platform/exynos4-is/common.c | 2 - drivers/media/platform/exynos4-is/fimc-lite.c | 4 -- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 4 -- .../media/platform/marvell-ccic/cafe-driver.c | 1 - .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 2 - .../media/platform/qcom/camss/camss-video.c | 4 -- drivers/media/platform/rcar-vin/rcar-core.c | 2 - drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 -- drivers/media/platform/rcar_jpu.c | 2 - drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 - drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 2 - drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 2 - drivers/media/platform/stm32/stm32-dcmi.c | 2 - .../platform/sunxi/sun4i-csi/sun4i_csi.c | 2 - .../platform/sunxi/sun4i-csi/sun4i_v4l2.c | 4 -- .../platform/sunxi/sun6i-csi/sun6i_csi.c | 2 - drivers/media/platform/ti-vpe/cal-video.c | 4 -- drivers/media/platform/ti-vpe/cal.c | 2 - drivers/media/platform/vsp1/vsp1_drv.c | 2 - drivers/media/platform/vsp1/vsp1_histo.c | 2 - drivers/media/platform/vsp1/vsp1_video.c | 2 - drivers/media/radio/radio-maxiradio.c | 2 - drivers/media/v4l2-core/v4l2-ioctl.c | 4 ++ include/media/media-device.h | 52 +++++++++++++++---- 48 files changed, 49 insertions(+), 130 deletions(-) -- 2.30.2
Sakari Ailus
maintainerPATCH v3 1/5 mc: Remove redundant documentation
Remove redundant kerneldoc documentation in mc-device.c. The functions are already documented in media-device.h, where non-redundant documentation is also moved.
--- drivers/media/mc/mc-device.c | 15 --------------- include/media/media-device.h | 6 ++++++ 2 files changed, 6 insertions(+), 15 deletions(-)
drivers/media/mc/mc-device.c +0 -15
@@ -608,11 +608,6 @@ static void __media_device_unregister_entity(struct media_entity *entity) entity->graph_obj.mdev =NULL ; } -/** -* media_device_register_entity - Register an entity with a media device -* @mdev: The media device -* @entity: The entity -*/ int __must_check media_device_register_entity (struct media_device *mdev,struct media_entity *entity) {
@@ -691,16 +686,6 @@ void media_device_unregister_entity(struct media_entity *entity) }EXPORT_SYMBOL_GPL (media_device_unregister_entity); -/** -* media_device_init() - initialize a media device -* @mdev: The media device -* -* The caller is responsible for initializing the media device before -* registration. The following fields must be set: -* -* - dev must point to the parent device -* - model must be filled with the device model name -*/ void media_device_init (struct media_device *mdev) {INIT_LIST_HEAD (&mdev->entities);
include/media/media-device.h +6 -0
@@ -219,6 +219,12 @@ static inline __must_check int media_entity_enum_init(* So drivers need to first initialize the media device, register any entity * within the media device, create pad to pad links and then finally register * the media device by calling media_device_register() as a final step. +* +* The caller is responsible for initializing the media device before +* registration. The following fields must be set: +* +* - dev must point to the parent device +* - model must be filled with the device model name */ void media_device_init (struct media_device *mdev);
Signature · 1 line
2.30.2
Sakari Ailus
maintainerPATCH v3 2/5 mc: media_device_init() initialises a media_device, not media_entity
In reply to Sakari AilusThe documentation for media_device_init() had several references to (struct) media_entity where it should have referred to struct media_device instead. Fix this.
--- include/media/media-device.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
include/media/media-device.h +6 -6
@@ -249,28 +249,28 @@ void media_device_cleanup(struct media_device *mdev);* The caller is responsible for initializing the &media_device structure * before registration. The following fields of &media_device must be set: * -* - &media_entity.dev must point to the parent device (usually a &pci_dev, +* - &media_device.dev must point to the parent device (usually a &pci_dev, * &usb_interface or &platform_device instance). * -* - &media_entity.model must be filled with the device model name as a +* - &media_device.model must be filled with the device model name as a * NUL-terminated UTF-8 string. The device/model revision must not be * stored in this field. * * The following fields are optional: * -* - &media_entity.serial is a unique serial number stored as a +* - &media_device.serial is a unique serial number stored as a * NUL-terminated ASCII string. The field is big enough to store a GUID * in text form. If the hardware doesn't provide a unique serial number * this field must be left empty. * -* - &media_entity.bus_info represents the location of the device in the +* - &media_device.bus_info represents the location of the device in the * system as a NUL-terminated ASCII string. For PCI/PCIe devices -* &media_entity.bus_info must be set to "PCI:" (or "PCIe:") followed by +* &media_device.bus_info must be set to "PCI:" (or "PCIe:") followed by * the value of pci_name(). For USB devices,the usb_make_path() function * must be used. This field is used by applications to distinguish between * otherwise identical devices that don't provide a serial number. * -* - &media_entity.hw_revision is the hardware device revision in a +* - &media_device.hw_revision is the hardware device revision in a * driver-specific format. When possible the revision should be formatted * with the KERNEL_VERSION() macro. *
Signature · 1 line
2.30.2
Re: [PATCH v3 2/5] mc: media_device_init() initialises a media_device, not media_entity
Hi Sakari,
Thank you for the patch.
Quoted 5 lines · Sakari Ailus
The documentation for
media_device_init()had several references to (struct)media_entitywhere it should have referred to structmedia_deviceinstead. Fix this.Signed-off-by Sakari Ailus <[email protected]>
Quoted 43 lines
--- include/media/media-device.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)include/media/media-device.h +6
-6@@ -249,28 +249,28 @@ void media_device_cleanup(struct media_device *mdev);* The caller is responsible for initializing the &media_device structure * before registration. The following fields of &media_device must be set: * -* - &media_entity.dev must point to the parent device (usually a &pci_dev, +* - &media_device.dev must point to the parent device (usually a &pci_dev, * &usb_interface or &platform_device instance). * -* - &media_entity.model must be filled with the device model name as a +* - &media_device.model must be filled with the device model name as a * NUL-terminated UTF-8 string. The device/model revision must not be * stored in this field. * * The following fields are optional: * -* - &media_entity.serial is a unique serial number stored as a +* - &media_device.serial is a unique serial number stored as a * NUL-terminated ASCII string. The field is big enough to store a GUID * in text form. If the hardware doesn't provide a unique serial number * this field must be left empty. * -* - &media_entity.bus_info represents the location of the device in the +* - &media_device.bus_info represents the location of the device in the * system as a NUL-terminated ASCII string. For PCI/PCIe devices -* &media_entity.bus_info must be set to "PCI:" (or "PCIe:") followed by +* &media_device.bus_info must be set to "PCI:" (or "PCIe:") followed by * the value of pci_name(). For USB devices,the usb_make_path() function * must be used. This field is used by applications to distinguish between * otherwise identical devices that don't provide a serial number. * -* - &media_entity.hw_revision is the hardware device revision in a +* - &media_device.hw_revision is the hardware device revision in a * driver-specific format. When possible the revision should be formatted * with the KERNEL_VERSION() macro. *
Signature · 3 lines
Regards, Laurent Pinchart
Sakari Ailus
maintainerPATCH v3 3/5 mc: Provide a helper for setting bus_info field
In reply to Sakari AilusThe bus_info or a similar field exists in a lot of structs, yet drivers tend to set the value of that field by themselves in a determinable way. Thus provide a helper for doing this. To be used in subsequent patches.
--- include/media/media-device.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
include/media/media-device.h +27 -3
@@ -13,12 +13,13 @@#include <linux/list.h> #include <linux/mutex.h> +#include <linux/pci.h> +#include <linux/platform_device.h> #include <media/media-devnode.h> #include <media/media-entity.h> struct ida ; -struct device ;struct media_device ;/**
@@ -181,8 +182,7 @@ struct media_device {atomic_t request_id; }; -/* We don't need to include pci.h or usb.h here */ -struct pci_dev ; +/* We don't need to include usb.h here */ struct usb_device ;#ifdef CONFIG_MEDIA_CONTROLLER
@@ -502,4 +502,28 @@ static inline void __media_device_usb_init(struct media_device *mdev,#define media_device_usb_init (mdev, udev, name) \ __media_device_usb_init(mdev, udev, name, KBUILD_MODNAME) + +/** +* media_set_bus_info() - Set bus_info field +* +* @bus_info: Variable where to write the bus info (char array) +* @bus_info_size: Length of the bus_info +* @dev: Related struct device +* +* Sets bus information based on &dev. This is currently done for PCI and +* platform devices. dev is required to be non-NULL for this to happen. +* +* This function is not meant to be called from drivers. +*/ +static inline void +media_set_bus_info (char *bus_info,size_t bus_info_size,struct device *dev) +{ +if (!dev) +strscpy (bus_info,"no bus info" , bus_info_size); +else if (dev_is_platform (dev)) +snprintf (bus_info, bus_info_size,"platform:%s" ,dev_name (dev)); +else if (dev_is_pci (dev)) +snprintf (bus_info, bus_info_size,"PCI:%s" ,dev_name (dev)); +} +#endif
Signature · 1 line
2.30.2
Re: [PATCH v3 3/5] mc: Provide a helper for setting bus_info field
Hi Sakari,
Thank you for the patch.
Quoted 55 lines · Sakari Ailus
The
bus_infoor a similar field exists in a lot of structs, yet drivers tend to set the value of that field by themselves in a determinable way. Thus provide a helper for doing this. To be used in subsequent patches.Signed-off-by Sakari Ailus <[email protected]>--- include/media/media-device.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)include/media/media-device.h +16
-3@@ -13,12 +13,13 @@#include <linux/list.h> #include <linux/mutex.h> +#include <linux/pci.h> +#include <linux/platform_device.h> #include <media/media-devnode.h> #include <media/media-entity.h> struct ida ; -struct device ;struct media_device ;/** @@ -181,8 +182,7 @@ struct media_device {atomic_t request_id; }; -/* We don't need to include pci.h or usb.h here */ -struct pci_dev ; +/* We don't need to include usb.h here */ struct usb_device ;#ifdef CONFIG_MEDIA_CONTROLLER @@ -502,4 +502,28 @@ static inline void __media_device_usb_init(struct media_device *mdev,#define media_device_usb_init (mdev, udev, name) \ __media_device_usb_init(mdev, udev, name, KBUILD_MODNAME) + +/** +* media_set_bus_info() - Set bus_info field +* +* @bus_info: Variable where to write the bus info (char array) +* @bus_info_size: Length of the bus_info +* @dev: Related struct device +* +* Sets bus information based on &dev. This is currently done for PCI and +* platform devices. dev is required to be non-NULL for this to happen. +* +* This function is not meant to be called from drivers. +*/
include/media/media-device.h static inline void __media_device_usb_init(struct media_device *mdev, · line 527
Quoted 10 lines
include/media/media-device.h +10
-0+static inline void +media_set_bus_info (char *bus_info,size_t bus_info_size,struct device *dev) +{ +if (!dev) +strscpy (bus_info,"no bus info" , bus_info_size); +else if (dev_is_platform (dev)) +snprintf (bus_info, bus_info_size,"platform:%s" ,dev_name (dev)); +else if (dev_is_pci (dev)) +snprintf (bus_info, bus_info_size,"PCI:%s" ,dev_name (dev)); +}
I wouldn't inline this, as it's not used in any hot path, and will generate quite a bit of code. Apart from that,
Quoted 2 lines
include/media/media-device.h +1
-0+#endif
Signature · 3 lines
Regards, Laurent Pinchart
Laurent Pinchart
maintainerRe: [PATCH v3 3/5] mc: Provide a helper for setting bus_info field
Quoted 65 lines · Laurent Pinchart
Hi Sakari,
Thank you for the patch.
Quoted 60 lines · Sakari Ailus
The
bus_infoor a similar field exists in a lot of structs, yet drivers tend to set the value of that field by themselves in a determinable way. Thus provide a helper for doing this. To be used in subsequent patches.Signed-off-by Sakari Ailus <[email protected]>--- include/media/media-device.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)include/media/media-device.h +21
-3@@ -13,12 +13,13 @@#include <linux/list.h> #include <linux/mutex.h> +#include <linux/pci.h> +#include <linux/platform_device.h> #include <media/media-devnode.h> #include <media/media-entity.h> struct ida ; -struct device ;struct media_device ;/** @@ -181,8 +182,7 @@ struct media_device {atomic_t request_id; }; -/* We don't need to include pci.h or usb.h here */ -struct pci_dev ; +/* We don't need to include usb.h here */ struct usb_device ;#ifdef CONFIG_MEDIA_CONTROLLER @@ -502,4 +502,28 @@ static inline void __media_device_usb_init(struct media_device *mdev,#define media_device_usb_init (mdev, udev, name) \ __media_device_usb_init(mdev, udev, name, KBUILD_MODNAME) + +/** +* media_set_bus_info() - Set bus_info field +* +* @bus_info: Variable where to write the bus info (char array) +* @bus_info_size: Length of the bus_info +* @dev: Related struct device +* +* Sets bus information based on &dev. This is currently done for PCI and +* platform devices. dev is required to be non-NULL for this to happen. +* +* This function is not meant to be called from drivers. +*/ +static inline void +media_set_bus_info (char *bus_info,size_t bus_info_size,struct device *dev) +{ +if (!dev) +strscpy (bus_info,"no bus info" , bus_info_size);
Quoted 8 lines
include/media/media-device.h static inline void __media_device_usb_init(struct media_device *mdev, · line 527
Quoted 5 lines
include/media/media-device.h +5
-0+else if (dev_is_platform (dev)) +snprintf (bus_info, bus_info_size,"platform:%s" ,dev_name (dev)); +else if (dev_is_pci (dev)) +snprintf (bus_info, bus_info_size,"PCI:%s" ,dev_name (dev)); +}I wouldn't inline this, as it's not used in any hot path, and will generate quite a bit of code. Apart from that,
But the function is only called in two places, and we'd have to export it, and handle the case where MC is disabled. Possibly not worth it, although it would be nice to not inline it if possible. If there's a suitable location to make that easy let's do so, otherwise you can keep it inline.
(By the way, at some point we may want to not make MC optional)
Quoted 4 lines
Reviewed-by Laurent Pinchart <[email protected]>Quoted 2 lines
include/media/media-device.h +1
-0+#endif
Signature · 3 lines
Regards, Laurent Pinchart
Sakari Ailus
maintainerRe: [PATCH v3 3/5] mc: Provide a helper for setting bus_info field
Quoted 75 lines · Laurent Pinchart
Quoted 65 lines · Laurent Pinchart
Hi Sakari,
Thank you for the patch.
Quoted 60 lines · Sakari Ailus
The
bus_infoor a similar field exists in a lot of structs, yet drivers tend to set the value of that field by themselves in a determinable way. Thus provide a helper for doing this. To be used in subsequent patches.Signed-off-by Sakari Ailus <[email protected]>--- include/media/media-device.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)include/media/media-device.h +21
-3@@ -13,12 +13,13 @@#include <linux/list.h> #include <linux/mutex.h> +#include <linux/pci.h> +#include <linux/platform_device.h> #include <media/media-devnode.h> #include <media/media-entity.h> struct ida ; -struct device ;struct media_device ;/** @@ -181,8 +182,7 @@ struct media_device {atomic_t request_id; }; -/* We don't need to include pci.h or usb.h here */ -struct pci_dev ; +/* We don't need to include usb.h here */ struct usb_device ;#ifdef CONFIG_MEDIA_CONTROLLER @@ -502,4 +502,28 @@ static inline void __media_device_usb_init(struct media_device *mdev,#define media_device_usb_init (mdev, udev, name) \ __media_device_usb_init(mdev, udev, name, KBUILD_MODNAME) + +/** +* media_set_bus_info() - Set bus_info field +* +* @bus_info: Variable where to write the bus info (char array) +* @bus_info_size: Length of the bus_info +* @dev: Related struct device +* +* Sets bus information based on &dev. This is currently done for PCI and +* platform devices. dev is required to be non-NULL for this to happen. +* +* This function is not meant to be called from drivers. +*/ +static inline void +media_set_bus_info (char *bus_info,size_t bus_info_size,struct device *dev) +{ +if (!dev) +strscpy (bus_info,"no bus info" , bus_info_size);Quoted 8 lines
include/media/media-device.h static inline void __media_device_usb_init(struct media_device *mdev, · line 527
Quoted 5 lines
include/media/media-device.h +5
-0+else if (dev_is_platform (dev)) +snprintf (bus_info, bus_info_size,"platform:%s" ,dev_name (dev)); +else if (dev_is_pci (dev)) +snprintf (bus_info, bus_info_size,"PCI:%s" ,dev_name (dev)); +}I wouldn't inline this, as it's not used in any hot path, and will generate quite a bit of code. Apart from that,
Quoted 5 lines
But the function is only called in two places, and we'd have to export it, and handle the case where MC is disabled. Possibly not worth it, although it would be nice to not inline it if possible. If there's a suitable location to make that easy let's do so, otherwise you can keep it inline.
There's no such location currently. If one will be added, this should be moved there. But it's not really worth a new kernel module at the moment.
Quoted 2 lines
(By the way, at some point we may want to not make MC optional)
Yes.
Quoted 2 lines
Quoted 2 lines
Reviewed-by Laurent Pinchart <[email protected]>
Thanks!
Signature · 1 line
Sakari Ailus
Sakari Ailus
maintainerPATCH v3 4/5 mc: Set bus_info in media_device_init()
In reply to Sakari AilusSet bus_info field based on struct device in media_device_init() and remove corresponding code from drivers.
Also update media_device_init() documentation: the dev field must be now initialised before calling it.
--- drivers/media/mc/mc-device.c | 4 ++++ drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 2 -- drivers/media/platform/rcar-vin/rcar-core.c | 2 -- drivers/media/platform/stm32/stm32-dcmi.c | 2 -- drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c | 2 -- drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 2 -- drivers/media/platform/ti-vpe/cal.c | 2 -- drivers/media/platform/vsp1/vsp1_drv.c | 2 -- include/media/media-device.h | 6 +++--- 9 files changed, 7 insertions(+), 17 deletions(-)
drivers/media/mc/mc-device.c +4 -0
@@ -700,6 +700,10 @@ void media_device_init(struct media_device *mdev)atomic_set (&mdev->request_id,0 ); +if (!*mdev->bus_info) +media_set_bus_info (mdev->bus_info,sizeof (mdev->bus_info), + mdev->dev); +dev_dbg (mdev->dev,"Media device initialized\n" ); }EXPORT_SYMBOL_GPL (media_device_init);
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +0 -2
@@ -1777,8 +1777,6 @@ static int cio2_pci_probe(struct pci_dev *pci_dev, cio2->media_dev.dev = dev;strscpy (cio2->media_dev.model,CIO2_DEVICE_NAME ,sizeof (cio2->media_dev.model)); -snprintf (cio2->media_dev.bus_info,sizeof (cio2->media_dev.bus_info), -"PCI:%s" ,pci_name (cio2->pci_dev)); cio2->media_dev.hw_revision =0 ;media_device_init (&cio2->media_dev);
drivers/media/platform/rcar-vin/rcar-core.c +0 -2
@@ -94,8 +94,6 @@ static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin,strscpy (mdev->driver_name,KBUILD_MODNAME ,sizeof (mdev->driver_name));strscpy (mdev->model, match->compatible,sizeof (mdev->model)); -snprintf (mdev->bus_info,sizeof (mdev->bus_info),"platform:%s" , -dev_name (mdev->dev));media_device_init (mdev);
drivers/media/platform/stm32/stm32-dcmi.c +0 -2
@@ -1997,8 +1997,6 @@ static int dcmi_probe(struct platform_device *pdev)/* Initialize media device */ strscpy (dcmi->mdev.model,DRV_NAME ,sizeof (dcmi->mdev.model)); -snprintf (dcmi->mdev.bus_info,sizeof (dcmi->mdev.bus_info), -"platform:%s" ,DRV_NAME ); dcmi->mdev.dev = &pdev->dev;media_device_init (&dcmi->mdev);
drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c +0 -2
@@ -173,8 +173,6 @@ static int sun4i_csi_probe(struct platform_device *pdev)strscpy (csi->mdev.model,"Allwinner Video Capture Device" ,sizeof (csi->mdev.model)); csi->mdev.hw_revision =0 ; -snprintf (csi->mdev.bus_info,sizeof (csi->mdev.bus_info),"platform:%s" , -dev_name (csi->dev));media_device_init (&csi->mdev); csi->v4l.mdev = &csi->mdev;
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c +0 -2
@@ -733,8 +733,6 @@ static int sun6i_csi_v4l2_init(struct sun6i_csi *csi)strscpy (csi->media_dev.model,"Allwinner Video Capture Device" ,sizeof (csi->media_dev.model)); csi->media_dev.hw_revision =0 ; -snprintf (csi->media_dev.bus_info,sizeof (csi->media_dev.bus_info), -"platform:%s" ,dev_name (csi->dev));media_device_init (&csi->media_dev);v4l2_async_nf_init (&csi->notifier);
drivers/media/platform/ti-vpe/cal.c +0 -2
@@ -884,8 +884,6 @@ static int cal_media_init(struct cal_dev *cal) mdev->dev = cal->dev; mdev->hw_revision = cal->revision;strscpy (mdev->model,"CAL" ,sizeof (mdev->model)); -snprintf (mdev->bus_info,sizeof (mdev->bus_info),"platform:%s" , -dev_name (mdev->dev));media_device_init (mdev);/*
drivers/media/platform/vsp1/vsp1_drv.c +0 -2
@@ -243,8 +243,6 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) mdev->dev = vsp1->dev; mdev->hw_revision = vsp1->version;strscpy (mdev->model, vsp1->info->model,sizeof (mdev->model)); -snprintf (mdev->bus_info,sizeof (mdev->bus_info),"platform:%s" , -dev_name (mdev->dev));media_device_init (mdev); vsp1->media_ops.link_setup = vsp1_entity_link_setup;
include/media/media-device.h +3 -3
@@ -225,6 +225,9 @@ static inline __must_check int media_entity_enum_init(* * - dev must point to the parent device * - model must be filled with the device model name +* +* The bus_info field is set by media_device_init() for PCI and platform devices +* if the field begins with '\0'. */ void media_device_init (struct media_device *mdev);
@@ -249,9 +252,6 @@ void media_device_cleanup(struct media_device *mdev);* The caller is responsible for initializing the &media_device structure * before registration. The following fields of &media_device must be set: * -* - &media_device.dev must point to the parent device (usually a &pci_dev, -* &usb_interface or &platform_device instance). -* * - &media_device.model must be filled with the device model name as a * NUL-terminated UTF-8 string. The device/model revision must not be * stored in this field.
Signature · 1 line
2.30.2
Re: [PATCH v3 4/5] mc: Set bus_info in media_device_init()
Hi Sakari,
Thank you for the patch.
Quoted 24 lines · Sakari Ailus
Set
bus_infofield based on struct device inmedia_device_init()and remove corresponding code from drivers.Also update
media_device_init()documentation: the dev field must be now initialised before calling it.Signed-off-by Sakari Ailus <[email protected]>--- drivers/media/mc/mc-device.c | 4 ++++ drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 2 -- drivers/media/platform/rcar-vin/rcar-core.c | 2 -- drivers/media/platform/stm32/stm32-dcmi.c | 2 -- drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c | 2 -- drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 2 -- drivers/media/platform/ti-vpe/cal.c | 2 -- drivers/media/platform/vsp1/vsp1_drv.c | 2 -- include/media/media-device.h | 6 +++--- 9 files changed, 7 insertions(+), 17 deletions(-)drivers/media/mc/mc-device.c +0
-0
drivers/media/mc/mc-device.c void media_device_init(struct media_device *mdev) · line 703
Quoted 4 lines
drivers/media/mc/mc-device.c +1
-0@@ -700,6 +700,10 @@ void media_device_init(struct media_device *mdev)atomic_set (&mdev->request_id,0 ); +if (!*mdev->bus_info)
if (!mdev->bus_info[0])
could be a bit more readable, up to you.
Quoted 121 lines
drivers/media/mc/mc-device.c +3
-0+media_set_bus_info (mdev->bus_info,sizeof (mdev->bus_info), + mdev->dev); +dev_dbg (mdev->dev,"Media device initialized\n" ); }EXPORT_SYMBOL_GPL (media_device_init);drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +0
-2@@ -1777,8 +1777,6 @@ static int cio2_pci_probe(struct pci_dev *pci_dev, cio2->media_dev.dev = dev;strscpy (cio2->media_dev.model,CIO2_DEVICE_NAME ,sizeof (cio2->media_dev.model)); -snprintf (cio2->media_dev.bus_info,sizeof (cio2->media_dev.bus_info), -"PCI:%s" ,pci_name (cio2->pci_dev)); cio2->media_dev.hw_revision =0 ;media_device_init (&cio2->media_dev);drivers/media/platform/rcar-vin/rcar-core.c +0
-2@@ -94,8 +94,6 @@ static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin,strscpy (mdev->driver_name,KBUILD_MODNAME ,sizeof (mdev->driver_name));strscpy (mdev->model, match->compatible,sizeof (mdev->model)); -snprintf (mdev->bus_info,sizeof (mdev->bus_info),"platform:%s" , -dev_name (mdev->dev));media_device_init (mdev);drivers/media/platform/stm32/stm32-dcmi.c +0
-2@@ -1997,8 +1997,6 @@ static int dcmi_probe(struct platform_device *pdev)/* Initialize media device */ strscpy (dcmi->mdev.model,DRV_NAME ,sizeof (dcmi->mdev.model)); -snprintf (dcmi->mdev.bus_info,sizeof (dcmi->mdev.bus_info), -"platform:%s" ,DRV_NAME ); dcmi->mdev.dev = &pdev->dev;media_device_init (&dcmi->mdev);drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c +0
-2@@ -173,8 +173,6 @@ static int sun4i_csi_probe(struct platform_device *pdev)strscpy (csi->mdev.model,"Allwinner Video Capture Device" ,sizeof (csi->mdev.model)); csi->mdev.hw_revision =0 ; -snprintf (csi->mdev.bus_info,sizeof (csi->mdev.bus_info),"platform:%s" , -dev_name (csi->dev));media_device_init (&csi->mdev); csi->v4l.mdev = &csi->mdev;drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c +0
-2@@ -733,8 +733,6 @@ static int sun6i_csi_v4l2_init(struct sun6i_csi *csi)strscpy (csi->media_dev.model,"Allwinner Video Capture Device" ,sizeof (csi->media_dev.model)); csi->media_dev.hw_revision =0 ; -snprintf (csi->media_dev.bus_info,sizeof (csi->media_dev.bus_info), -"platform:%s" ,dev_name (csi->dev));media_device_init (&csi->media_dev);v4l2_async_nf_init (&csi->notifier);drivers/media/platform/ti-vpe/cal.c +0
-2@@ -884,8 +884,6 @@ static int cal_media_init(struct cal_dev *cal) mdev->dev = cal->dev; mdev->hw_revision = cal->revision;strscpy (mdev->model,"CAL" ,sizeof (mdev->model)); -snprintf (mdev->bus_info,sizeof (mdev->bus_info),"platform:%s" , -dev_name (mdev->dev));media_device_init (mdev);/* drivers/media/platform/vsp1/vsp1_drv.c +0
-2@@ -243,8 +243,6 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) mdev->dev = vsp1->dev; mdev->hw_revision = vsp1->version;strscpy (mdev->model, vsp1->info->model,sizeof (mdev->model)); -snprintf (mdev->bus_info,sizeof (mdev->bus_info),"platform:%s" , -dev_name (mdev->dev));media_device_init (mdev); vsp1->media_ops.link_setup = vsp1_entity_link_setup;include/media/media-device.h +3
-3@@ -225,6 +225,9 @@ static inline __must_check int media_entity_enum_init(* * - dev must point to the parent device * - model must be filled with the device model name +* +* The bus_info field is set by media_device_init() for PCI and platform devices +* if the field begins with '\0'. */ void media_device_init (struct media_device *mdev);@@ -249,9 +252,6 @@ void media_device_cleanup(struct media_device *mdev);* The caller is responsible for initializing the &media_device structure * before registration. The following fields of &media_device must be set: * -* - &media_device.dev must point to the parent device (usually a &pci_dev, -* &usb_interface or &platform_device instance). -* * - &media_device.model must be filled with the device model name as a * NUL-terminated UTF-8 string. The device/model revision must not be * stored in this field.
Signature · 3 lines
Regards, Laurent Pinchart
Sakari Ailus
maintainerPATCH v3 5/5 v4l: ioctl: Set bus_info in v4l_querycap()
In reply to Sakari AilusThe bus_info field is set by most drivers based on the type of the device bus as well as the name of the device. Do this in v4l_querycap() so drivers don't need to. This keeps compatibility with non-default and silly bus_info.
--- drivers/media/common/saa7146/saa7146_video.c | 1 - drivers/media/pci/bt8xx/bttv-driver.c | 2 -- drivers/media/pci/cx18/cx18-ioctl.c | 2 -- drivers/media/pci/cx88/cx88-blackbird.c | 1 - drivers/media/pci/cx88/cx88-video.c | 1 - drivers/media/pci/dt3155/dt3155.c | 3 --- drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 4 ---- drivers/media/pci/ivtv/ivtv-ioctl.c | 1 - drivers/media/pci/meye/meye.c | 1 - drivers/media/pci/saa7134/saa7134-video.c | 1 - drivers/media/pci/saa7164/saa7164-encoder.c | 1 - drivers/media/pci/saa7164/saa7164-vbi.c | 1 - drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 2 -- drivers/media/pci/solo6x10/solo6x10-v4l2.c | 2 -- drivers/media/pci/sta2x11/sta2x11_vip.c | 2 -- drivers/media/pci/tw5864/tw5864-video.c | 1 - drivers/media/pci/tw68/tw68-video.c | 3 --- drivers/media/pci/tw686x/tw686x-video.c | 2 -- drivers/media/platform/allegro-dvt/allegro-core.c | 5 ----- drivers/media/platform/davinci/vpbe_display.c | 2 -- drivers/media/platform/davinci/vpif_capture.c | 2 -- drivers/media/platform/davinci/vpif_display.c | 2 -- drivers/media/platform/exynos-gsc/gsc-m2m.c | 5 ----- drivers/media/platform/exynos4-is/common.c | 2 -- drivers/media/platform/exynos4-is/fimc-lite.c | 4 ---- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 4 ---- drivers/media/platform/marvell-ccic/cafe-driver.c | 1 - drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 2 -- drivers/media/platform/qcom/camss/camss-video.c | 4 ---- drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ---- drivers/media/platform/rcar_jpu.c | 2 -- drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 -- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 2 -- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 2 -- drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c | 4 ---- drivers/media/platform/ti-vpe/cal-video.c | 4 ---- drivers/media/platform/vsp1/vsp1_histo.c | 2 -- drivers/media/platform/vsp1/vsp1_video.c | 2 -- drivers/media/radio/radio-maxiradio.c | 2 -- drivers/media/v4l2-core/v4l2-ioctl.c | 4 ++++ 40 files changed, 4 insertions(+), 90 deletions(-)
drivers/media/common/saa7146/saa7146_video.c +0 -1
@@ -443,7 +443,6 @@ static int vidioc_querycap(struct file *file, void *fh, struct v4l2_capability *strscpy ((char *)cap->driver,"saa7146 v4l2" ,sizeof (cap->driver));strscpy ((char *)cap->card, dev->ext->name,sizeof (cap->card)); -sprintf ((char *)cap->bus_info,"PCI:%s" ,pci_name (dev->pci)); cap->capabilities =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_VIDEO_OVERLAY |V4L2_CAP_READWRITE |V4L2_CAP_STREAMING |V4L2_CAP_DEVICE_CAPS ;
drivers/media/pci/bt8xx/bttv-driver.c +0 -2
@@ -2435,8 +2435,6 @@ static int bttv_querycap(struct file *file, void *priv,strscpy (cap->driver,"bttv" ,sizeof (cap->driver));strscpy (cap->card, btv->video_dev.name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info), -"PCI:%s" ,pci_name (btv->c.pci)); cap->capabilities =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_READWRITE |V4L2_CAP_STREAMING |V4L2_CAP_DEVICE_CAPS ;if (no_overlay <=0 )
drivers/media/pci/cx18/cx18-ioctl.c +0 -2
@@ -389,8 +389,6 @@ static int cx18_querycap(struct file *file, void *fh,strscpy (vcap->driver,CX18_DRIVER_NAME ,sizeof (vcap->driver));strscpy (vcap->card, cx->card_name,sizeof (vcap->card)); -snprintf (vcap->bus_info,sizeof (vcap->bus_info), -"PCI:%s" ,pci_name (cx->pci_dev)); vcap->capabilities = cx->v4l2_cap |V4L2_CAP_DEVICE_CAPS ;return 0 ; }
drivers/media/pci/cx88/cx88-blackbird.c +0 -1
@@ -796,7 +796,6 @@ static int vidioc_querycap(struct file *file, void *priv,struct cx88_core *core = dev->core;strscpy (cap->driver,"cx88_blackbird" ,sizeof (cap->driver)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci));return cx88_querycap (file, core, cap); }
drivers/media/pci/cx88/cx88-video.c +0 -1
@@ -808,7 +808,6 @@ static int vidioc_querycap(struct file *file, void *priv,struct cx88_core *core = dev->core;strscpy (cap->driver,"cx8800" ,sizeof (cap->driver)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci));return cx88_querycap (file, core, cap); }
drivers/media/pci/dt3155/dt3155.c +0 -3
@@ -292,11 +292,8 @@ static const struct v4l2_file_operations dt3155_fops = {static int dt3155_querycap (struct file *filp,void *p,struct v4l2_capability *cap) { -struct dt3155_priv *pd =video_drvdata (filp); -strscpy (cap->driver,DT3155_NAME ,sizeof (cap->driver));strscpy (cap->card,DT3155_NAME " frame grabber" ,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (pd->pdev));return 0 ; }
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +0 -4
@@ -1046,12 +1046,8 @@ static const struct vb2_ops cio2_vb2_ops = {static int cio2_v4l2_querycap (struct file *file,void *fh,struct v4l2_capability *cap) { -struct cio2_device *cio2 =video_drvdata (file); -strscpy (cap->driver,CIO2_NAME ,sizeof (cap->driver));strscpy (cap->card,CIO2_DEVICE_NAME ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info), -"PCI:%s" ,pci_name (cio2->pci_dev));return 0 ; }
drivers/media/pci/ivtv/ivtv-ioctl.c +0 -1
@@ -732,7 +732,6 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vcstrscpy (vcap->driver,IVTV_DRIVER_NAME ,sizeof (vcap->driver));strscpy (vcap->card, itv->card_name,sizeof (vcap->card)); -snprintf (vcap->bus_info,sizeof (vcap->bus_info),"PCI:%s" ,pci_name (itv->pdev)); vcap->capabilities = itv->v4l2_cap |V4L2_CAP_DEVICE_CAPS ;return 0 ; }
drivers/media/pci/meye/meye.c +0 -1
@@ -1012,7 +1012,6 @@ static int vidioc_querycap(struct file *file, void *fh, {strscpy (cap->driver,"meye" ,sizeof (cap->driver));strscpy (cap->card,"meye" ,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (meye.mchip_dev));return 0 ; }
drivers/media/pci/saa7134/saa7134-video.c +0 -1
@@ -1475,7 +1475,6 @@ int saa7134_querycap(struct file *file, void *priv,strscpy (cap->driver,"saa7134" ,sizeof (cap->driver));strscpy (cap->card, saa7134_boards[dev->board].name,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci)); cap->capabilities =V4L2_CAP_READWRITE |V4L2_CAP_STREAMING |V4L2_CAP_RADIO |V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_VBI_CAPTURE |V4L2_CAP_DEVICE_CAPS ;
drivers/media/pci/saa7164/saa7164-encoder.c +0 -1
@@ -490,7 +490,6 @@ static int vidioc_querycap(struct file *file, void *priv,strscpy (cap->driver, dev->name,sizeof (cap->driver));strscpy (cap->card, saa7164_boards[dev->board].name,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci)); cap->capabilities =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_READWRITE |V4L2_CAP_TUNER |V4L2_CAP_VBI_CAPTURE |V4L2_CAP_DEVICE_CAPS ;
drivers/media/pci/saa7164/saa7164-vbi.c +0 -1
@@ -201,7 +201,6 @@ static int vidioc_querycap(struct file *file, void *priv,strscpy (cap->driver, dev->name,sizeof (cap->driver));strscpy (cap->card, saa7164_boards[dev->board].name,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci)); cap->capabilities =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_READWRITE |V4L2_CAP_TUNER |V4L2_CAP_VBI_CAPTURE |V4L2_CAP_DEVICE_CAPS ;
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c +0 -2
@@ -769,8 +769,6 @@ static int solo_enc_querycap(struct file *file, void *priv,strscpy (cap->driver,SOLO6X10_NAME ,sizeof (cap->driver));snprintf (cap->card,sizeof (cap->card),"Softlogic 6x10 Enc %d" , solo_enc->ch); -snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" , -pci_name (solo_dev->pdev));return 0 ; }
drivers/media/pci/solo6x10/solo6x10-v4l2.c +0 -2
@@ -376,8 +376,6 @@ static int solo_querycap(struct file *file, void *priv,strscpy (cap->driver,SOLO6X10_NAME ,sizeof (cap->driver));strscpy (cap->card,"Softlogic 6x10" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" , -pci_name (solo_dev->pdev));return 0 ; }
drivers/media/pci/sta2x11/sta2x11_vip.c +0 -2
@@ -405,8 +405,6 @@ static int vidioc_querycap(struct file *file, void *priv,strscpy (cap->driver,KBUILD_MODNAME ,sizeof (cap->driver));strscpy (cap->card,KBUILD_MODNAME ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" , -pci_name (vip->pdev));return 0 ; }
drivers/media/pci/tw5864/tw5864-video.c +0 -1
@@ -604,7 +604,6 @@ static int tw5864_querycap(struct file *file, void *priv,strscpy (cap->driver,"tw5864" ,sizeof (cap->driver));snprintf (cap->card,sizeof (cap->card),"TW5864 Encoder %d" , input->nr); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (input->root->pci));return 0 ; }
drivers/media/pci/tw68/tw68-video.c +0 -3
@@ -712,12 +712,9 @@ static int tw68_s_input(struct file *file, void *priv, unsigned int i)static int tw68_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct tw68_dev *dev =video_drvdata (file); -strscpy (cap->driver,"tw68" ,sizeof (cap->driver));strscpy (cap->card,"Techwell Capture Card" ,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci));return 0 ; }
drivers/media/pci/tw686x/tw686x-video.c +0 -2
@@ -762,8 +762,6 @@ static int tw686x_querycap(struct file *file, void *priv,strscpy (cap->driver,"tw686x" ,sizeof (cap->driver));strscpy (cap->card, dev->name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info), -"PCI:%s" ,pci_name (dev->pci_dev));return 0 ; }
drivers/media/platform/allegro-dvt/allegro-core.c +0 -5
@@ -3249,13 +3249,8 @@ static int allegro_release(struct file *file)static int allegro_querycap (struct file *file,void *fh,struct v4l2_capability *cap) { -struct video_device *vdev =video_devdata (file); -struct allegro_dev *dev =video_get_drvdata (vdev); -strscpy (cap->driver,KBUILD_MODNAME ,sizeof (cap->driver));strscpy (cap->card,"Allegro DVT Video Encoder" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (&dev->plat_dev->dev));return 0 ; }
drivers/media/platform/davinci/vpbe_display.c +0 -2
@@ -630,8 +630,6 @@ static int vpbe_display_querycap(struct file *file, void *priv,snprintf (cap->driver,sizeof (cap->driver),"%s" ,dev_name (vpbe_dev->pdev)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (vpbe_dev->pdev));strscpy (cap->card, vpbe_dev->cfg->module_name,sizeof (cap->card));return 0 ;
drivers/media/platform/davinci/vpif_capture.c +0 -2
@@ -1067,8 +1067,6 @@ static int vpif_querycap(struct file *file, void *priv,struct vpif_capture_config *config = vpif_dev->platform_data;strscpy (cap->driver,VPIF_DRIVER_NAME ,sizeof (cap->driver)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (vpif_dev));strscpy (cap->card, config->card_name,sizeof (cap->card));return 0 ;
drivers/media/platform/davinci/vpif_display.c +0 -2
@@ -585,8 +585,6 @@ static int vpif_querycap(struct file *file, void *priv,struct vpif_display_config *config = vpif_dev->platform_data;strscpy (cap->driver,VPIF_DRIVER_NAME ,sizeof (cap->driver)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (vpif_dev));strscpy (cap->card, config->card_name,sizeof (cap->card));return 0 ;
drivers/media/platform/exynos-gsc/gsc-m2m.c +0 -5
@@ -285,13 +285,8 @@ static const struct vb2_ops gsc_m2m_qops = {static int gsc_m2m_querycap (struct file *file,void *fh,struct v4l2_capability *cap) { -struct gsc_ctx *ctx =fh_to_ctx (fh); -struct gsc_dev *gsc = ctx->gsc_dev; -strscpy (cap->driver,GSC_MODULE_NAME ,sizeof (cap->driver));strscpy (cap->card,GSC_MODULE_NAME " gscaler" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (&gsc->pdev->dev));return 0 ; }
drivers/media/platform/exynos4-is/common.c +0 -2
@@ -38,8 +38,6 @@ void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap) {strscpy (cap->driver, dev->driver->name,sizeof (cap->driver));strscpy (cap->card, dev->driver->name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info), -"platform:%s" ,dev_name (dev)); }EXPORT_SYMBOL (__fimc_vidioc_querycap);
drivers/media/platform/exynos4-is/fimc-lite.c +0 -4
@@ -646,12 +646,8 @@ static void fimc_lite_try_compose(struct fimc_lite *fimc, struct v4l2_rect *r)static int fimc_lite_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct fimc_lite *fimc =video_drvdata (file); -strscpy (cap->driver,FIMC_LITE_DRV_NAME ,sizeof (cap->driver));strscpy (cap->card,FIMC_LITE_DRV_NAME ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (&fimc->pdev->dev));return 0 ; }
drivers/media/platform/imx-jpeg/mxc-jpeg.c +0 -4
@@ -1533,12 +1533,8 @@ static int mxc_jpeg_open(struct file *file)static int mxc_jpeg_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct mxc_jpeg_dev *mxc_jpeg =video_drvdata (file); -strscpy (cap->driver,MXC_JPEG_NAME " codec" ,sizeof (cap->driver));strscpy (cap->card,MXC_JPEG_NAME " codec" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (mxc_jpeg->dev)); cap->device_caps =V4L2_CAP_STREAMING |V4L2_CAP_VIDEO_M2M_MPLANE ; cap->capabilities = cap->device_caps |V4L2_CAP_DEVICE_CAPS ;
drivers/media/platform/marvell-ccic/cafe-driver.c +0 -1
@@ -497,7 +497,6 @@ static int cafe_pci_probe(struct pci_dev *pdev, mcam->plat_power_up = cafe_ctlr_power_up; mcam->plat_power_down = cafe_ctlr_power_down; mcam->dev = &pdev->dev; -snprintf (mcam->bus_info,sizeof (mcam->bus_info),"PCI:%s" ,pci_name (pdev));/* * Vmalloc mode for buffers is traditional with this driver. * We *might* be able to run DMA_contig, especially on a system
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +0 -2
@@ -137,8 +137,6 @@ static int mtk_jpeg_querycap(struct file *file, void *priv,strscpy (cap->driver, jpeg->variant->dev_name,sizeof (cap->driver));strscpy (cap->card, jpeg->variant->dev_name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (jpeg->dev));return 0 ; }
drivers/media/platform/qcom/camss/camss-video.c +0 -4
@@ -576,12 +576,8 @@ static const struct vb2_ops msm_video_vb2_q_ops = {static int video_querycap (struct file *file,void *fh,struct v4l2_capability *cap) { -struct camss_video *video =video_drvdata (file); -strscpy (cap->driver,"qcom-camss" ,sizeof (cap->driver));strscpy (cap->card,"Qualcomm Camera Subsystem" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (video->camss->dev));return 0 ; }
drivers/media/platform/rcar-vin/rcar-v4l2.c +0 -4
@@ -307,12 +307,8 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which,static int rvin_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct rvin_dev *vin =video_drvdata (file); -strscpy (cap->driver,KBUILD_MODNAME ,sizeof (cap->driver));strscpy (cap->card,"R_Car_VIN" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (vin->dev));return 0 ; }
drivers/media/platform/rcar_jpu.c +0 -2
@@ -670,8 +670,6 @@ static int jpu_querycap(struct file *file, void *priv,strscpy (cap->card,DRV_NAME " decoder" ,sizeof (cap->card));strscpy (cap->driver,DRV_NAME ,sizeof (cap->driver)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (ctx->jpu->dev));memset (cap->reserved,0 ,sizeof (cap->reserved));return 0 ;
drivers/media/platform/s5p-jpeg/jpeg-core.c +0 -2
@@ -1257,8 +1257,6 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,strscpy (cap->card,S5P_JPEG_M2M_NAME " decoder" ,sizeof (cap->card)); } -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (ctx->jpeg->dev));return 0 ; }
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +0 -2
@@ -288,8 +288,6 @@ static int vidioc_querycap(struct file *file, void *priv,strscpy (cap->driver,S5P_MFC_NAME ,sizeof (cap->driver));strscpy (cap->card, dev->vfd_dec->name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (&dev->plat_dev->dev));return 0 ; }
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +0 -2
@@ -1309,8 +1309,6 @@ static int vidioc_querycap(struct file *file, void *priv,strscpy (cap->driver,S5P_MFC_NAME ,sizeof (cap->driver));strscpy (cap->card, dev->vfd_enc->name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (&dev->plat_dev->dev));return 0 ; }
drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c +0 -4
@@ -53,12 +53,8 @@ const struct sun4i_csi_format *sun4i_csi_find_format(const u32 *fourcc,static int sun4i_csi_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct sun4i_csi *csi =video_drvdata (file); -strscpy (cap->driver,KBUILD_MODNAME ,sizeof (cap->driver));strscpy (cap->card,"sun4i-csi" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (csi->dev));return 0 ; }
drivers/media/platform/ti-vpe/cal-video.c +0 -4
@@ -47,13 +47,9 @@ static char *fourcc_to_str(u32 fmt)static int cal_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct cal_ctx *ctx =video_drvdata (file); -strscpy (cap->driver,CAL_MODULE_NAME ,sizeof (cap->driver));strscpy (cap->card,CAL_MODULE_NAME ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info), -"platform:%s" ,dev_name (ctx->cal->dev));return 0 ; }
drivers/media/platform/vsp1/vsp1_histo.c +0 -2
@@ -434,8 +434,6 @@ static int histo_v4l2_querycap(struct file *file, void *fh,strscpy (cap->driver,"vsp1" ,sizeof (cap->driver));strscpy (cap->card, histo->video.name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (histo->entity.vsp1->dev));return 0 ; }
drivers/media/platform/vsp1/vsp1_video.c +0 -2
@@ -959,8 +959,6 @@ vsp1_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap)strscpy (cap->driver,"vsp1" ,sizeof (cap->driver));strscpy (cap->card, video->video.name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (video->vsp1->dev));return 0 ; }
drivers/media/radio/radio-maxiradio.c +0 -2
@@ -144,8 +144,6 @@ static int maxiradio_probe(struct pci_dev *pdev, dev->tea.v4l2_dev = v4l2_dev; dev->tea.radio_nr = radio_nr;strscpy (dev->tea.card,"Maxi Radio FM2000" ,sizeof (dev->tea.card)); -snprintf (dev->tea.bus_info,sizeof (dev->tea.bus_info), -"PCI:%s" ,pci_name (pdev)); retval = -ENODEV ;
drivers/media/v4l2-core/v4l2-ioctl.c +4 -0
@@ -18,6 +18,7 @@#include <linux/videodev2.h> +#include <media/media-device.h> /* for media_set_bus_info() */ #include <media/v4l2-common.h> #include <media/v4l2-ioctl.h> #include <media/v4l2-ctrls.h>
@@ -1052,6 +1053,9 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops, cap->device_caps = vfd->device_caps; cap->capabilities = vfd->device_caps |V4L2_CAP_DEVICE_CAPS ; +media_set_bus_info (cap->bus_info,sizeof (cap->bus_info), + vfd->dev_parent); + ret = ops->vidioc_querycap (file, fh, cap);/*
Signature · 1 line
2.30.2
Sakari Ailus
maintainerPATCH v4 5/5 v4l: ioctl: Set bus_info in v4l_querycap()
The bus_info field is set by most drivers based on the type of the device bus as well as the name of the device. Do this in v4l_querycap() so drivers don't need to. This keeps compatibility with non-default and silly bus_info.
---
since v3:
- Remove three unused variables (drivers/media/pci/solo6x10/solo6x10-v4l2.c, drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c and drivers/media/pci/sta2x11/sta2x11_vip.c).
drivers/media/common/saa7146/saa7146_video.c | 1 - drivers/media/pci/bt8xx/bttv-driver.c | 2 -- drivers/media/pci/cx18/cx18-ioctl.c | 2 -- drivers/media/pci/cx88/cx88-blackbird.c | 1 - drivers/media/pci/cx88/cx88-video.c | 1 - drivers/media/pci/dt3155/dt3155.c | 3 --- drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 4 ---- drivers/media/pci/ivtv/ivtv-ioctl.c | 1 - drivers/media/pci/meye/meye.c | 1 - drivers/media/pci/saa7134/saa7134-video.c | 1 - drivers/media/pci/saa7164/saa7164-encoder.c | 1 - drivers/media/pci/saa7164/saa7164-vbi.c | 1 - drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 3 --- drivers/media/pci/solo6x10/solo6x10-v4l2.c | 4 ---- drivers/media/pci/sta2x11/sta2x11_vip.c | 4 ---- drivers/media/pci/tw5864/tw5864-video.c | 1 - drivers/media/pci/tw68/tw68-video.c | 3 --- drivers/media/pci/tw686x/tw686x-video.c | 2 -- drivers/media/platform/allegro-dvt/allegro-core.c | 5 ----- drivers/media/platform/marvell/cafe-driver.c | 1 - drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 2 -- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 4 ---- drivers/media/platform/qcom/camss/camss-video.c | 4 ---- drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c | 4 ---- drivers/media/platform/renesas/rcar_jpu.c | 2 -- drivers/media/platform/renesas/vsp1/vsp1_histo.c | 2 -- drivers/media/platform/renesas/vsp1/vsp1_video.c | 2 -- drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c | 5 ----- drivers/media/platform/samsung/exynos4-is/common.c | 2 -- drivers/media/platform/samsung/exynos4-is/fimc-lite.c | 4 ---- drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c | 2 -- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c | 2 -- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 2 -- drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c | 4 ---- drivers/media/platform/ti/cal/cal-video.c | 4 ---- drivers/media/platform/ti/davinci/vpbe_display.c | 2 -- drivers/media/platform/ti/davinci/vpif_capture.c | 2 -- drivers/media/platform/ti/davinci/vpif_display.c | 2 -- drivers/media/radio/radio-maxiradio.c | 2 -- drivers/media/v4l2-core/v4l2-ioctl.c | 4 ++++ 40 files changed, 4 insertions(+), 95 deletions(-)
drivers/media/common/saa7146/saa7146_video.c +0 -1
@@ -443,7 +443,6 @@ static int vidioc_querycap(struct file *file, void *fh, struct v4l2_capability *strscpy ((char *)cap->driver,"saa7146 v4l2" ,sizeof (cap->driver));strscpy ((char *)cap->card, dev->ext->name,sizeof (cap->card)); -sprintf ((char *)cap->bus_info,"PCI:%s" ,pci_name (dev->pci)); cap->capabilities =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_VIDEO_OVERLAY |V4L2_CAP_READWRITE |V4L2_CAP_STREAMING |V4L2_CAP_DEVICE_CAPS ;
drivers/media/pci/bt8xx/bttv-driver.c +0 -2
@@ -2435,8 +2435,6 @@ static int bttv_querycap(struct file *file, void *priv,strscpy (cap->driver,"bttv" ,sizeof (cap->driver));strscpy (cap->card, btv->video_dev.name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info), -"PCI:%s" ,pci_name (btv->c.pci)); cap->capabilities =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_READWRITE |V4L2_CAP_STREAMING |V4L2_CAP_DEVICE_CAPS ;if (no_overlay <=0 )
drivers/media/pci/cx18/cx18-ioctl.c +0 -2
@@ -389,8 +389,6 @@ static int cx18_querycap(struct file *file, void *fh,strscpy (vcap->driver,CX18_DRIVER_NAME ,sizeof (vcap->driver));strscpy (vcap->card, cx->card_name,sizeof (vcap->card)); -snprintf (vcap->bus_info,sizeof (vcap->bus_info), -"PCI:%s" ,pci_name (cx->pci_dev)); vcap->capabilities = cx->v4l2_cap |V4L2_CAP_DEVICE_CAPS ;return 0 ; }
drivers/media/pci/cx88/cx88-blackbird.c +0 -1
@@ -796,7 +796,6 @@ static int vidioc_querycap(struct file *file, void *priv,struct cx88_core *core = dev->core;strscpy (cap->driver,"cx88_blackbird" ,sizeof (cap->driver)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci));return cx88_querycap (file, core, cap); }
drivers/media/pci/cx88/cx88-video.c +0 -1
@@ -808,7 +808,6 @@ static int vidioc_querycap(struct file *file, void *priv,struct cx88_core *core = dev->core;strscpy (cap->driver,"cx8800" ,sizeof (cap->driver)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci));return cx88_querycap (file, core, cap); }
drivers/media/pci/dt3155/dt3155.c +0 -3
@@ -292,11 +292,8 @@ static const struct v4l2_file_operations dt3155_fops = {static int dt3155_querycap (struct file *filp,void *p,struct v4l2_capability *cap) { -struct dt3155_priv *pd =video_drvdata (filp); -strscpy (cap->driver,DT3155_NAME ,sizeof (cap->driver));strscpy (cap->card,DT3155_NAME " frame grabber" ,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (pd->pdev));return 0 ; }
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +0 -4
@@ -1046,12 +1046,8 @@ static const struct vb2_ops cio2_vb2_ops = {static int cio2_v4l2_querycap (struct file *file,void *fh,struct v4l2_capability *cap) { -struct cio2_device *cio2 =video_drvdata (file); -strscpy (cap->driver,CIO2_NAME ,sizeof (cap->driver));strscpy (cap->card,CIO2_DEVICE_NAME ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info), -"PCI:%s" ,pci_name (cio2->pci_dev));return 0 ; }
drivers/media/pci/ivtv/ivtv-ioctl.c +0 -1
@@ -732,7 +732,6 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vcstrscpy (vcap->driver,IVTV_DRIVER_NAME ,sizeof (vcap->driver));strscpy (vcap->card, itv->card_name,sizeof (vcap->card)); -snprintf (vcap->bus_info,sizeof (vcap->bus_info),"PCI:%s" ,pci_name (itv->pdev)); vcap->capabilities = itv->v4l2_cap |V4L2_CAP_DEVICE_CAPS ;return 0 ; }
drivers/media/pci/meye/meye.c +0 -1
@@ -1012,7 +1012,6 @@ static int vidioc_querycap(struct file *file, void *fh, {strscpy (cap->driver,"meye" ,sizeof (cap->driver));strscpy (cap->card,"meye" ,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (meye.mchip_dev));return 0 ; }
drivers/media/pci/saa7134/saa7134-video.c +0 -1
@@ -1475,7 +1475,6 @@ int saa7134_querycap(struct file *file, void *priv,strscpy (cap->driver,"saa7134" ,sizeof (cap->driver));strscpy (cap->card, saa7134_boards[dev->board].name,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci)); cap->capabilities =V4L2_CAP_READWRITE |V4L2_CAP_STREAMING |V4L2_CAP_RADIO |V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_VBI_CAPTURE |V4L2_CAP_DEVICE_CAPS ;
drivers/media/pci/saa7164/saa7164-encoder.c +0 -1
@@ -490,7 +490,6 @@ static int vidioc_querycap(struct file *file, void *priv,strscpy (cap->driver, dev->name,sizeof (cap->driver));strscpy (cap->card, saa7164_boards[dev->board].name,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci)); cap->capabilities =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_READWRITE |V4L2_CAP_TUNER |V4L2_CAP_VBI_CAPTURE |V4L2_CAP_DEVICE_CAPS ;
drivers/media/pci/saa7164/saa7164-vbi.c +0 -1
@@ -201,7 +201,6 @@ static int vidioc_querycap(struct file *file, void *priv,strscpy (cap->driver, dev->name,sizeof (cap->driver));strscpy (cap->card, saa7164_boards[dev->board].name,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci)); cap->capabilities =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_READWRITE |V4L2_CAP_TUNER |V4L2_CAP_VBI_CAPTURE |V4L2_CAP_DEVICE_CAPS ;
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c +0 -3
@@ -764,13 +764,10 @@ static int solo_enc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) {struct solo_enc_dev *solo_enc =video_drvdata (file); -struct solo_dev *solo_dev = solo_enc->solo_dev;strscpy (cap->driver,SOLO6X10_NAME ,sizeof (cap->driver));snprintf (cap->card,sizeof (cap->card),"Softlogic 6x10 Enc %d" , solo_enc->ch); -snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" , -pci_name (solo_dev->pdev));return 0 ; }
drivers/media/pci/solo6x10/solo6x10-v4l2.c +0 -4
@@ -372,12 +372,8 @@ static const struct vb2_ops solo_video_qops = {static int solo_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct solo_dev *solo_dev =video_drvdata (file); -strscpy (cap->driver,SOLO6X10_NAME ,sizeof (cap->driver));strscpy (cap->card,"Softlogic 6x10" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" , -pci_name (solo_dev->pdev));return 0 ; }
drivers/media/pci/sta2x11/sta2x11_vip.c +0 -4
@@ -401,12 +401,8 @@ static const struct v4l2_file_operations vip_fops = {static int vidioc_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct sta2x11_vip *vip =video_drvdata (file); -strscpy (cap->driver,KBUILD_MODNAME ,sizeof (cap->driver));strscpy (cap->card,KBUILD_MODNAME ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" , -pci_name (vip->pdev));return 0 ; }
drivers/media/pci/tw5864/tw5864-video.c +0 -1
@@ -604,7 +604,6 @@ static int tw5864_querycap(struct file *file, void *priv,strscpy (cap->driver,"tw5864" ,sizeof (cap->driver));snprintf (cap->card,sizeof (cap->card),"TW5864 Encoder %d" , input->nr); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (input->root->pci));return 0 ; }
drivers/media/pci/tw68/tw68-video.c +0 -3
@@ -712,12 +712,9 @@ static int tw68_s_input(struct file *file, void *priv, unsigned int i)static int tw68_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct tw68_dev *dev =video_drvdata (file); -strscpy (cap->driver,"tw68" ,sizeof (cap->driver));strscpy (cap->card,"Techwell Capture Card" ,sizeof (cap->card)); -sprintf (cap->bus_info,"PCI:%s" ,pci_name (dev->pci));return 0 ; }
drivers/media/pci/tw686x/tw686x-video.c +0 -2
@@ -762,8 +762,6 @@ static int tw686x_querycap(struct file *file, void *priv,strscpy (cap->driver,"tw686x" ,sizeof (cap->driver));strscpy (cap->card, dev->name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info), -"PCI:%s" ,pci_name (dev->pci_dev));return 0 ; }
drivers/media/platform/allegro-dvt/allegro-core.c +0 -5
@@ -3249,13 +3249,8 @@ static int allegro_release(struct file *file)static int allegro_querycap (struct file *file,void *fh,struct v4l2_capability *cap) { -struct video_device *vdev =video_devdata (file); -struct allegro_dev *dev =video_get_drvdata (vdev); -strscpy (cap->driver,KBUILD_MODNAME ,sizeof (cap->driver));strscpy (cap->card,"Allegro DVT Video Encoder" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (&dev->plat_dev->dev));return 0 ; }
drivers/media/platform/marvell/cafe-driver.c +0 -1
@@ -497,7 +497,6 @@ static int cafe_pci_probe(struct pci_dev *pdev, mcam->plat_power_up = cafe_ctlr_power_up; mcam->plat_power_down = cafe_ctlr_power_down; mcam->dev = &pdev->dev; -snprintf (mcam->bus_info,sizeof (mcam->bus_info),"PCI:%s" ,pci_name (pdev));/* * Vmalloc mode for buffers is traditional with this driver. * We *might* be able to run DMA_contig, especially on a system
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +0 -2
@@ -137,8 +137,6 @@ static int mtk_jpeg_querycap(struct file *file, void *priv,strscpy (cap->driver, jpeg->variant->dev_name,sizeof (cap->driver));strscpy (cap->card, jpeg->variant->dev_name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (jpeg->dev));return 0 ; }
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +0 -4
@@ -1569,12 +1569,8 @@ static int mxc_jpeg_open(struct file *file)static int mxc_jpeg_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct mxc_jpeg_dev *mxc_jpeg =video_drvdata (file); -strscpy (cap->driver,MXC_JPEG_NAME " codec" ,sizeof (cap->driver));strscpy (cap->card,MXC_JPEG_NAME " codec" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (mxc_jpeg->dev)); cap->device_caps =V4L2_CAP_STREAMING |V4L2_CAP_VIDEO_M2M_MPLANE ; cap->capabilities = cap->device_caps |V4L2_CAP_DEVICE_CAPS ;
drivers/media/platform/qcom/camss/camss-video.c +0 -4
@@ -576,12 +576,8 @@ static const struct vb2_ops msm_video_vb2_q_ops = {static int video_querycap (struct file *file,void *fh,struct v4l2_capability *cap) { -struct camss_video *video =video_drvdata (file); -strscpy (cap->driver,"qcom-camss" ,sizeof (cap->driver));strscpy (cap->card,"Qualcomm Camera Subsystem" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (video->camss->dev));return 0 ; }
drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c +0 -4
@@ -307,12 +307,8 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which,static int rvin_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct rvin_dev *vin =video_drvdata (file); -strscpy (cap->driver,KBUILD_MODNAME ,sizeof (cap->driver));strscpy (cap->card,"R_Car_VIN" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (vin->dev));return 0 ; }
drivers/media/platform/renesas/rcar_jpu.c +0 -2
@@ -670,8 +670,6 @@ static int jpu_querycap(struct file *file, void *priv,strscpy (cap->card,DRV_NAME " decoder" ,sizeof (cap->card));strscpy (cap->driver,DRV_NAME ,sizeof (cap->driver)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (ctx->jpu->dev));memset (cap->reserved,0 ,sizeof (cap->reserved));return 0 ;
drivers/media/platform/renesas/vsp1/vsp1_histo.c +0 -2
@@ -434,8 +434,6 @@ static int histo_v4l2_querycap(struct file *file, void *fh,strscpy (cap->driver,"vsp1" ,sizeof (cap->driver));strscpy (cap->card, histo->video.name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (histo->entity.vsp1->dev));return 0 ; }
drivers/media/platform/renesas/vsp1/vsp1_video.c +0 -2
@@ -959,8 +959,6 @@ vsp1_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap)strscpy (cap->driver,"vsp1" ,sizeof (cap->driver));strscpy (cap->card, video->video.name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (video->vsp1->dev));return 0 ; }
drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c +0 -5
@@ -285,13 +285,8 @@ static const struct vb2_ops gsc_m2m_qops = {static int gsc_m2m_querycap (struct file *file,void *fh,struct v4l2_capability *cap) { -struct gsc_ctx *ctx =fh_to_ctx (fh); -struct gsc_dev *gsc = ctx->gsc_dev; -strscpy (cap->driver,GSC_MODULE_NAME ,sizeof (cap->driver));strscpy (cap->card,GSC_MODULE_NAME " gscaler" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (&gsc->pdev->dev));return 0 ; }
drivers/media/platform/samsung/exynos4-is/common.c +0 -2
@@ -41,8 +41,6 @@ void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap) {strscpy (cap->driver, dev->driver->name,sizeof (cap->driver));strscpy (cap->card, dev->driver->name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info), -"platform:%s" ,dev_name (dev)); }EXPORT_SYMBOL (__fimc_vidioc_querycap);
drivers/media/platform/samsung/exynos4-is/fimc-lite.c +0 -4
@@ -646,12 +646,8 @@ static void fimc_lite_try_compose(struct fimc_lite *fimc, struct v4l2_rect *r)static int fimc_lite_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct fimc_lite *fimc =video_drvdata (file); -strscpy (cap->driver,FIMC_LITE_DRV_NAME ,sizeof (cap->driver));strscpy (cap->card,FIMC_LITE_DRV_NAME ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (&fimc->pdev->dev));return 0 ; }
drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c +0 -2
@@ -1257,8 +1257,6 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,strscpy (cap->card,S5P_JPEG_M2M_NAME " decoder" ,sizeof (cap->card)); } -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (ctx->jpeg->dev));return 0 ; }
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c +0 -2
@@ -288,8 +288,6 @@ static int vidioc_querycap(struct file *file, void *priv,strscpy (cap->driver,S5P_MFC_NAME ,sizeof (cap->driver));strscpy (cap->card, dev->vfd_dec->name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (&dev->plat_dev->dev));return 0 ; }
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +0 -2
@@ -1309,8 +1309,6 @@ static int vidioc_querycap(struct file *file, void *priv,strscpy (cap->driver,S5P_MFC_NAME ,sizeof (cap->driver));strscpy (cap->card, dev->vfd_enc->name,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (&dev->plat_dev->dev));return 0 ; }
drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c +0 -4
@@ -53,12 +53,8 @@ const struct sun4i_csi_format *sun4i_csi_find_format(const u32 *fourcc,static int sun4i_csi_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct sun4i_csi *csi =video_drvdata (file); -strscpy (cap->driver,KBUILD_MODNAME ,sizeof (cap->driver));strscpy (cap->card,"sun4i-csi" ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (csi->dev));return 0 ; }
drivers/media/platform/ti/cal/cal-video.c +0 -4
@@ -47,13 +47,9 @@ static char *fourcc_to_str(u32 fmt)static int cal_querycap (struct file *file,void *priv,struct v4l2_capability *cap) { -struct cal_ctx *ctx =video_drvdata (file); -strscpy (cap->driver,CAL_MODULE_NAME ,sizeof (cap->driver));strscpy (cap->card,CAL_MODULE_NAME ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info), -"platform:%s" ,dev_name (ctx->cal->dev));return 0 ; }
drivers/media/platform/ti/davinci/vpbe_display.c +0 -2
@@ -630,8 +630,6 @@ static int vpbe_display_querycap(struct file *file, void *priv,snprintf (cap->driver,sizeof (cap->driver),"%s" ,dev_name (vpbe_dev->pdev)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (vpbe_dev->pdev));strscpy (cap->card, vpbe_dev->cfg->module_name,sizeof (cap->card));return 0 ;
drivers/media/platform/ti/davinci/vpif_capture.c +0 -2
@@ -1067,8 +1067,6 @@ static int vpif_querycap(struct file *file, void *priv,struct vpif_capture_config *config = vpif_dev->platform_data;strscpy (cap->driver,VPIF_DRIVER_NAME ,sizeof (cap->driver)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (vpif_dev));strscpy (cap->card, config->card_name,sizeof (cap->card));return 0 ;
drivers/media/platform/ti/davinci/vpif_display.c +0 -2
@@ -585,8 +585,6 @@ static int vpif_querycap(struct file *file, void *priv,struct vpif_display_config *config = vpif_dev->platform_data;strscpy (cap->driver,VPIF_DRIVER_NAME ,sizeof (cap->driver)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , -dev_name (vpif_dev));strscpy (cap->card, config->card_name,sizeof (cap->card));return 0 ;
drivers/media/radio/radio-maxiradio.c +0 -2
@@ -144,8 +144,6 @@ static int maxiradio_probe(struct pci_dev *pdev, dev->tea.v4l2_dev = v4l2_dev; dev->tea.radio_nr = radio_nr;strscpy (dev->tea.card,"Maxi Radio FM2000" ,sizeof (dev->tea.card)); -snprintf (dev->tea.bus_info,sizeof (dev->tea.bus_info), -"PCI:%s" ,pci_name (pdev)); retval = -ENODEV ;
drivers/media/v4l2-core/v4l2-ioctl.c +4 -0
@@ -18,6 +18,7 @@#include <linux/videodev2.h> +#include <media/media-device.h> /* for media_set_bus_info() */ #include <media/v4l2-common.h> #include <media/v4l2-ioctl.h> #include <media/v4l2-ctrls.h>
@@ -1052,6 +1053,9 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops, cap->device_caps = vfd->device_caps; cap->capabilities = vfd->device_caps |V4L2_CAP_DEVICE_CAPS ; +media_set_bus_info (cap->bus_info,sizeof (cap->bus_info), + vfd->dev_parent); + ret = ops->vidioc_querycap (file, fh, cap);/*
Signature · 1 line
2.30.2