linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] v4l2-event: v4l2_event_queue: do nothing if vdev == NULL
@ 2015-06-23  9:20 Hans Verkuil
  2015-06-25  9:12 ` Sakari Ailus
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Verkuil @ 2015-06-23  9:20 UTC (permalink / raw)
  To: linux-media, Sakari Ailus, Lars-Peter Clausen

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.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] v4l2-event: v4l2_event_queue: do nothing if vdev == NULL
  2015-06-23  9:20 [PATCH] v4l2-event: v4l2_event_queue: do nothing if vdev == NULL Hans Verkuil
@ 2015-06-25  9:12 ` Sakari Ailus
  2015-06-25  9:22   ` Lars-Peter Clausen
  0 siblings, 1 reply; 4+ messages in thread
From: Sakari Ailus @ 2015-06-25  9:12 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, Lars-Peter Clausen

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@cisco.com>
> 
> 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@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] v4l2-event: v4l2_event_queue: do nothing if vdev == NULL
  2015-06-25  9:12 ` Sakari Ailus
@ 2015-06-25  9:22   ` Lars-Peter Clausen
  2015-06-25  9:35     ` Sakari Ailus
  0 siblings, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2015-06-25  9:22 UTC (permalink / raw)
  To: Sakari Ailus, Hans Verkuil; +Cc: linux-media

On 06/25/2015 11:12 AM, Sakari Ailus wrote:
> 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?

The device node will only be created if the subdev driver supports it and if 
the bridge driver requests it. So if the subdev driver supports it, but the 
bridge driver does not request it there will be no devnode. The patch is to 
handle that case.

This patch is a requirement for this series which adds support for direct 
event notification to some subdev drivers. Why this is necessary and useful 
can be found in the series patch description. 
http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/92808

- Lars

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] v4l2-event: v4l2_event_queue: do nothing if vdev == NULL
  2015-06-25  9:22   ` Lars-Peter Clausen
@ 2015-06-25  9:35     ` Sakari Ailus
  0 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2015-06-25  9:35 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Hans Verkuil, linux-media

Hi Lars-Peter,

On Thu, Jun 25, 2015 at 11:22:02AM +0200, Lars-Peter Clausen wrote:
> On 06/25/2015 11:12 AM, Sakari Ailus wrote:
> >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?
> 
> The device node will only be created if the subdev driver supports it and if
> the bridge driver requests it. So if the subdev driver supports it, but the
> bridge driver does not request it there will be no devnode. The patch is to
> handle that case.
> 
> This patch is a requirement for this series which adds support for direct
> event notification to some subdev drivers. Why this is necessary and useful
> can be found in the series patch description.
> http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/92808

Ok, fair enough.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-25  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23  9:20 [PATCH] v4l2-event: v4l2_event_queue: do nothing if vdev == NULL Hans Verkuil
2015-06-25  9:12 ` Sakari Ailus
2015-06-25  9:22   ` Lars-Peter Clausen
2015-06-25  9:35     ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).