diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-07 12:34:37 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-07 12:34:37 -0700 |
commit | 3036bc45364f98515a2c446d7fac2c34dcfbeff4 (patch) | |
tree | f565c03254413b779981ee5e9ed81b19d5b62c78 /drivers/media/v4l2-core/v4l2-dev.c | |
parent | c90fca951e90ba470a3dc6087667edffcf8db21b (diff) | |
parent | 48a8bbc7ca494709522621929f8407ab823d73fc (diff) |
Merge tag 'media/v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
- remove of atomisp driver from staging, as nobody would have time to
dedicate huge efforts to fix all the problems there. Also, we have a
feeling that the driver may not even run the way it is.
- move Zoran driver to staging, in order to be either fixed to use VB2
and the proper media kAPIs or to be removed
- remove videobuf-dvb driver, with is unused for a while
- some V4L2 documentation fixes/improvements
- new sensor drivers: imx258 and ov7251
- a new driver was added to allow using I2C transparent drivers
- several improvements at the ddbridge driver
- several improvements at the ISDB pt1 driver, making it more coherent
with the DVB framework
- added a new platform driver for MIPI CSI-2 RX: cadence
- now, all media drivers can be compiled on x86 with COMPILE_TEST
- almost all media drivers now build on non-x86 architectures with
COMPILE_TEST
- lots of other random stuff: cleanups, support for new board models,
bug fixes, etc
* tag 'media/v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (464 commits)
media: omap2: fix compile-testing with FB_OMAP2=m
media: media/radio/Kconfig: add back RADIO_ISA
media: v4l2-ioctl.c: fix missing unlock in __video_do_ioctl()
media: pxa_camera: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power
media: arch: sh: migor: Fix TW9910 PDN gpio
media: staging: tegra-vde: Reset VDE regardless of memory client resetting failure
media: marvel-ccic: mmp: select VIDEOBUF2_VMALLOC/DMA_CONTIG
media: marvel-ccic: allow ccic and mmp drivers to coexist
media: uvcvideo: Prevent setting unavailable flags
media: ddbridge: conditionally enable fast TS for stv0910-equipped bridges
media: dvb-frontends/stv0910: make TS speed configurable
media: ddbridge/mci: add identifiers to function definition arguments
media: ddbridge/mci: protect against out-of-bounds array access in stop()
media: rc: ensure input/lirc device can be opened after register
media: rc: nuvoton: Keep device enabled during reg init
media: rc: nuvoton: Keep track of users on CIR enable/disable
media: rc: nuvoton: Tweak the interrupt enabling dance
media: uvcvideo: Support realtek's UVC 1.5 device
media: uvcvideo: Fix driver reference counting
media: gspca_zc3xx: Enable short exposure times for OV7648
...
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-dev.c')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-dev.c | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index c080dcc75393..4ffd7d60a901 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -16,6 +16,8 @@ * - Added procfs support */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> @@ -34,6 +36,12 @@ #define VIDEO_NUM_DEVICES 256 #define VIDEO_NAME "video4linux" +#define dprintk(fmt, arg...) do { \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) + + /* * sysfs stuff */ @@ -91,7 +99,7 @@ ATTRIBUTE_GROUPS(video_device); /* * Active devices */ -static struct video_device *video_device[VIDEO_NUM_DEVICES]; +static struct video_device *video_devices[VIDEO_NUM_DEVICES]; static DEFINE_MUTEX(videodev_lock); static DECLARE_BITMAP(devnode_nums[VFL_TYPE_MAX], VIDEO_NUM_DEVICES); @@ -173,14 +181,14 @@ static void v4l2_device_release(struct device *cd) struct v4l2_device *v4l2_dev = vdev->v4l2_dev; mutex_lock(&videodev_lock); - if (WARN_ON(video_device[vdev->minor] != vdev)) { + if (WARN_ON(video_devices[vdev->minor] != vdev)) { /* should not happen */ mutex_unlock(&videodev_lock); return; } /* Free up this device for reuse */ - video_device[vdev->minor] = NULL; + video_devices[vdev->minor] = NULL; /* Delete the cdev on this minor as well */ cdev_del(vdev->cdev); @@ -229,7 +237,7 @@ static struct class video_class = { struct video_device *video_devdata(struct file *file) { - return video_device[iminor(file_inode(file))]; + return video_devices[iminor(file_inode(file))]; } EXPORT_SYMBOL(video_devdata); @@ -309,7 +317,7 @@ static ssize_t v4l2_read(struct file *filp, char __user *buf, ret = vdev->fops->read(filp, buf, sz, off); if ((vdev->dev_debug & V4L2_DEV_DEBUG_FOP) && (vdev->dev_debug & V4L2_DEV_DEBUG_STREAMING)) - printk(KERN_DEBUG "%s: read: %zd (%d)\n", + dprintk("%s: read: %zd (%d)\n", video_device_node_name(vdev), sz, ret); return ret; } @@ -326,7 +334,7 @@ static ssize_t v4l2_write(struct file *filp, const char __user *buf, ret = vdev->fops->write(filp, buf, sz, off); if ((vdev->dev_debug & V4L2_DEV_DEBUG_FOP) && (vdev->dev_debug & V4L2_DEV_DEBUG_STREAMING)) - printk(KERN_DEBUG "%s: write: %zd (%d)\n", + dprintk("%s: write: %zd (%d)\n", video_device_node_name(vdev), sz, ret); return ret; } @@ -341,7 +349,7 @@ static __poll_t v4l2_poll(struct file *filp, struct poll_table_struct *poll) if (video_is_registered(vdev)) res = vdev->fops->poll(filp, poll); if (vdev->dev_debug & V4L2_DEV_DEBUG_POLL) - printk(KERN_DEBUG "%s: poll: %08x\n", + dprintk("%s: poll: %08x\n", video_device_node_name(vdev), res); return res; } @@ -352,14 +360,8 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) int ret = -ENODEV; if (vdev->fops->unlocked_ioctl) { - struct mutex *lock = v4l2_ioctl_get_lock(vdev, cmd); - - if (lock && mutex_lock_interruptible(lock)) - return -ERESTARTSYS; if (video_is_registered(vdev)) ret = vdev->fops->unlocked_ioctl(filp, cmd, arg); - if (lock) - mutex_unlock(lock); } else ret = -ENOTTY; @@ -382,7 +384,7 @@ static unsigned long v4l2_get_unmapped_area(struct file *filp, return -ENODEV; ret = vdev->fops->get_unmapped_area(filp, addr, len, pgoff, flags); if (vdev->dev_debug & V4L2_DEV_DEBUG_FOP) - printk(KERN_DEBUG "%s: get_unmapped_area (%d)\n", + dprintk("%s: get_unmapped_area (%d)\n", video_device_node_name(vdev), ret); return ret; } @@ -398,7 +400,7 @@ static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) if (video_is_registered(vdev)) ret = vdev->fops->mmap(filp, vm); if (vdev->dev_debug & V4L2_DEV_DEBUG_FOP) - printk(KERN_DEBUG "%s: mmap (%d)\n", + dprintk("%s: mmap (%d)\n", video_device_node_name(vdev), ret); return ret; } @@ -428,7 +430,7 @@ static int v4l2_open(struct inode *inode, struct file *filp) } if (vdev->dev_debug & V4L2_DEV_DEBUG_FOP) - printk(KERN_DEBUG "%s: open (%d)\n", + dprintk("%s: open (%d)\n", video_device_node_name(vdev), ret); /* decrease the refcount in case of an error */ if (ret) @@ -445,7 +447,7 @@ static int v4l2_release(struct inode *inode, struct file *filp) if (vdev->fops->release) ret = vdev->fops->release(filp); if (vdev->dev_debug & V4L2_DEV_DEBUG_FOP) - printk(KERN_DEBUG "%s: release\n", + dprintk("%s: release\n", video_device_node_name(vdev)); /* decrease the refcount unconditionally since the release() @@ -493,9 +495,9 @@ static int get_index(struct video_device *vdev) bitmap_zero(used, VIDEO_NUM_DEVICES); for (i = 0; i < VIDEO_NUM_DEVICES; i++) { - if (video_device[i] != NULL && - video_device[i]->v4l2_dev == vdev->v4l2_dev) { - set_bit(video_device[i]->index, used); + if (video_devices[i] != NULL && + video_devices[i]->v4l2_dev == vdev->v4l2_dev) { + set_bit(video_devices[i]->index, used); } } @@ -786,8 +788,7 @@ static int video_register_media_controller(struct video_device *vdev, int type) ret = media_device_register_entity(vdev->v4l2_dev->mdev, &vdev->entity); if (ret < 0) { - printk(KERN_WARNING - "%s: media_device_register_entity failed\n", + pr_warn("%s: media_device_register_entity failed\n", __func__); return ret; } @@ -869,7 +870,7 @@ int __video_register_device(struct video_device *vdev, name_base = "v4l-touch"; break; default: - printk(KERN_ERR "%s called with unknown type: %d\n", + pr_err("%s called with unknown type: %d\n", __func__, type); return -EINVAL; } @@ -918,7 +919,7 @@ int __video_register_device(struct video_device *vdev, if (nr == minor_cnt) nr = devnode_find(vdev, 0, minor_cnt); if (nr == minor_cnt) { - printk(KERN_ERR "could not get a free device node number\n"); + pr_err("could not get a free device node number\n"); mutex_unlock(&videodev_lock); return -ENFILE; } @@ -929,11 +930,11 @@ int __video_register_device(struct video_device *vdev, /* The device node number and minor numbers are independent, so we just find the first free minor number. */ for (i = 0; i < VIDEO_NUM_DEVICES; i++) - if (video_device[i] == NULL) + if (video_devices[i] == NULL) break; if (i == VIDEO_NUM_DEVICES) { mutex_unlock(&videodev_lock); - printk(KERN_ERR "could not get a free minor\n"); + pr_err("could not get a free minor\n"); return -ENFILE; } #endif @@ -941,14 +942,14 @@ int __video_register_device(struct video_device *vdev, vdev->num = nr; /* Should not happen since we thought this minor was free */ - if (WARN_ON(video_device[vdev->minor])) { + if (WARN_ON(video_devices[vdev->minor])) { mutex_unlock(&videodev_lock); - printk(KERN_ERR "video_device not empty!\n"); + pr_err("video_device not empty!\n"); return -ENFILE; } devnode_set(vdev); vdev->index = get_index(vdev); - video_device[vdev->minor] = vdev; + video_devices[vdev->minor] = vdev; mutex_unlock(&videodev_lock); if (vdev->ioctl_ops) @@ -964,7 +965,7 @@ int __video_register_device(struct video_device *vdev, vdev->cdev->owner = owner; ret = cdev_add(vdev->cdev, MKDEV(VIDEO_MAJOR, vdev->minor), 1); if (ret < 0) { - printk(KERN_ERR "%s: cdev_add failed\n", __func__); + pr_err("%s: cdev_add failed\n", __func__); kfree(vdev->cdev); vdev->cdev = NULL; goto cleanup; @@ -977,7 +978,7 @@ int __video_register_device(struct video_device *vdev, dev_set_name(&vdev->dev, "%s%d", name_base, vdev->num); ret = device_register(&vdev->dev); if (ret < 0) { - printk(KERN_ERR "%s: device_register failed\n", __func__); + pr_err("%s: device_register failed\n", __func__); goto cleanup; } /* Register the release callback that will be called when the last @@ -985,7 +986,7 @@ int __video_register_device(struct video_device *vdev, vdev->dev.release = v4l2_device_release; if (nr != -1 && nr != vdev->num && warn_if_nr_in_use) - printk(KERN_WARNING "%s: requested %s%d, got %s\n", __func__, + pr_warn("%s: requested %s%d, got %s\n", __func__, name_base, nr, video_device_node_name(vdev)); /* Increase v4l2_device refcount */ @@ -1003,7 +1004,7 @@ cleanup: mutex_lock(&videodev_lock); if (vdev->cdev) cdev_del(vdev->cdev); - video_device[vdev->minor] = NULL; + video_devices[vdev->minor] = NULL; devnode_clear(vdev); mutex_unlock(&videodev_lock); /* Mark this video device as never having been registered. */ @@ -1043,10 +1044,10 @@ static int __init videodev_init(void) dev_t dev = MKDEV(VIDEO_MAJOR, 0); int ret; - printk(KERN_INFO "Linux video capture interface: v2.00\n"); + pr_info("Linux video capture interface: v2.00\n"); ret = register_chrdev_region(dev, VIDEO_NUM_DEVICES, VIDEO_NAME); if (ret < 0) { - printk(KERN_WARNING "videodev: unable to get major %d\n", + pr_warn("videodev: unable to get major %d\n", VIDEO_MAJOR); return ret; } @@ -1054,7 +1055,7 @@ static int __init videodev_init(void) ret = class_register(&video_class); if (ret < 0) { unregister_chrdev_region(dev, VIDEO_NUM_DEVICES); - printk(KERN_WARNING "video_dev: class_register failed\n"); + pr_warn("video_dev: class_register failed\n"); return -EIO; } |