mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] globalvar: fix build without CONFIG_GLOBALVAR
@ 2017-05-17 10:16 Lucas Stach
  2017-05-17 10:16 ` [PATCH 2/2] video: select OFTREE from DRIVER_VIDEO_IMX_IPUV3 Lucas Stach
  2017-05-17 11:39 ` [PATCH 1/2] globalvar: fix build without CONFIG_GLOBALVAR Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Lucas Stach @ 2017-05-17 10:16 UTC (permalink / raw)
  To: barebox

Don't reference global_device if there is no globalvar support build in.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 include/globalvar.h | 186 ++++++++++++++++++++++++++++++++++------------------
 1 file changed, 122 insertions(+), 64 deletions(-)

diff --git a/include/globalvar.h b/include/globalvar.h
index aea43b193dd1..afe390a96afb 100644
--- a/include/globalvar.h
+++ b/include/globalvar.h
@@ -32,6 +32,80 @@ void globalvar_print(void);
 
 void dev_param_init_from_nv(struct device_d *dev, const char *name);
 
+static inline int globalvar_add_simple_bool(const char *name, uint32_t *value)
+{
+	return __globalvar_add_simple_int(name, value, PARAM_TYPE_BOOL, "%u");
+}
+
+static inline int globalvar_add_simple_string(const char *name, char **value)
+{
+	return __globalvar_add_simple_string(name, value);
+}
+
+static inline int globalvar_add_simple_bool_ro(const char *name, uint32_t *value)
+{
+	return PTR_ERR_OR_ZERO(__dev_add_param_int(&global_device, name,
+						   param_set_readonly, NULL,
+						   value, PARAM_TYPE_BOOL, "%u",
+						   NULL));
+}
+
+static inline int globalvar_add_simple_string_ro(const char *name, char **value)
+{
+	return __globalvar_add_simple_string(name, value);
+}
+
+static inline int globalvar_add_simple_bool_fixed(const char *name, uint32_t value)
+{
+	return PTR_ERR_OR_ZERO(__dev_add_param_int(&global_device, name, ERR_PTR(-EROFS),
+						   NULL, &value, PARAM_TYPE_BOOL, "%u",
+						   NULL));
+}
+
+static inline int globalvar_add_simple_string_fixed(const char *name, char *value)
+{
+	return PTR_ERR_OR_ZERO(dev_add_param_string_fixed(&global_device, name, value));
+}
+
+static inline int globalvar_add_simple_enum_ro(const char *name, int *value,
+					       const char * const *names, int max)
+{
+	return PTR_ERR_OR_ZERO(dev_add_param_enum_ro(&global_device, name, value, names,
+						     max));
+}
+
+#define DECLARE_GLOBALVAR_INT(intname, inttype, paramtype) \
+	static inline int globalvar_add_simple_##intname(const char *name,	\
+						      inttype *value,		\
+						      const char *format)	\
+	{									\
+		return __globalvar_add_simple_int(name, value,			\
+						  paramtype,			\
+						  format);			\
+	}
+
+#define DECLARE_GLOBALVAR_INT_RO(intname, inttype, paramtype) \
+	static inline int globalvar_add_simple_##intname##_ro(const char *name,	\
+						      inttype *value,		\
+						      const char *format)	\
+	{									\
+		return PTR_ERR_OR_ZERO(__dev_add_param_int(&global_device, name,\
+							   param_set_readonly,	\
+							   NULL, value,		\
+							   paramtype,		\
+							   format, NULL));	\
+	}
+
+#define DECLARE_GLOBALVAR_INT_FIXED(intname, inttype, paramtype) \
+	static inline int globalvar_add_simple_##intname##_fixed(const char *name,	\
+								 inttype value,		\
+								 const char *format)	\
+	{										\
+		return PTR_ERR_OR_ZERO(__dev_add_param_int(&global_device, name,	\
+							   ERR_PTR(-EROFS), NULL,	\
+							   &value, paramtype,		\
+							   format, NULL));		\
+	}
 #else
 static inline int globalvar_add_simple(const char *name, const char *value)
 {
@@ -102,102 +176,86 @@ static inline int nvvar_save(void)
 	return 0;
 }
 
