Hi Hans,

Thank you for the patch.

On Saturday 15 March 2014 14:08:00 Hans Verkuil wrote:
> From: Hans Verkuil <hans.verk...@cisco.com>
> 
> The notify function is a void function, yet the v4l2_subdev_notify
> define uses it in a ? : construction, which causes sparse warnings.
> 
> Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
> ---
>  include/media/v4l2-subdev.h | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
> index 28f4d8c..0fbf669 100644
> --- a/include/media/v4l2-subdev.h
> +++ b/include/media/v4l2-subdev.h
> @@ -692,9 +692,11 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
>               (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD))
> 
>  /* Send a notification to v4l2_device. */
> -#define v4l2_subdev_notify(sd, notification, arg)                       \
> -     ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \
> -      (sd)->v4l2_dev->notify((sd), (notification), (arg)))
> +#define v4l2_subdev_notify(sd, notification, arg)                            
> \
> +     do {                                                                    
> \
> +             if ((sd) && (sd)->v4l2_dev && (sd)->v4l2_dev->notify)           
> \
> +                     (sd)->v4l2_dev->notify((sd), (notification), (arg));    
> \
> +     } while (0)

The construct would prevent using v4l2_subdev_notify() as an expression. What 
about turning the macro into an inline function instead ?

>  #define v4l2_subdev_has_op(sd, o, f) \
>       ((sd)->ops->o && (sd)->ops->o->f)

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to