From 2b1dc29a12e7a5256577c30a2389a6807d6d2bb6 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 1 Oct 2018 11:55:11 -0600 Subject: sandbox: Add a flag to set the default log level It is useful to be able to set the default log level from the command line when running sandbox. Add a new -L command-line flag for this. The log level is set using the enum log_level_t in log.h. At present a number must be specified, e.g. -L7 for debug. Signed-off-by: Simon Glass --- common/log.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/log.c b/common/log.c index 59869cd29da..ec14644516c 100644 --- a/common/log.c +++ b/common/log.c @@ -315,7 +315,8 @@ int log_init(void) drv++; } gd->flags |= GD_FLG_LOG_READY; - gd->default_log_level = LOGL_INFO; + if (!gd->default_log_level) + gd->default_log_level = LOGL_INFO; gd->log_fmt = LOGF_DEFAULT; return 0; -- cgit v1.3.1 From 42116f644b33d4c9e7b495ec87612aa922452453 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 1 Oct 2018 12:22:23 -0600 Subject: cros: Adjust board_get_cros_ec_dev() to return a udevice Rather than returning what is effectively an internal data structure, return the cros EC device itself. Signed-off-by: Simon Glass --- common/cros_ec.c | 4 ++-- include/cros_ec.h | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/cros_ec.c b/common/cros_ec.c index 1a0caf80dde..4ca15e19d5f 100644 --- a/common/cros_ec.c +++ b/common/cros_ec.c @@ -13,7 +13,7 @@ #include #include -struct cros_ec_dev *board_get_cros_ec_dev(void) +struct udevice *board_get_cros_ec_dev(void) { struct udevice *dev; int ret; @@ -23,7 +23,7 @@ struct cros_ec_dev *board_get_cros_ec_dev(void) debug("%s: Error %d\n", __func__, ret); return NULL; } - return dev_get_uclass_priv(dev); + return dev; } int cros_ec_get_error(void) diff --git a/include/cros_ec.h b/include/cros_ec.h index afd99aae946..5576bcf32ee 100644 --- a/include/cros_ec.h +++ b/include/cros_ec.h @@ -208,11 +208,9 @@ int cros_ec_flash_update_rw(struct udevice *dev, const uint8_t *image, /** * Return a pointer to the board's CROS-EC device * - * This should be implemented by board files. - * * @return pointer to CROS-EC device, or NULL if none is available */ -struct cros_ec_dev *board_get_cros_ec_dev(void); +struct udevice *board_get_cros_ec_dev(void); struct dm_cros_ec_ops { int (*check_version)(struct udevice *dev); -- cgit v1.3.1