diff mbox

[2/5] v4l: flash: Make v4l2_flash_init() and v4l2_flash_release() functions always

Message ID 1432076645-4799-3-git-send-email-sakari.ailus@iki.fi (mailing list archive)
State New, archived
Headers show

Commit Message

Sakari Ailus May 19, 2015, 11:04 p.m. UTC
If CONFIG_V4L2_FLASH_LED_CLASS wasn't defined, v4l2_flash_init() and
v4l2_flash_release() were empty macros. This will lead to compiler warnings
in form of unused variables if the variables are not used for other
purposes.

Instead, implement v4l2_flash_init() and v4l2_flash_release() as static
inline functions.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
---
 include/media/v4l2-flash.h |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart May 23, 2015, 6:40 p.m. UTC | #1
Hi Sakari,

Thank you for the patch.

On Wednesday 20 May 2015 02:04:02 Sakari Ailus wrote:
> If CONFIG_V4L2_FLASH_LED_CLASS wasn't defined, v4l2_flash_init() and
> v4l2_flash_release() were empty macros. This will lead to compiler warnings
> in form of unused variables if the variables are not used for other
> purposes.
> 
> Instead, implement v4l2_flash_init() and v4l2_flash_release() as static
> inline functions.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  include/media/v4l2-flash.h |   12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/include/media/v4l2-flash.h b/include/media/v4l2-flash.h
> index 945fa08..67a2cbf 100644
> --- a/include/media/v4l2-flash.h
> +++ b/include/media/v4l2-flash.h
> @@ -138,8 +138,16 @@ struct v4l2_flash *v4l2_flash_init(struct
> led_classdev_flash *fled_cdev, void v4l2_flash_release(struct v4l2_flash
> *v4l2_flash);
> 
>  #else
> -#define v4l2_flash_init(fled_cdev, ops, config) (NULL)
> -#define v4l2_flash_release(v4l2_flash)
> +static inline struct v4l2_flash *v4l2_flash_init(
> +	struct led_classdev_flash *fled_cdev, const struct v4l2_flash_ops *ops,
> +	struct v4l2_flash_config *config)
> +{
> +	return NULL;
> +}
> +
> +static inline void v4l2_flash_release(struct v4l2_flash *v4l2_flash)
> +{
> +}
>  #endif /* CONFIG_V4L2_FLASH_LED_CLASS */
> 
>  #endif /* _V4L2_FLASH_H */
diff mbox

Patch

diff --git a/include/media/v4l2-flash.h b/include/media/v4l2-flash.h
index 945fa08..67a2cbf 100644
--- a/include/media/v4l2-flash.h
+++ b/include/media/v4l2-flash.h
@@ -138,8 +138,16 @@  struct v4l2_flash *v4l2_flash_init(struct led_classdev_flash *fled_cdev,
 void v4l2_flash_release(struct v4l2_flash *v4l2_flash);
 
 #else
-#define v4l2_flash_init(fled_cdev, ops, config) (NULL)
-#define v4l2_flash_release(v4l2_flash)
+static inline struct v4l2_flash *v4l2_flash_init(
+	struct led_classdev_flash *fled_cdev, const struct v4l2_flash_ops *ops,
+	struct v4l2_flash_config *config)
+{
+	return NULL;
+}
+
+static inline void v4l2_flash_release(struct v4l2_flash *v4l2_flash)
+{
+}
 #endif /* CONFIG_V4L2_FLASH_LED_CLASS */
 
 #endif /* _V4L2_FLASH_H */