[PATCH 1/4] misc: add bootcount framework
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Mon Sep 23 04:05:40 EDT 2013
On 09:33 Mon 23 Sep , Sascha Hauer wrote:
> On Sat, Sep 21, 2013 at 08:46:04AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > The bootcount is always how many time the system start.
> > To determine since when, this will depend on the driver implementation
> > and your hardware feature.
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> > ---
> > drivers/misc/Kconfig | 2 ++
> > drivers/misc/Makefile | 1 +
> > drivers/misc/bootcount/Kconfig | 12 +++++++++
> > drivers/misc/bootcount/Makefile | 1 +
> > drivers/misc/bootcount/core.c | 54 +++++++++++++++++++++++++++++++++++++++++
> > include/bootcount.h | 31 +++++++++++++++++++++++
> > 6 files changed, 101 insertions(+)
> > create mode 100644 drivers/misc/bootcount/Kconfig
> > create mode 100644 drivers/misc/bootcount/Makefile
> > create mode 100644 drivers/misc/bootcount/core.c
> > create mode 100644 include/bootcount.h
>
> This is getting worse. I don't get it why we need a 'framework' to
> abstract a single variable. With this series we now have three
> layers: a bootcount framework, a midlayer driver and a somfy specific
> driver.
>
> 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
and I do not like to put everything on global
Brest Regards,
J.
>
> 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 |
More information about the barebox
mailing list