Commit 6c2d4dd1 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

V4L/DVB: V4L2: avoid name conflicts in macros

"sd" and "err" are too common names to be used in macros for local variables.
Prefix them with an underscore to avoid name clashing.

[mchehab@redhat.com: whitespace cleanups]
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Reviewed-by: default avatarAndy Walls <awalls@md.metrocast.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7a569f52
...@@ -675,8 +675,11 @@ static inline int cx18_raw_vbi(const struct cx18 *cx) ...@@ -675,8 +675,11 @@ static inline int cx18_raw_vbi(const struct cx18 *cx)
/* Call the specified callback for all subdevs with a grp_id bit matching the /* Call the specified callback for all subdevs with a grp_id bit matching the
* mask in hw (if 0, then match them all). Ignore any errors. */ * mask in hw (if 0, then match them all). Ignore any errors. */
#define cx18_call_hw(cx, hw, o, f, args...) \ #define cx18_call_hw(cx, hw, o, f, args...) \
__v4l2_device_call_subdevs(&(cx)->v4l2_dev, \ do { \
!(hw) || (sd->grp_id & (hw)), o, f , ##args) struct v4l2_subdev *__sd; \
__v4l2_device_call_subdevs_p(&(cx)->v4l2_dev, __sd, \
!(hw) || (__sd->grp_id & (hw)), o, f , ##args); \
} while (0)
#define cx18_call_all(cx, o, f, args...) cx18_call_hw(cx, 0, o, f , ##args) #define cx18_call_all(cx, o, f, args...) cx18_call_hw(cx, 0, o, f , ##args)
...@@ -684,8 +687,12 @@ static inline int cx18_raw_vbi(const struct cx18 *cx) ...@@ -684,8 +687,12 @@ static inline int cx18_raw_vbi(const struct cx18 *cx)
* mask in hw (if 0, then match them all). If the callback returns an error * mask in hw (if 0, then match them all). If the callback returns an error
* other than 0 or -ENOIOCTLCMD, then return with that error code. */ * other than 0 or -ENOIOCTLCMD, then return with that error code. */
#define cx18_call_hw_err(cx, hw, o, f, args...) \ #define cx18_call_hw_err(cx, hw, o, f, args...) \
__v4l2_device_call_subdevs_until_err( \ ({ \
&(cx)->v4l2_dev, !(hw) || (sd->grp_id & (hw)), o, f , ##args) struct v4l2_subdev *__sd; \
__v4l2_device_call_subdevs_until_err_p(&(cx)->v4l2_dev, \
__sd, !(hw) || (__sd->grp_id & (hw)), o, f, \
##args); \
})
#define cx18_call_all_err(cx, o, f, args...) \ #define cx18_call_all_err(cx, o, f, args...) \
cx18_call_hw_err(cx, 0, o, f , ##args) cx18_call_hw_err(cx, 0, o, f , ##args)
......
...@@ -811,7 +811,11 @@ static inline int ivtv_raw_vbi(const struct ivtv *itv) ...@@ -811,7 +811,11 @@ static inline int ivtv_raw_vbi(const struct ivtv *itv)
/* Call the specified callback for all subdevs matching hw (if 0, then /* Call the specified callback for all subdevs matching hw (if 0, then
match them all). Ignore any errors. */ match them all). Ignore any errors. */
#define ivtv_call_hw(itv, hw, o, f, args...) \ #define ivtv_call_hw(itv, hw, o, f, args...) \
__v4l2_device_call_subdevs(&(itv)->v4l2_dev, !(hw) || (sd->grp_id & (hw)), o, f , ##args) do { \
struct v4l2_subdev *__sd; \
__v4l2_device_call_subdevs_p(&(itv)->v4l2_dev, __sd, \
!(hw) || (__sd->grp_id & (hw)), o, f , ##args); \
} while (0)
#define ivtv_call_all(itv, o, f, args...) ivtv_call_hw(itv, 0, o, f , ##args) #define ivtv_call_all(itv, o, f, args...) ivtv_call_hw(itv, 0, o, f , ##args)
...@@ -819,7 +823,11 @@ static inline int ivtv_raw_vbi(const struct ivtv *itv) ...@@ -819,7 +823,11 @@ static inline int ivtv_raw_vbi(const struct ivtv *itv)
match them all). If the callback returns an error other than 0 or match them all). If the callback returns an error other than 0 or
-ENOIOCTLCMD, then return with that error code. */ -ENOIOCTLCMD, then return with that error code. */
#define ivtv_call_hw_err(itv, hw, o, f, args...) \ #define ivtv_call_hw_err(itv, hw, o, f, args...) \
__v4l2_device_call_subdevs_until_err(&(itv)->v4l2_dev, !(hw) || (sd->grp_id & (hw)), o, f , ##args) ({ \
struct v4l2_subdev *__sd; \
__v4l2_device_call_subdevs_until_err_p(&(itv)->v4l2_dev, __sd, \
!(hw) || (__sd->grp_id & (hw)), o, f , ##args); \
})
#define ivtv_call_all_err(itv, o, f, args...) ivtv_call_hw_err(itv, 0, o, f , ##args) #define ivtv_call_all_err(itv, o, f, args...) ivtv_call_hw_err(itv, 0, o, f , ##args)
......
...@@ -101,46 +101,67 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); ...@@ -101,46 +101,67 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
/* Call the specified callback for all subdevs matching the condition. /* Call the specified callback for all subdevs matching the condition.
Ignore any errors. Note that you cannot add or delete a subdev Ignore any errors. Note that you cannot add or delete a subdev
while walking the subdevs list. */ while walking the subdevs list. */
#define __v4l2_device_call_subdevs_p(v4l2_dev, sd, cond, o, f, args...) \
do { \
list_for_each_entry((sd), &(v4l2_dev)->subdevs, list) \
if ((cond) && (sd)->ops->o && (sd)->ops->o->f) \
(sd)->ops->o->f((sd) , ##args); \
} while (0)
#define __v4l2_device_call_subdevs(v4l2_dev, cond, o, f, args...) \ #define __v4l2_device_call_subdevs(v4l2_dev, cond, o, f, args...) \
do { \ do { \
struct v4l2_subdev *sd; \ struct v4l2_subdev *__sd; \
\ \
list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) \ __v4l2_device_call_subdevs_p(v4l2_dev, __sd, cond, o, \
if ((cond) && sd->ops->o && sd->ops->o->f) \ f , ##args); \
sd->ops->o->f(sd , ##args); \
} while (0) } while (0)
/* Call the specified callback for all subdevs matching the condition. /* Call the specified callback for all subdevs matching the condition.
If the callback returns an error other than 0 or -ENOIOCTLCMD, then If the callback returns an error other than 0 or -ENOIOCTLCMD, then
return with that error code. Note that you cannot add or delete a return with that error code. Note that you cannot add or delete a
subdev while walking the subdevs list. */ subdev while walking the subdevs list. */
#define __v4l2_device_call_subdevs_until_err(v4l2_dev, cond, o, f, args...) \ #define __v4l2_device_call_subdevs_until_err_p(v4l2_dev, sd, cond, o, f, args...) \
({ \ ({ \
struct v4l2_subdev *sd; \ long __err = 0; \
long err = 0; \
\ \
list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) { \ list_for_each_entry((sd), &(v4l2_dev)->subdevs, list) { \
if ((cond) && sd->ops->o && sd->ops->o->f) \ if ((cond) && (sd)->ops->o && (sd)->ops->o->f) \
err = sd->ops->o->f(sd , ##args); \ __err = (sd)->ops->o->f((sd) , ##args); \
if (err && err != -ENOIOCTLCMD) \ if (__err && __err != -ENOIOCTLCMD) \
break; \ break; \
} \ } \
(err == -ENOIOCTLCMD) ? 0 : err; \ (__err == -ENOIOCTLCMD) ? 0 : __err; \
})
#define __v4l2_device_call_subdevs_until_err(v4l2_dev, cond, o, f, args...) \
({ \
struct v4l2_subdev *__sd; \
__v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd, cond, o, \
f, args...); \
}) })
/* Call the specified callback for all subdevs matching grp_id (if 0, then /* Call the specified callback for all subdevs matching grp_id (if 0, then
match them all). Ignore any errors. Note that you cannot add or delete match them all). Ignore any errors. Note that you cannot add or delete
a subdev while walking the subdevs list. */ a subdev while walking the subdevs list. */
#define v4l2_device_call_all(v4l2_dev, grpid, o, f, args...) \ #define v4l2_device_call_all(v4l2_dev, grpid, o, f, args...) \
__v4l2_device_call_subdevs(v4l2_dev, \ do { \
!(grpid) || sd->grp_id == (grpid), o, f , ##args) struct v4l2_subdev *__sd; \
\
__v4l2_device_call_subdevs_p(v4l2_dev, __sd, \
!(grpid) || __sd->grp_id == (grpid), o, f , \
##args); \
} while (0)
/* Call the specified callback for all subdevs matching grp_id (if 0, then /* Call the specified callback for all subdevs matching grp_id (if 0, then
match them all). If the callback returns an error other than 0 or match them all). If the callback returns an error other than 0 or
-ENOIOCTLCMD, then return with that error code. Note that you cannot -ENOIOCTLCMD, then return with that error code. Note that you cannot
add or delete a subdev while walking the subdevs list. */ add or delete a subdev while walking the subdevs list. */
#define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...) \ #define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...) \
__v4l2_device_call_subdevs_until_err(v4l2_dev, \ ({ \
!(grpid) || sd->grp_id == (grpid), o, f , ##args) struct v4l2_subdev *__sd; \
__v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd, \
!(grpid) || __sd->grp_id == (grpid), o, f , \
##args); \
})
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment