mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/4] misc: add bootcount framework
Date: Mon, 23 Sep 2013 10:52:02 +0200	[thread overview]
Message-ID: <20130923085202.GU30088@pengutronix.de> (raw)
In-Reply-To: <20130923080540.GD31585@ns203013.ovh.net>

On Mon, Sep 23, 2013 at 10:05:40AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:33 Mon 23 Sep     , Sascha Hauer wrote:
> > On Sat, Sep 21, 2013 at 08:46:04AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Can we please just do something like:
> > 
> > common/bootcount.c:
> > 
> > static int bootcount;
> > 
> > /*
> >  * Call this with your actual boot count, already increased by one
> >  * for the current boot.
> >  */
> > int bootcount_set(int count)
> > {
> > 	if (bootcount) {
> > 		pr_err("Bootcount already set\n");
> > 		return -EINVAL;
> > 	}
> > 
> > 	bootcount = count;
> > 
> > 	return 0;
> > }
> > 
> > static int bootcount_init(void)
> > {
> > 	globalvar_add_simple_int_ro("bootcount", &bootcount, "%d");
> > 
> > 	return 0;
> > }
> > late_initcall(bootcount_init);
> 
> no as the bootcount is way more complex for somfy
> 
> we store the boot count in one register with the boot mode
> 
> and the boot count can we reset by the shell
> 
> so it's not a RO

Make it rw then.

Put whatever complexity you need into your somfy code, but all that's
user visible is a single variable (visible to both C code and
userspace). We don't need a framework for this.

> 
> and I do not like to put everything on global

And I do not like creating devices which serve only as a namespace
provider for variables.

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:[~2013-09-23  8:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-21  6:45 [PATCH 0/4 v2] introduce bootcount support Jean-Christophe PLAGNIOL-VILLARD
2013-09-21  6:46 ` [PATCH 1/4] misc: add bootcount framework Jean-Christophe PLAGNIOL-VILLARD
2013-09-21  6:46   ` [PATCH 2/4] bootcount: add simple register support Jean-Christophe PLAGNIOL-VILLARD
2013-09-21  6:46   ` [PATCH 3/4] bootcount: add somfy bootcount support Jean-Christophe PLAGNIOL-VILLARD
2013-09-21  6:46   ` [PATCH 4/4] animeo_ip: add " Jean-Christophe PLAGNIOL-VILLARD
2013-09-23  7:33   ` [PATCH 1/4] misc: add bootcount framework Sascha Hauer
2013-09-23  8:05     ` Jean-Christophe PLAGNIOL-VILLARD
2013-09-23  8:52       ` Sascha Hauer [this message]

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=20130923085202.GU30088@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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