mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Daniel Schultz <d.schultz@phytec.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 4/6] common: state: Add variable_type to state_variable
Date: Fri, 3 Nov 2017 09:12:50 +0100	[thread overview]
Message-ID: <20171103081250.iwd7wtb4ywabaxjy@pengutronix.de> (raw)
In-Reply-To: <1509626565-3722-4-git-send-email-d.schultz@phytec.de>

On Thu, Nov 02, 2017 at 01:42:43PM +0100, Daniel Schultz wrote:
> Add a pointer in state_variable to the corresponding variable_type array
> element.
> 
> Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
> ---
> Changes:
> 	v2: New patch
> 
>  common/state/state.h           | 1 +
>  common/state/state_variables.c | 5 +++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/common/state/state.h b/common/state/state.h
> index 81aaec2..14b54aa 100644
> --- a/common/state/state.h
> +++ b/common/state/state.h
> @@ -132,6 +132,7 @@ struct variable_type {
>  struct state_variable {
>  	struct state *state;
>  	struct list_head list;
> +	struct variable_type *type;
>  	const char *name;
>  	unsigned int start;
>  	unsigned int size;
> diff --git a/common/state/state_variables.c b/common/state/state_variables.c
> index 56bcd95..e6571be 100644
> --- a/common/state/state_variables.c
> +++ b/common/state/state_variables.c
> @@ -116,6 +116,7 @@ static struct state_variable *state_uint8_create(struct state *state,
>  	}
>  
>  	su32->param = param;
> +	su32->var.type = state_find_type_by_name("uint8");

Please pass the struct variable_type * into the ->create callback. It is
known by the caller, so we can easily avoid iterating over the array of
types again.

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

  reply	other threads:[~2017-11-03  8:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02 12:42 [PATCH v2 1/6] ARM: boards: phytec-som-am335x: Add unified MLO Daniel Schultz
2017-11-02 12:42 ` [PATCH v2 2/6] ARM: dts: AM335x: Add state framework Daniel Schultz
2017-11-02 12:42 ` [PATCH v2 3/6] ARM: configs: am335x_defconfig: Add state config Daniel Schultz
2017-11-02 12:42 ` [PATCH v2 4/6] common: state: Add variable_type to state_variable Daniel Schultz
2017-11-03  8:12   ` Sascha Hauer [this message]
2017-11-02 12:42 ` [PATCH v2 5/6] common: state: Add function to read state MAC Daniel Schultz
2017-11-03  8:19   ` Sascha Hauer
2017-11-02 12:42 ` [PATCH v2 6/6] ARM: phytec-som-am335x: Set MAC addresses from state Daniel Schultz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171103081250.iwd7wtb4ywabaxjy@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=d.schultz@phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox