The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: adi25charis@gmail.com
To: vireshk@kernel.org, johan@kernel.org, elder@kernel.org,
	gregkh@linuxfoundation.org
Cc: greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Aditya Chari S <adi25charis@gmail.com>
Subject: [PATCH] staging: greybus: bootrom: power off module on timeout
Date: Sat,  4 Jul 2026 12:49:26 +0530	[thread overview]
Message-ID: <20260704071926.6606-1-adi25charis@gmail.com> (raw)

From: Aditya Chari S <adi25charis@gmail.com>

Previously, when a firmware size request, get firmware request, or
ready-to-boot request from a module timed out, the driver would log
an error and free any firmware buffer, but left the module powered
on in a potentially inconsistent state.

Fix this by ejecting the module's interface via the SVC when a
timeout occurs, forcing it to be power-cycled and re-detected rather
than left in limbo.

Signed-off-by: Aditya Chari S <adi25charis@gmail.com>
---
 drivers/staging/greybus/bootrom.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c
index 83921d90c..b564d2255 100644
--- a/drivers/staging/greybus/bootrom.c
+++ b/drivers/staging/greybus/bootrom.c
@@ -54,8 +54,12 @@ static void gb_bootrom_timedout(struct work_struct *work)
 	struct delayed_work *dwork = to_delayed_work(work);
 	struct gb_bootrom *bootrom = container_of(dwork,
 						  struct gb_bootrom, dwork);
-	struct device *dev = &bootrom->connection->bundle->dev;
+	struct gb_connection *connection = bootrom->connection;
+	struct device *dev = &connection->bundle->dev;
+	struct gb_interface *intf = connection->bundle->intf;
+	struct gb_svc *svc = connection->hd->svc;
 	const char *reason;
+	int ret;
 
 	switch (bootrom->next_request) {
 	case NEXT_REQ_FIRMWARE_SIZE:
@@ -82,7 +86,11 @@ static void gb_bootrom_timedout(struct work_struct *work)
 	free_firmware(bootrom);
 	mutex_unlock(&bootrom->mutex);
 
-	/* TODO: Power-off Module ? */
+	/* Power-off Module */
+	ret = gb_svc_intf_eject(svc, intf->interface_id);
+	if (ret)
+		dev_err(dev, "failed to eject interface %u (%d)\n",
+			intf->interface_id, ret);
 }
 
 static void gb_bootrom_set_timeout(struct gb_bootrom *bootrom,
-- 
2.53.0


             reply	other threads:[~2026-07-04  7:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04  7:19 adi25charis [this message]
2026-07-04  7:34 ` [PATCH] staging: greybus: bootrom: power off module on timeout Greg KH
2026-07-04 11:53   ` adi25charis
2026-07-04 14:12 ` kernel test robot

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=20260704071926.6606-1-adi25charis@gmail.com \
    --to=adi25charis@gmail.com \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=vireshk@kernel.org \
    /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