Message ID | 20210301204603.2730666-3-sean.anderson@seco.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | sysinfo: Add gpio sysinfo driver | expand |
Hi Sean, On Mon, 1 Mar 2021 at 15:46, Sean Anderson <sean.anderson@seco.com> wrote: > > This adds an ID for a board revision. Existing IDs have been moved above > SYSINFO_ID_END to allow for future expansion. > > Signed-off-by: Sean Anderson <sean.anderson@seco.com> > --- > > drivers/sysinfo/gazerbeam.h | 10 +++++----- > drivers/sysinfo/sandbox.h | 10 ++++------ > include/sysinfo.h | 13 +++++++++++++ > 3 files changed, 22 insertions(+), 11 deletions(-) Can we keep the enums? They are easier to maintain that #define and the debugger understands them. Regards, Simon
On 3/4/21 11:08 PM, Simon Glass wrote: > Hi Sean, > > On Mon, 1 Mar 2021 at 15:46, Sean Anderson <sean.anderson@seco.com> wrote: >> >> This adds an ID for a board revision. Existing IDs have been moved above >> SYSINFO_ID_END to allow for future expansion. >> >> Signed-off-by: Sean Anderson <sean.anderson@seco.com> >> --- >> >> drivers/sysinfo/gazerbeam.h | 10 +++++----- >> drivers/sysinfo/sandbox.h | 10 ++++------ >> include/sysinfo.h | 13 +++++++++++++ >> 3 files changed, 22 insertions(+), 11 deletions(-) > > Can we keep the enums? They are easier to maintain that #define and > the debugger understands them. Yes, I will change that for v2. --Sean > > Regards, > Simon >
diff --git a/drivers/sysinfo/gazerbeam.h b/drivers/sysinfo/gazerbeam.h index 171729d203..d8e3c48955 100644 --- a/drivers/sysinfo/gazerbeam.h +++ b/drivers/sysinfo/gazerbeam.h @@ -5,11 +5,11 @@ * */ -enum { - BOARD_MULTICHANNEL, - BOARD_VARIANT, - BOARD_HWVERSION, -}; +#include <sysinfo.h> + +#define BOARD_MULTICHANNEL (SYSINFO_ID_END + 1) +#define BOARD_VARIANT (SYSINFO_ID_END + 2) +#define BOARD_HWVERSION (SYSINFO_ID_END + 3) enum { VAR_CON, diff --git a/drivers/sysinfo/sandbox.h b/drivers/sysinfo/sandbox.h index 2cff494f56..dc7c15e738 100644 --- a/drivers/sysinfo/sandbox.h +++ b/drivers/sysinfo/sandbox.h @@ -4,9 +4,7 @@ * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc */ -enum { - BOOL_CALLED_DETECT, - INT_TEST1, - INT_TEST2, - STR_VACATIONSPOT, -}; +#define BOOL_CALLED_DETECT (SYSINFO_ID_END + 1) +#define INT_TEST1 (SYSINFO_ID_END + 2) +#define INT_TEST2 (SYSINFO_ID_END + 3) +#define STR_VACATIONSPOT (SYSINFO_ID_END + 4) diff --git a/include/sysinfo.h b/include/sysinfo.h index c045d316b0..9386bdf49a 100644 --- a/include/sysinfo.h +++ b/include/sysinfo.h @@ -32,6 +32,19 @@ */ #if CONFIG_IS_ENABLED(SYSINFO) +/** + * enum sysinfo_id - IDs which may be passed to sysinfo accessors + */ +enum sysinfo_id { + /** @SYSINFO_ID_REVISION: Use this ID to access the board revision. */ + SYSINFO_ID_REVISION, + /** + * @SYSINFO_ID_END: The last global sysinfo id. If you need to return + * custom information, use SYSINFO_ID_END+1 as the base offset. + */ + SYSINFO_ID_END = 127, +}; + struct sysinfo_ops { /** * detect() - Run the hardware info detection procedure for this
This adds an ID for a board revision. Existing IDs have been moved above SYSINFO_ID_END to allow for future expansion. Signed-off-by: Sean Anderson <sean.anderson@seco.com> --- drivers/sysinfo/gazerbeam.h | 10 +++++----- drivers/sysinfo/sandbox.h | 10 ++++------ include/sysinfo.h | 13 +++++++++++++ 3 files changed, 22 insertions(+), 11 deletions(-)