linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: cros_ec_codec: Log results when EC commands fail
@ 2020-07-03  3:29 Yu-Hsuan Hsu
  2020-07-03  5:33 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Yu-Hsuan Hsu @ 2020-07-03  3:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Tzung-Bi Shih, Cheng-Yi Chiang, Enric Balletbo i Serra,
	Guenter Roeck, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Benson Leung, alsa-devel, Yu-Hsuan Hsu

Log results of failed EC commands to identify a problem more easily.

Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
---
 sound/soc/codecs/cros_ec_codec.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c
index 8d45c628e988e..a4ab62f59efa6 100644
--- a/sound/soc/codecs/cros_ec_codec.c
+++ b/sound/soc/codecs/cros_ec_codec.c
@@ -90,10 +90,17 @@ static int send_ec_host_command(struct cros_ec_device *ec_dev, uint32_t cmd,
 	if (outsize)
 		memcpy(msg->data, out, outsize);
 
-	ret = cros_ec_cmd_xfer_status(ec_dev, msg);
+	ret = cros_ec_cmd_xfer(ec_dev, msg);
 	if (ret < 0)
 		goto error;
 
+	if (msg->result != EC_RES_SUCCESS) {
+		dev_err(ec_dev->dev, "Command %d failed: %d\n", cmd,
+			msg->result);
+		ret = -EPROTO;
+		goto error;
+	}
+
 	if (insize)
 		memcpy(in, msg->data, insize);
 
-- 
2.27.0.212.ge8ba1cc988-goog


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

* Re: [PATCH] ASoC: cros_ec_codec: Log results when EC commands fail
  2020-07-03  3:29 [PATCH] ASoC: cros_ec_codec: Log results when EC commands fail Yu-Hsuan Hsu
@ 2020-07-03  5:33 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-07-03  5:33 UTC (permalink / raw)
  To: Yu-Hsuan Hsu
  Cc: linux-kernel, Tzung-Bi Shih, Cheng-Yi Chiang,
	Enric Balletbo i Serra, Guenter Roeck, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Benson Leung, alsa-devel

On Thu, Jul 2, 2020 at 8:30 PM Yu-Hsuan Hsu <yuhsuan@chromium.org> wrote:
>
> Log results of failed EC commands to identify a problem more easily.
>
> Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
> ---
>  sound/soc/codecs/cros_ec_codec.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c
> index 8d45c628e988e..a4ab62f59efa6 100644
> --- a/sound/soc/codecs/cros_ec_codec.c
> +++ b/sound/soc/codecs/cros_ec_codec.c
> @@ -90,10 +90,17 @@ static int send_ec_host_command(struct cros_ec_device *ec_dev, uint32_t cmd,
>         if (outsize)
>                 memcpy(msg->data, out, outsize);
>
> -       ret = cros_ec_cmd_xfer_status(ec_dev, msg);
> +       ret = cros_ec_cmd_xfer(ec_dev, msg);

This change isn't explained in the description.

Guenter

>         if (ret < 0)
>                 goto error;
>
> +       if (msg->result != EC_RES_SUCCESS) {
> +               dev_err(ec_dev->dev, "Command %d failed: %d\n", cmd,
> +                       msg->result);
> +               ret = -EPROTO;
> +               goto error;
> +       }
> +
>         if (insize)
>                 memcpy(in, msg->data, insize);
>
> --
> 2.27.0.212.ge8ba1cc988-goog
>

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

end of thread, other threads:[~2020-07-03  5:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-03  3:29 [PATCH] ASoC: cros_ec_codec: Log results when EC commands fail Yu-Hsuan Hsu
2020-07-03  5:33 ` 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).