+static inline int globalvar_add_simple_bool(const char *name, uint32_t *value)
+{
+	return 0;
+}
+
+static inline int globalvar_add_simple_string(const char *name, char **value)
+{
+	return 0;
+}
+
 static inline void dev_param_init_from_nv(struct device_d *dev, const char *name)
 {
 }
 
-#endif
+static inline int globalvar_add_simple_bool_ro(const char *name, uint32_t *value)
+{
+	return 0;
+}
 
-#define DECLARE_GLOBALVAR_INT(intname, inttype, paramtype) \
-	static inline int globalvar_add_simple_##intname(const char *name,	\
-						      inttype *value,		\
-						      const char *format)	\
-	{									\
-		return __globalvar_add_simple_int(name, value,			\
-						  paramtype,			\
-						  format);			\
-	}
+static inline int globalvar_add_simple_string_ro(const char *name, char **value)
+{
+	return 0;
+}
 
-DECLARE_GLOBALVAR_INT(uint32, uint32_t, PARAM_TYPE_UINT32)
-DECLARE_GLOBALVAR_INT(int32, int32_t, PARAM_TYPE_INT32)
-DECLARE_GLOBALVAR_INT(uint64, uint64_t, PARAM_TYPE_UINT64)
-DECLARE_GLOBALVAR_INT(int64, int64_t, PARAM_TYPE_INT64)
+static inline int globalvar_add_simple_bool_fixed(const char *name, uint32_t value)
+{
+	return 0;
+}
 
-static inline int globalvar_add_simple_bool(const char *name, uint32_t *value)
+static inline int globalvar_add_simple_string_fixed(const char *name, char *value)
 {
-	return __globalvar_add_simple_int(name, value, PARAM_TYPE_BOOL, "%u");
+	return 0;
 }
 
-static inline int globalvar_add_simple_string(const char *name, char **value)
+static inline int globalvar_add_simple_enum_ro(const char *name, int *value,
+					       const char * const *names, int max)
 {
-	return __globalvar_add_simple_string(name, value);
+	return 0;
 }
 
+#define DECLARE_GLOBALVAR_INT(intname, inttype, paramtype) \
+	static inline int globalvar_add_simple_##intname(const char *name,	\
+						      inttype *value,		\
+						      const char *format)	\
+	{									\
+		return 0;							\
+	}
+
 #define DECLARE_GLOBALVAR_INT_RO(intname, inttype, paramtype) \
 	static inline int globalvar_add_simple_##intname##_ro(const char *name,	\
 						      inttype *value,		\
 						      const char *format)	\
 	{									\
-		return PTR_ERR_OR_ZERO(__dev_add_param_int(&global_device, name,\
-							   param_set_readonly,	\
-							   NULL, value,		\
-							   paramtype,		\
-							   format, NULL));	\
+		return 0;							\
 	}
 
-DECLARE_GLOBALVAR_INT_RO(uint32, uint32_t, PARAM_TYPE_UINT32)
-DECLARE_GLOBALVAR_INT_RO(int32, int32_t, PARAM_TYPE_INT32)
-DECLARE_GLOBALVAR_INT_RO(uint64, uint64_t, PARAM_TYPE_UINT64)
-DECLARE_GLOBALVAR_INT_RO(int64, int64_t, PARAM_TYPE_INT64)
-
-static inline int globalvar_add_simple_bool_ro(const char *name, uint32_t *value)
-{
-	return PTR_ERR_OR_ZERO(__dev_add_param_int(&global_device, name,
-						   param_set_readonly, NULL,
-						   value, PARAM_TYPE_BOOL, "%u",
-						   NULL));
-}
-
-static inline int globalvar_add_simple_string_ro(const char *name, char **value)
-{
-	return __globalvar_add_simple_string(name, value);
-}
-
 #define DECLARE_GLOBALVAR_INT_FIXED(intname, inttype, paramtype) \
 	static inline int globalvar_add_simple_##intname##_fixed(const char *name,	\
 								 inttype value,		\
 								 const char *format)	\
 	{										\
-		return PTR_ERR_OR_ZERO(__dev_add_param_int(&global_device, name,	\
-							   ERR_PTR(-EROFS), NULL,	\
-							   &value, paramtype,		\
-							   format, NULL));		\
+		return 0;								\
 	}
