Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: mc: Set bus_info in media_device_init()

Set 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.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Sakari Ailus and committed by
Mauro Carvalho Chehab
cef69974 78a171e5

+7 -17
+4
drivers/media/mc/mc-device.c
··· 700 700 701 701 atomic_set(&mdev->request_id, 0); 702 702 703 + if (!*mdev->bus_info) 704 + media_set_bus_info(mdev->bus_info, sizeof(mdev->bus_info), 705 + mdev->dev); 706 + 703 707 dev_dbg(mdev->dev, "Media device initialized\n"); 704 708 } 705 709 EXPORT_SYMBOL_GPL(media_device_init);
-2
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
··· 1777 1777 cio2->media_dev.dev = dev; 1778 1778 strscpy(cio2->media_dev.model, CIO2_DEVICE_NAME, 1779 1779 sizeof(cio2->media_dev.model)); 1780 - snprintf(cio2->media_dev.bus_info, sizeof(cio2->media_dev.bus_info), 1781 - "PCI:%s", pci_name(cio2->pci_dev)); 1782 1780 cio2->media_dev.hw_revision = 0; 1783 1781 1784 1782 media_device_init(&cio2->media_dev);
-2
drivers/media/platform/renesas/rcar-vin/rcar-core.c
··· 94 94 95 95 strscpy(mdev->driver_name, KBUILD_MODNAME, sizeof(mdev->driver_name)); 96 96 strscpy(mdev->model, match->compatible, sizeof(mdev->model)); 97 - snprintf(mdev->bus_info, sizeof(mdev->bus_info), "platform:%s", 98 - dev_name(mdev->dev)); 99 97 100 98 media_device_init(mdev); 101 99
-2
drivers/media/platform/renesas/vsp1/vsp1_drv.c
··· 243 243 mdev->dev = vsp1->dev; 244 244 mdev->hw_revision = vsp1->version; 245 245 strscpy(mdev->model, vsp1->info->model, sizeof(mdev->model)); 246 - snprintf(mdev->bus_info, sizeof(mdev->bus_info), "platform:%s", 247 - dev_name(mdev->dev)); 248 246 media_device_init(mdev); 249 247 250 248 vsp1->media_ops.link_setup = vsp1_entity_link_setup;
-2
drivers/media/platform/st/stm32/stm32-dcmi.c
··· 1997 1997 1998 1998 /* Initialize media device */ 1999 1999 strscpy(dcmi->mdev.model, DRV_NAME, sizeof(dcmi->mdev.model)); 2000 - snprintf(dcmi->mdev.bus_info, sizeof(dcmi->mdev.bus_info), 2001 - "platform:%s", DRV_NAME); 2002 2000 dcmi->mdev.dev = &pdev->dev; 2003 2001 media_device_init(&dcmi->mdev); 2004 2002
-2
drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c
··· 173 173 strscpy(csi->mdev.model, "Allwinner Video Capture Device", 174 174 sizeof(csi->mdev.model)); 175 175 csi->mdev.hw_revision = 0; 176 - snprintf(csi->mdev.bus_info, sizeof(csi->mdev.bus_info), "platform:%s", 177 - dev_name(csi->dev)); 178 176 media_device_init(&csi->mdev); 179 177 csi->v4l.mdev = &csi->mdev; 180 178
-2
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
··· 733 733 strscpy(csi->media_dev.model, "Allwinner Video Capture Device", 734 734 sizeof(csi->media_dev.model)); 735 735 csi->media_dev.hw_revision = 0; 736 - snprintf(csi->media_dev.bus_info, sizeof(csi->media_dev.bus_info), 737 - "platform:%s", dev_name(csi->dev)); 738 736 739 737 media_device_init(&csi->media_dev); 740 738 v4l2_async_nf_init(&csi->notifier);
-2
drivers/media/platform/ti/cal/cal.c
··· 884 884 mdev->dev = cal->dev; 885 885 mdev->hw_revision = cal->revision; 886 886 strscpy(mdev->model, "CAL", sizeof(mdev->model)); 887 - snprintf(mdev->bus_info, sizeof(mdev->bus_info), "platform:%s", 888 - dev_name(mdev->dev)); 889 887 media_device_init(mdev); 890 888 891 889 /*
+3 -3
include/media/media-device.h
··· 225 225 * 226 226 * - dev must point to the parent device 227 227 * - model must be filled with the device model name 228 + * 229 + * The bus_info field is set by media_device_init() for PCI and platform devices 230 + * if the field begins with '\0'. 228 231 */ 229 232 void media_device_init(struct media_device *mdev); 230 233 ··· 251 248 * 252 249 * The caller is responsible for initializing the &media_device structure 253 250 * before registration. The following fields of &media_device must be set: 254 - * 255 - * - &media_device.dev must point to the parent device (usually a &pci_dev, 256 - * &usb_interface or &platform_device instance). 257 251 * 258 252 * - &media_device.model must be filled with the device model name as a 259 253 * NUL-terminated UTF-8 string. The device/model revision must not be