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

Configure Feed

Select the types of activity you want to include in your feed.

staging/vc04_services/bcm2835-camera: distinct numeration and names for devices

Create a static atomic counter for numerating cameras.
Use the Media Subsystem Kernel Internal API to create distinct
device-names, so that the camera-number (given by the counter)
matches the camera-name.

Co-developed-by: Kay Friedrich <kay.friedrich@fau.de>
Signed-off-by: Kay Friedrich <kay.friedrich@fau.de>
Signed-off-by: Michael Kupfer <michael.kupfer@fau.de>
Link: https://lore.kernel.org/r/20191206085432.19962-1-michael.kupfer@fau.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Michael Kupfer and committed by
Greg Kroah-Hartman
1f8a6edf a1df271a

+6 -3
+6 -3
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
··· 60 60 module_param(max_video_height, int, 0644); 61 61 MODULE_PARM_DESC(max_video_height, "Threshold for video mode"); 62 62 63 + /* camera instance counter */ 64 + static atomic_t camera_instance = ATOMIC_INIT(0); 65 + 63 66 /* global device data array */ 64 67 static struct bm2835_mmal_dev *gdev[MAX_BCM2835_CAMERAS]; 65 68 ··· 1873 1870 1874 1871 /* v4l2 core mutex used to protect all fops and v4l2 ioctls. */ 1875 1872 mutex_init(&dev->mutex); 1876 - dev->camera_num = camera; 1877 1873 dev->max_width = resolutions[camera][0]; 1878 1874 dev->max_height = resolutions[camera][1]; 1879 1875 ··· 1888 1886 dev->capture.fmt = &formats[3]; /* JPEG */ 1889 1887 1890 1888 /* v4l device registration */ 1891 - snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), 1892 - "%s", BM2835_MMAL_MODULE_NAME); 1889 + dev->camera_num = v4l2_device_set_name(&dev->v4l2_dev, 1890 + BM2835_MMAL_MODULE_NAME, 1891 + &camera_instance); 1893 1892 ret = v4l2_device_register(NULL, &dev->v4l2_dev); 1894 1893 if (ret) { 1895 1894 dev_err(&pdev->dev, "%s: could not register V4L2 device: %d\n",