+#endif
+
+DECLARE_GLOBALVAR_INT(uint32, uint32_t, PARAM_TYPE_UINT32)
+DECLARE_GLOBALVAR_INT(int32, int32_t, PARAM_TYPE_INT32)
+DECLARE_GLOBALVAR_INT(uint64, uint64_t, PARAM_TYPE_UINT64)
+DECLARE_GLOBALVAR_INT(int64, int64_t, PARAM_TYPE_INT64)
+
+DECLARE_GLOBALVAR_INT_RO(uint32, uint32_t, PARAM_TYPE_UINT32)
+DECLARE_GLOBALVAR_INT_RO(int32, int32_t, PARAM_TYPE_INT32)
+DECLARE_GLOBALVAR_INT_RO(uint64, uint64_t, PARAM_TYPE_UINT64)
+DECLARE_GLOBALVAR_INT_RO(int64, int64_t, PARAM_TYPE_INT64)
 
 DECLARE_GLOBALVAR_INT_FIXED(uint32, uint32_t, PARAM_TYPE_UINT32)
 DECLARE_GLOBALVAR_INT_FIXED(int32, int32_t, PARAM_TYPE_INT32)
 DECLARE_GLOBALVAR_INT_FIXED(uint64, uint64_t, PARAM_TYPE_UINT64)
 DECLARE_GLOBALVAR_INT_FIXED(int64, int64_t, PARAM_TYPE_INT64)
 
-static inline int globalvar_add_simple_bool_fixed(const char *name, uint32_t value)
-{
-	return PTR_ERR_OR_ZERO(__dev_add_param_int(&global_device, name, ERR_PTR(-EROFS),
-						   NULL, &value, PARAM_TYPE_BOOL, "%u",
-						   NULL));
-}
-
-static inline int globalvar_add_simple_string_fixed(const char *name, char *value)
-{
-	return PTR_ERR_OR_ZERO(dev_add_param_string_fixed(&global_device, name, value));
-}
-
-static inline int globalvar_add_simple_enum_ro(const char *name, int *value,
-					       const char * const *names, int max)
-{
-	return PTR_ERR_OR_ZERO(dev_add_param_enum_ro(&global_device, name, value, names,
-						     max));
-}
-
 void nv_var_set_clean(void);
 int nvvar_save(void);
 int nv_global_complete(struct string_list *sl, char *instr);
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] video: select OFTREE from DRIVER_VIDEO_IMX_IPUV3
  2017-05-17 10:16 [PATCH 1/2] globalvar: fix build without CONFIG_GLOBALVAR Lucas Stach
@ 2017-05-17 10:16 ` Lucas Stach
  2017-05-17 11:40   ` Sascha Hauer
  2017-05-17 11:39 ` [PATCH 1/2] globalvar: fix build without CONFIG_GLOBALVAR Sascha Hauer
  1 sibling, 1 reply; 4+ messages in thread
From: Lucas Stach @ 2017-05-17 10:16 UTC (permalink / raw)
  To: barebox

DRIVER_VIDEO_IMX_IPUV3 selects VIDEO_VPL, which has a hard dependency
on OFTREE, so it is required to select this one, too.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/video/imx-ipu-v3/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/imx-ipu-v3/Kconfig b/drivers/video/imx-ipu-v3/Kconfig
index d04123731434..55aeac941550 100644
--- a/drivers/video/imx-ipu-v3/Kconfig
+++ b/drivers/video/imx-ipu-v3/Kconfig
@@ -2,6 +2,7 @@ config DRIVER_VIDEO_IMX_IPUV3
 	bool "i.MX IPUv3 driver"
 	depends on ARCH_IMX
 	select VIDEO_VPL
+	select OFTREE
 	help
 	  Support the IPUv3 found on Freescale i.MX51/53/6 SoCs
 
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] globalvar: fix build without CONFIG_GLOBALVAR
  2017-05-17 10:16 [PATCH 1/2] globalvar: fix build without CONFIG_GLOBALVAR Lucas Stach
  2017-05-17 10:16 ` [PATCH 2/2] video: select OFTREE from DRIVER_VIDEO_IMX_IPUV3 Lucas Stach
