Linux kernel staging patches
 help / color / mirror / Atom feed
From: Marc Dietrich <marvin24@gmx.de>
To: linux-staging@lists.linux.dev
Cc: linux-tegra@vger.kernel.org, gregkh@linuxfoundation.org,
	thierry.reding@gmail.com, dan.carpenter@linaro.org,
	Marc Dietrich <marvin24@gmx.de>
Subject: [PATCH 1/5] staging: nvec: add ability to ignore EC responses in sync writes
Date: Sat,  6 Apr 2024 14:31:19 +0200	[thread overview]
Message-ID: <20240406123123.37148-2-marvin24@gmx.de> (raw)
In-Reply-To: <20240406123123.37148-1-marvin24@gmx.de>

In case we just want to submit a message to the EC but are not
interested in its response, we can free the response buffer early.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
---
 drivers/staging/nvec/nvec.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 282a664c9176..45df190c2f94 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -300,7 +300,9 @@ int nvec_write_sync(struct nvec_chip *nvec,
 {
 	mutex_lock(&nvec->sync_write_mutex);

-	*msg = NULL;
+	if (msg != NULL)
+		*msg = NULL;
+
 	nvec->sync_write_pending = (data[1] << 8) + data[0];

 	if (nvec_write_async(nvec, data, size) < 0) {
@@ -320,7 +322,10 @@ int nvec_write_sync(struct nvec_chip *nvec,

 	dev_dbg(nvec->dev, "nvec_sync_write: pong!\n");

-	*msg = nvec->last_sync_msg;
+	if (msg != NULL)
+		*msg = nvec->last_sync_msg;
+	else
+		nvec_msg_free(nvec, nvec->last_sync_msg);

 	mutex_unlock(&nvec->sync_write_mutex);

--
2.43.0


  reply	other threads:[~2024-04-06 12:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-06 12:31 [PATCH V2 0/4] staging: nvec: improve robustnes during initialization Marc Dietrich
2024-04-06 12:31 ` Marc Dietrich [this message]
2024-04-06 12:31 ` [PATCH 2/5] staging: nvec: make keyboard init synchronous Marc Dietrich
2024-04-06 12:31 ` [PATCH 3/5] staging: nvec: make touchpad " Marc Dietrich
2024-04-06 12:31 ` [PATCH 4/5] staging: nvec: make i2c controller register writes robust Marc Dietrich
2024-04-11 12:00   ` Greg KH
2024-04-14 15:09     ` [PATCH V2 " Marc Dietrich
2024-04-15  6:07       ` Dan Carpenter
2024-04-06 12:31 ` [PATCH 5/5] staging: nvec: update TODO Marc Dietrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240406123123.37148-2-marvin24@gmx.de \
    --to=marvin24@gmx.de \
    --cc=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).