linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	linux-media@vger.kernel.org
Subject: Re: [RFCv1 API PATCH 2/4] v4l2-ctrls: add a notify callback.
Date: Mon, 1 Oct 2012 17:01:38 -0300	[thread overview]
Message-ID: <20121001170138.5501f4be@redhat.com> (raw)
In-Reply-To: <201209270844.25497.hverkuil@xs4all.nl>

Em Thu, 27 Sep 2012 08:44:25 +0200
Hans Verkuil <hverkuil@xs4all.nl> escreveu:

> On Wed September 26 2012 12:50:11 Laurent Pinchart wrote:

> > > +	if (notify == NULL) {
> > > +		ctrl->call_notify = 0;
> > > +		return;
> > > +	}
> > > +	/* Only one notifier is allowed. Should we ever need to support
> > > +	   multiple notifiers, then some sort of linked list of notifiers
> > > +	   should be implemented. But I don't see any real reason to implement
> > > +	   that now. If you think you need multiple notifiers, then contact
> > > +	   the linux-media mailinglist. */

If only one notifier is allowed, then you should clearly state that at the
API documentation.

> > > +	if (WARN_ON(ctrl->handler->notify &&
> > > +			(ctrl->handler->notify != notify ||
> > > +			 ctrl->handler->notify_priv != priv)))
> > > +		return;
> > 
> > I'm not sure whether I like that. It feels a bit hackish. Wouldn't it be 
> > better to register the notifier with the handler explictly just once and then 
> > enable/disable notifications on a per-control basis ?
> 
> I thought about that, but I prefer this method because it allows me to switch
> to per-control notifiers in the future. In addition, different controls can have
> different handlers. If you have to set the notifier for handlers, then the
> driver needs to figure out which handlers are involved for the controls it wants
> to be notified on. It's much easier to do it like this.

That also sounded hackish on my eyes. If just one notifier is allowed, the
function should simply refuse any other call to it, as any other call to it
is a driver's bug. So:

	if (WARN_ON(ctrl->handler->notify))
		return;

seems to be enough.

Regards,
Mauro

  reply	other threads:[~2012-10-01 20:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14 11:15 [RFCv1 API PATCH 1/4] Two fixes and two v4l2-ctrl enhancements Hans Verkuil
2012-09-14 11:15 ` [RFCv1 API PATCH 1/4] vb2: fix wrong owner check Hans Verkuil
2012-09-14 11:15   ` [RFCv1 API PATCH 2/4] v4l2-ctrls: add a notify callback Hans Verkuil
2012-09-26 10:50     ` Laurent Pinchart
2012-09-27  6:44       ` Hans Verkuil
2012-10-01 20:01         ` Mauro Carvalho Chehab [this message]
2012-10-02  6:36           ` Hans Verkuil
2012-09-14 11:15   ` [RFCv1 API PATCH 3/4] v4l2-ctrls: add a filter function to v4l2_ctrl_add_handler Hans Verkuil
2012-09-14 11:15   ` [RFCv1 API PATCH 4/4] tuner-core: map audmode to STEREO for radio devices Hans Verkuil
2012-09-25 13:33     ` Mauro Carvalho Chehab
2012-09-25 13:45       ` Hans Verkuil
2012-09-26  2:29         ` Mauro Carvalho Chehab
2012-09-26  7:03           ` Hans Verkuil
2012-09-26  9:35             ` Mauro Carvalho Chehab
2012-09-26  9:57               ` Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121001170138.5501f4be@redhat.com \
    --to=mchehab@redhat.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).