@ 2017-05-17 11:39 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2017-05-17 11:39 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Wed, May 17, 2017 at 12:16:55PM +0200, Lucas Stach wrote:
> Don't reference global_device if there is no globalvar support build in.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  include/globalvar.h | 186 ++++++++++++++++++++++++++++++++++------------------
>  1 file changed, 122 insertions(+), 64 deletions(-)
> 
> diff --git a/include/globalvar.h b/include/globalvar.h
> index aea43b193dd1..afe390a96afb 100644
> --- a/include/globalvar.h
> +++ b/include/globalvar.h
> @@ -32,6 +32,80 @@ void globalvar_print(void);
>  
> -#endif
> +static inline int globalvar_add_simple_bool_ro(const char *name, uint32_t *value)
> +{
> +	return 0;
> +}
>  
> -#define DECLARE_GLOBALVAR_INT(intname, inttype, paramtype) \
> -	static inline int globalvar_add_simple_##intname(const char *name,	\
> -						      inttype *value,		\
> -						      const char *format)	\
> -	{									\
> -		return __globalvar_add_simple_int(name, value,			\
> -						  paramtype,			\
> -						  format);			\
> -	}

Wouldn't it be nicer to do a

	if (!IS_ENABLED(CONFIG_GLOBALVAR))
		return 0;

here and elsewhere?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] video: select OFTREE from DRIVER_VIDEO_IMX_IPUV3
  2017-05-17 10:16 ` [PATCH 2/2] video: select OFTREE from DRIVER_VIDEO_IMX_IPUV3 Lucas Stach
@ 2017-05-17 11:40   ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2017-05-17 11:40 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Wed, May 17, 2017 at 12:16:56PM +0200, Lucas Stach wrote:
> DRIVER_VIDEO_IMX_IPUV3 selects VIDEO_VPL, which has a hard dependency
> on OFTREE, so it is required to select this one, too.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/video/imx-ipu-v3/Kconfig | 1 +
>  1 file changed, 1 insertion(+)

Applied (this one), thanks

Sascha

> 
> diff --git a/drivers/video/imx-ipu-v3/Kconfig b/drivers/video/imx-ipu-v3/Kconfig
> index d04123731434..55aeac941550 100644
> --- a/drivers/video/imx-ipu-v3/Kconfig
> +++ b/drivers/video/imx-ipu-v3/Kconfig
> @@ -2,6 +2,7 @@ config DRIVER_VIDEO_IMX_IPUV3
>  	bool "i.MX IPUv3 driver"
>  	depends on ARCH_IMX
>  	select VIDEO_VPL
> +	select OFTREE
>  	help
>  	  Support the IPUv3 found on Freescale i.MX51/53/6 SoCs
>  
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-17 11:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-17 10:16 [PATCH 1/2] globalvar: fix build without CONFIG_GLOBALVAR Lucas Stach
2017-05-17 10:16 ` [PATCH 2/2] video: select OFTREE from DRIVER_VIDEO_IMX_IPUV3 Lucas Stach
2017-05-17 11:40   ` Sascha Hauer
2017-05-17 11:39 ` [PATCH 1/2] globalvar: fix build without CONFIG_GLOBALVAR Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox