diff mbox series

[v3,13/15] env: Mark env_get_location as weak

Message ID b51178c97ce17f491ea6e531911b06e9e4a71de9.1516723179.git-series.maxime.ripard@free-electrons.com
State Accepted
Commit 40c08a68b9acec6ef5a029708834c5a229bde421
Headers show
Series env: Multiple env support and env transition for sunxi | expand

Commit Message

Maxime Ripard Jan. 23, 2018, 8:17 p.m. UTC
Allow boards and architectures to override the default environment lookup
code by overriding env_get_location.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 env/env.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Tom Rini Jan. 27, 2018, 7:21 p.m. UTC | #1
On Tue, Jan 23, 2018 at 09:17:02PM +0100, Maxime Ripard wrote:

> Allow boards and architectures to override the default environment lookup

> code by overriding env_get_location.

> 

> Reviewed-by: Andre Przywara <andre.przywara@arm.com>

> Reviewed-by: Lukasz Majewski <lukma@denx.de>

> Reviewed-by: Simon Glass <sjg@chromium.org>

> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>


Applied to u-boot/master, thanks!

-- 
Tom
Simon Goldschmidt Jan. 30, 2018, 8:12 a.m. UTC | #2
On 23.01.2018 21:17, Maxime Ripard wrote:
> Allow boards and architectures to override the default environment lookup
> code by overriding env_get_location.

Sorry for missing that conversation a bit, but is it really enough to 
override env_get_location?
Overriding this function should make the env_locations array unused, but 
env_set_inited still references it.

Regards,
Simon

>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
> Reviewed-by: Lukasz Majewski <lukma@denx.de>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>   env/env.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/env/env.c b/env/env.c
> index 2ea581cbedd6..9564522e76a5 100644
> --- a/env/env.c
> +++ b/env/env.c
> @@ -85,6 +85,7 @@ static void env_set_inited(enum env_location location)
>    *        highest priority
>    *
>    * This will return the preferred environment for the given priority.
> + * This is overridable by boards if they need to.
>    *
>    * All implementations are free to use the operation, the priority and
>    * any other data relevant to their choice, but must take into account
> @@ -95,7 +96,7 @@ static void env_set_inited(enum env_location location)
>    * Returns:
>    * an enum env_location value on success, a negative error code otherwise
>    */
> -static enum env_location env_get_location(enum env_operation op, int prio)
> +__weak enum env_location env_get_location(enum env_operation op, int prio)
>   {
>   	switch (op) {
>   	case ENVOP_GET_CHAR:
Maxime Ripard Jan. 30, 2018, 8:18 a.m. UTC | #3
On Tue, Jan 30, 2018 at 09:12:41AM +0100, Simon Goldschmidt wrote:
> On 23.01.2018 21:17, Maxime Ripard wrote:

> > Allow boards and architectures to override the default environment lookup

> > code by overriding env_get_location.

> 

> Sorry for missing that conversation a bit, but is it really enough to

> override env_get_location?

> Overriding this function should make the env_locations array unused, but

> env_set_inited still references it.


Well, it's not really referenced, there's a build time boundary check
that we do not overflow our bitfield.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
diff mbox series

Patch

diff --git a/env/env.c b/env/env.c
index 2ea581cbedd6..9564522e76a5 100644
--- a/env/env.c
+++ b/env/env.c
@@ -85,6 +85,7 @@  static void env_set_inited(enum env_location location)
  *        highest priority
  *
  * This will return the preferred environment for the given priority.
+ * This is overridable by boards if they need to.
  *
  * All implementations are free to use the operation, the priority and
  * any other data relevant to their choice, but must take into account
@@ -95,7 +96,7 @@  static void env_set_inited(enum env_location location)
  * Returns:
  * an enum env_location value on success, a negative error code otherwise
  */
-static enum env_location env_get_location(enum env_operation op, int prio)
+__weak enum env_location env_get_location(enum env_operation op, int prio)
 {
 	switch (op) {
 	case ENVOP_GET_CHAR: