linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bálint Czobor" <czoborbalint@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	"Daniel Rosenberg" <drosen@google.com>,
	"Bálint Czobor" <czoborbalint@gmail.com>
Subject: [PATCH 3/3] input: Made keyreset more robust
Date: Tue, 27 Oct 2015 09:33:25 +0100	[thread overview]
Message-ID: <1445934805-5690-1-git-send-email-czoborbalint@gmail.com> (raw)

From: Daniel Rosenberg <drosen@google.com>

Switched do_restart to run in a seperate workqueue to  handle
cases where kernel_restart hangs.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Bálint Czobor <czoborbalint@gmail.com>
---
 drivers/input/keyreset.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyreset.c b/drivers/input/keyreset.c
index eaaccde..7fbf724 100644
--- a/drivers/input/keyreset.c
+++ b/drivers/input/keyreset.c
@@ -27,9 +27,10 @@ struct keyreset_state {
	int restart_requested;
	int (*reset_fn)(void);
	struct platform_device *pdev_child;
+	struct work_struct restart_work;
 };

-static void do_restart(void)
+static void do_restart(struct work_struct *unused)
 {
	sys_sync();
	kernel_restart(NULL);
@@ -44,7 +45,7 @@ static void do_reset_fn(void *priv)
		state->restart_requested = state->reset_fn();
	} else {
		pr_info("keyboard reset\n");
-		do_restart();
+		schedule_work(&state->restart_work);
		state->restart_requested = 1;
	}
 }
@@ -69,6 +70,7 @@ static int keyreset_probe(struct platform_device *pdev)
	if (!state->pdev_child)
		return -ENOMEM;
	state->pdev_child->dev.parent = &pdev->dev;
+	INIT_WORK(&state->restart_work, do_restart);

	keyp = pdata->keys_down;
	while ((key = *keyp++)) {
--
1.7.9.5

                 reply	other threads:[~2015-10-27  8:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1445934805-5690-1-git-send-email-czoborbalint@gmail.com \
    --to=czoborbalint@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=drosen@google.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).