Re: [PATCH] v4l2-event: v4l2_event_queue: do nothing if vdev == NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hans,

On Tue, Jun 23, 2015 at 11:20:23AM +0200, Hans Verkuil wrote:
> If the vdev pointer == NULL, then just return.
> 
> This makes it easier for subdev drivers to use this function without having to
> check if the sd->devnode pointer is NULL or not.

Do you have an example of when this would be useful? Isn't it a rather
fundamental question to a driver whether or not it exposes a device node,
i.e. why would a driver use v4l2_event_queue() in the first place if it does
not expose a device node, and so the event interface?

> 
> Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>
> 
> diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c
> index 8761aab..8d3171c 100644
> --- a/drivers/media/v4l2-core/v4l2-event.c
> +++ b/drivers/media/v4l2-core/v4l2-event.c
> @@ -172,6 +172,9 @@ void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev)
>  	unsigned long flags;
>  	struct timespec timestamp;
> 
> +	if (vdev == NULL)
> +		return;
> +
>  	ktime_get_ts(&timestamp);
> 
>  	spin_lock_irqsave(&vdev->fh_lock, flags);

-- 
Regards,

Sakari Ailus
e-mail: sakari.ailus@xxxxxx	XMPP: sailus@xxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux