From patchwork Tue Oct 27 08:33:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Balint Czobor X-Patchwork-Id: 7494631 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B44A2BEEA4 for ; Tue, 27 Oct 2015 08:33:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 849362086E for ; Tue, 27 Oct 2015 08:33:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A7F6D2086C for ; Tue, 27 Oct 2015 08:33:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752754AbbJ0Idf (ORCPT ); Tue, 27 Oct 2015 04:33:35 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:33550 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752751AbbJ0Ide (ORCPT ); Tue, 27 Oct 2015 04:33:34 -0400 Received: by wijp11 with SMTP id p11so201796527wij.0; Tue, 27 Oct 2015 01:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=RI0fgiyX9+pwkUpJQVmoxkncR1TmmwlyLvmM27xMjxU=; b=measNuuJaT8+22RWUYJwZKIqMSparc0qi8OjbqJogHgoS2r9dgxtw7c7oJ+VnkCOkF enFTx/ikh3XvWr5iXrV4uFkSnPgNg7A9/O8VlOOep46h79Pb/9X05rPRnpnJjZGfwK5T zgVZaFl7FaH/hQz0DasrhuygBq9prsJy9SypkgnkJe73Dn3RfpmEXro0yjhMEnANUc3v 4l2Y3I8xlwwI8FPuxE1cbEGcAKU06ssu2T9fL9dTQ+IEaf2MwgosApomsPX6+Ht31qAj NFX7ANHqrwPiiaD5KwrDmkhnnEep+wLE/UWKvh/q7e0tu+/YYfJkdv8xg5TxRSITjPlf wJAw== X-Received: by 10.194.205.162 with SMTP id lh2mr43641703wjc.61.1445934812783; Tue, 27 Oct 2015 01:33:32 -0700 (PDT) Received: from localhost.localdomain (51B70C10.dsl.pool.telekom.hu. [81.183.12.16]) by smtp.gmail.com with ESMTPSA id ld5sm43502561wjc.18.2015.10.27.01.33.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2015 01:33:31 -0700 (PDT) From: =?UTF-8?q?B=C3=A1lint=20Czobor?= To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Daniel Rosenberg , =?UTF-8?q?B=C3=A1lint=20Czobor?= Subject: [PATCH 3/3] input: Made keyreset more robust Date: Tue, 27 Oct 2015 09:33:25 +0100 Message-Id: <1445934805-5690-1-git-send-email-czoborbalint@gmail.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Rosenberg Switched do_restart to run in a seperate workqueue to handle cases where kernel_restart hangs. Signed-off-by: Daniel Rosenberg Signed-off-by: Bálint Czobor --- drivers/input/keyreset.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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++)) {