linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/chrome: cros_ec_debugfs: Remove dev_warn when console log is not supported
@ 2019-04-03 13:47 Enric Balletbo i Serra
  2019-04-03 16:23 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Enric Balletbo i Serra @ 2019-04-03 13:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: groeck, bleung, gwendal, kernel, dtor

If the debugfs interface is enabled, every time a CrOS device is
instantiated a warning like this can appear for every probed device.

 "device does not support reading the console log"

The warning message adds nothing, rather it is source of confusion as
this is expected on some cases. For example, on Samus, that has a
cros-ec and a cros-pd instance the message appears twice, and I suspect
this will happen also on those devices that has a non-standard EC.

If the command is not supported just return silently and don't print the
warning, otherwise the code will already print an error.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 drivers/platform/chrome/cros_ec_debugfs.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c
index 71308766e891..f0de1991b688 100644
--- a/drivers/platform/chrome/cros_ec_debugfs.c
+++ b/drivers/platform/chrome/cros_ec_debugfs.c
@@ -306,11 +306,12 @@ static int cros_ec_create_console_log(struct cros_ec_debugfs *debug_info)
 	int read_params_size;
 	int read_response_size;
 
-	if (!ec_read_version_supported(ec)) {
-		dev_warn(ec->dev,
-			"device does not support reading the console log\n");
+	/*
+	 * If the console log feature is not supported return silently and
+	 * don't create the console_log entry.
+	 */
+	if (!ec_read_version_supported(ec))
 		return 0;
-	}
 
 	buf = devm_kzalloc(ec->dev, LOG_SIZE, GFP_KERNEL);
 	if (!buf)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/chrome: cros_ec_debugfs: Remove dev_warn when console log is not supported
  2019-04-03 13:47 [PATCH] platform/chrome: cros_ec_debugfs: Remove dev_warn when console log is not supported Enric Balletbo i Serra
@ 2019-04-03 16:23 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2019-04-03 16:23 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: linux-kernel, Guenter Roeck, Benson Leung, Gwendal Grignou,
	kernel, Dmitry Torokhov

On Wed, Apr 3, 2019 at 6:47 AM Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:
>
> If the debugfs interface is enabled, every time a CrOS device is
> instantiated a warning like this can appear for every probed device.
>
>  "device does not support reading the console log"
>
> The warning message adds nothing, rather it is source of confusion as
> this is expected on some cases. For example, on Samus, that has a
> cros-ec and a cros-pd instance the message appears twice, and I suspect
> this will happen also on those devices that has a non-standard EC.
>
> If the command is not supported just return silently and don't print the
> warning, otherwise the code will already print an error.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

Reviewed-by: Guenter Roeck <groeck@chromium.org>

> ---
>
>  drivers/platform/chrome/cros_ec_debugfs.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c
> index 71308766e891..f0de1991b688 100644
> --- a/drivers/platform/chrome/cros_ec_debugfs.c
> +++ b/drivers/platform/chrome/cros_ec_debugfs.c
> @@ -306,11 +306,12 @@ static int cros_ec_create_console_log(struct cros_ec_debugfs *debug_info)
>         int read_params_size;
>         int read_response_size;
>
> -       if (!ec_read_version_supported(ec)) {
> -               dev_warn(ec->dev,
> -                       "device does not support reading the console log\n");
> +       /*
> +        * If the console log feature is not supported return silently and
> +        * don't create the console_log entry.
> +        */
> +       if (!ec_read_version_supported(ec))
>                 return 0;
> -       }
>
>         buf = devm_kzalloc(ec->dev, LOG_SIZE, GFP_KERNEL);
>         if (!buf)
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-03 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 13:47 [PATCH] platform/chrome: cros_ec_debugfs: Remove dev_warn when console log is not supported Enric Balletbo i Serra
2019-04-03 16:23 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).