diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-03-17 08:54:19 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-04-16 17:13:56 -0400 |
commit | ba76a6e6a5eaa3736df743818394978af456cf70 (patch) | |
tree | 2efc6326c1d7f9854acf992a2fc95406738efe55 | |
parent | ae5fd3d5305da625461a15d15637f30e8e1639f2 (diff) |
[media] v4l2-subdev.h: fix sparse error with v4l2_subdev_notify
The notify function is a void function, yet the v4l2_subdev_notify
define uses it in a ? : construction, which causes sparse warnings.
Replace the define by a static inline function and move it to
v4l2-device.h, which is where it belongs since it needs to know the
v4l2_device struct. This wasn't a problem when it was a define, but
as a static inline function this no longer compiles in v4l2-subdev.h.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | include/media/v4l2-device.h | 8 | ||||
-rw-r--r-- | include/media/v4l2-subdev.h | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index c9b1593923f6..ffb69da3ce9e 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h | |||
@@ -120,6 +120,14 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); | |||
120 | int __must_check | 120 | int __must_check |
121 | v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev); | 121 | v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev); |
122 | 122 | ||
123 | /* Send a notification to v4l2_device. */ | ||
124 | static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, | ||
125 | unsigned int notification, void *arg) | ||
126 | { | ||
127 | if (sd && sd->v4l2_dev && sd->v4l2_dev->notify) | ||
128 | sd->v4l2_dev->notify(sd, notification, arg); | ||
129 | } | ||
130 | |||
123 | /* Iterate over all subdevs. */ | 131 | /* Iterate over all subdevs. */ |
124 | #define v4l2_device_for_each_subdev(sd, v4l2_dev) \ | 132 | #define v4l2_device_for_each_subdev(sd, v4l2_dev) \ |
125 | list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) | 133 | list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) |
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 28f4d8c3cf7d..ee1cb2d354a8 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
@@ -691,11 +691,6 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, | |||
691 | (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \ | 691 | (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \ |
692 | (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) | 692 | (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) |
693 | 693 | ||
694 | /* Send a notification to v4l2_device. */ | ||
695 | #define v4l2_subdev_notify(sd, notification, arg) \ | ||
696 | ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \ | ||
697 | (sd)->v4l2_dev->notify((sd), (notification), (arg))) | ||
698 | |||
699 | #define v4l2_subdev_has_op(sd, o, f) \ | 694 | #define v4l2_subdev_has_op(sd, o, f) \ |
700 | ((sd)->ops->o && (sd)->ops->o->f) | 695 | ((sd)->ops->o && (sd)->ops->o->f) |
701 | 696 | ||