Re: [PATCH v7 10/18] v4l: async: Introduce macros for calling async ops callbacks

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

 




Hi Hans,

On Mon, Sep 04, 2017 at 03:50:52PM +0200, Hans Verkuil wrote:
> On 09/03/2017 07:49 PM, Sakari Ailus wrote:
> > Add two macros to call async operations callbacks. Besides simplifying
> > callbacks, this allows async notifiers to have no ops set, i.e. it can be
> > left NULL.
> > 
> > Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
> > ---
> >  drivers/media/v4l2-core/v4l2-async.c | 19 +++++++------------
> >  include/media/v4l2-async.h           |  8 ++++++++
> >  2 files changed, 15 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
> > index 810f5e0273dc..91d04f00b4e4 100644
> > --- a/drivers/media/v4l2-core/v4l2-async.c
> > +++ b/drivers/media/v4l2-core/v4l2-async.c
> > @@ -107,16 +107,13 @@ static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier,
> >  {
> >  	int ret;
> >  
> > -	if (notifier->ops->bound) {
> > -		ret = notifier->ops->bound(notifier, sd, asd);
> > -		if (ret < 0)
> > -			return ret;
> > -	}
> > +	ret = v4l2_async_notifier_call_int_op(notifier, bound, sd, asd);
> 
> Hmm, I think this is rather ugly. We only have three ops, so why not make
> three macros:
> 
> 	v4l2_async_notifier_call_bound/unbind/complete?
> 
> Much cleaner than _int_op(...bound...).

Works for me.

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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux