Message ID | 20231009121018.1075318-1-m.szyprowski@samsung.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp1822363vqo; Mon, 9 Oct 2023 05:12:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHWsKBlEz45OCEhWClTXw6gu6V/oDWdmXVGK5y7M/jq0nwYTGIDuf8skC/gu/l1SRyzRBFd X-Received: by 2002:a17:902:da83:b0:1c6:e1d:8be0 with SMTP id j3-20020a170902da8300b001c60e1d8be0mr20860969plx.2.1696853541326; Mon, 09 Oct 2023 05:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696853541; cv=none; d=google.com; s=arc-20160816; b=UnlB37LbljYMdumWhbFachk3eanbhuMW29qaS77eqsgcKDcijjXSYX8VBE7Y6mrD13 BcFw+btxb8KQUsYUf6D0a7VvH6b6aP5qI8irRBrwubUUjeO3PQelVIP10UrgN0Bcfv70 gb/fBq01J3ypz5/gzpU5Tl74gLuEXtfVXQ91qFRLbymNaVxRZraseR5sMo8c6i7fusKf GrpdTPyhGz0A4i68CP0m31kQIOjjfn5G0cUU1TG7H2e39jOzRVW+bg4JL3YIB9/nYuEJ OILorOQf/pPzBD6u16QArC0lW77R2ZvHlngzphsJAPT/ikMo5xBYXIPjtkNAMDnnIg9S UPKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=+oeF9tduJROpDtEILgnH87XCwSDj3+xudliDOb9i4c0=; fh=r3VxWbLpZh0wYtcLE0WcmbqT/6bDxl/b+3e65MyRQOM=; b=Us415GHz5Edgy0mfuWEFu+G8n22NGeshaAh7sgHffsa8pUa7DfQkeOWOx3mFlSp2gk Y0hDrVOVhmse+o4iEmVsBcD2tGgQZIrnk+b3a7y9uBfcotUc6IicYFlfhR8HL35or0m5 k1X3QcOiYSaqMcls7jq3RZlhJKIUzz/WlG3XsPgtqh2b7wwJhIpuddtcPMsUlH245TVS PspFm2r+OcVfmseBpb6aDzQD0fNCppHFPMMq5udv4HKxa2yEY3PaDT5EmTZMr0tg8B6J GdfL8GI0T3JyBYODbh0eo5TJG81ERbrIqH5WSmywhYFmpK3EZcFYu30ES4Sw9GworXfX T6YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=JpYvnAD4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id ky16-20020a170902f99000b001c3fa95ca03si2862956plb.9.2023.10.09.05.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 05:12:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=JpYvnAD4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 2208E8076142; Mon, 9 Oct 2023 05:10:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346443AbjJIMKe (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Mon, 9 Oct 2023 08:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346308AbjJIMKc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 9 Oct 2023 08:10:32 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5485C99 for <linux-kernel@vger.kernel.org>; Mon, 9 Oct 2023 05:10:30 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231009121026euoutp0171e879a36b519814c2c04d5766e5a9c0~MbzOTEjIM3187731877euoutp01K for <linux-kernel@vger.kernel.org>; Mon, 9 Oct 2023 12:10:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231009121026euoutp0171e879a36b519814c2c04d5766e5a9c0~MbzOTEjIM3187731877euoutp01K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696853426; bh=+oeF9tduJROpDtEILgnH87XCwSDj3+xudliDOb9i4c0=; h=From:To:Cc:Subject:Date:References:From; b=JpYvnAD49jvrdbgZD5e7a6H8MuDp/a0YCS84UmjwewbqYI8jIGJuBo3sG0w5T7Wcf 8M2cFksRLgj2usgPEy48M46SKMj+BTcBSogjDv1+5QKgMMbJTNX4otaNxvXQXgHsWh I/jP84wFGbE1ypNi8tMEs03fq26ha4jOGZWjpwWM= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231009121026eucas1p1adad209218fa1a3c4958ca50071ebcad~MbzOFgJgu0583105831eucas1p1W; Mon, 9 Oct 2023 12:10:26 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id BC.2B.11320.2BDE3256; Mon, 9 Oct 2023 13:10:26 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231009121026eucas1p19ed2a6a88fa6b899ef9b915a73ad87b5~MbzNqHT6W1046310463eucas1p1H; Mon, 9 Oct 2023 12:10:26 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231009121026eusmtrp2daf61cd3394bda244624e4b47fc2aa5f~MbzNpQuTW0414604146eusmtrp2e; Mon, 9 Oct 2023 12:10:26 +0000 (GMT) X-AuditID: cbfec7f4-993ff70000022c38-1f-6523edb292fb Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 33.91.10549.2BDE3256; Mon, 9 Oct 2023 13:10:26 +0100 (BST) Received: from AMDC4653.digital.local (unknown [106.120.51.32]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20231009121025eusmtip124de06fbf785870495bda711da01db0c~MbzNS2WFR1780317803eusmtip1P; Mon, 9 Oct 2023 12:10:25 +0000 (GMT) From: Marek Szyprowski <m.szyprowski@samsung.com> To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski <m.szyprowski@samsung.com>, Dmitry Torokhov <dmitry.torokhov@gmail.com>, Andrzej Pietrasiewicz <andrzej.p@collabora.com> Subject: [PATCH] Input: cyapa - add missing input core locking to suspend/resume functions Date: Mon, 9 Oct 2023 14:10:18 +0200 Message-Id: <20231009121018.1075318-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42LZduzned1Nb5VTDeb9VbFY9vgei8XhRS8Y LW5++sZqcXnXHDaLtUfusjuweuy4u4TRY+esu+wefVtWMXp83iQXwB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xdwmjx85Zd9k9+rasYvT4vEkugCVKz6Yov7QkVSEjv7jE Vina0MJIz9DSQs/IxFLP0Ng81srIVEnfziYlNSezLLVI3y5BL+Pd+X7Ggu+KFes62tkaGLtk uxg5OSQETCRmt9xj7mLk4hASWMoocezJRHaIhIzEyWkNrBC2sMSfa11sEEWfGCX2n9rFCJJg EzCU6HoLkuDkEBGwlzj8Zg0LSBGzwERGiVX3m5lBEsICURKTJlwEs1kEVCUeLnrJBGLzAjWc vv+JBWKDvMT+g2eZIeKCEidnPgGLMwPFm7fOZp7AyDcLSWoWktQCRqZVjCKppcW56bnFhnrF ibnFpXnpesn5uZsYgYG87djPzTsY5736qHeIkYmD8RCjBAezkgivbqlCqhBvSmJlVWpRfnxR aU5q8SFGU6D7JjJLiSbnA2MpryTe0MzA1NDEzNLA1NLMWEmc17OgI1FIID2xJDU7NbUgtQim j4mDU6qByWNp9b+98zYdtPbOPN0UxPIz0iNj8waO117qb1O76gNZzt2fmN+neal12zUhz+LQ jUKKK/czuL+d05ggFSd8vrL3cmXo9+yqxlARMT6uOc0T2d64vziu2tu9/YhBxm7Th6I7+Y4o m7UZLvTemnJ2aU9nbmOE0Icq7t7/r1MWhKYreLSIcPIemlrwne3rTFb7sODX2m92h9kFnjtk rFK64/1CjjkzdOfcOd7V09JYcuawz6eDyY/Uky8z/uv/UCsn/eZNbs/chZ+8RI80ORT5fu3I lil02eD62FX58b9zDftiS668kOSYNKO9jO3l7SuxW44/umd+vz3ZWaXvtvGpFt6zFW9Vr6WK rHt1a+UnJZbijERDLeai4kQAxLaD4u0CAAA= X-CMS-MailID: 20231009121026eucas1p19ed2a6a88fa6b899ef9b915a73ad87b5 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20231009121026eucas1p19ed2a6a88fa6b899ef9b915a73ad87b5 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231009121026eucas1p19ed2a6a88fa6b899ef9b915a73ad87b5 References: <CGME20231009121026eucas1p19ed2a6a88fa6b899ef9b915a73ad87b5@eucas1p1.samsung.com> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 09 Oct 2023 05:10:48 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779279898722279791 X-GMAIL-MSGID: 1779279898722279791 |
Series |
Input: cyapa - add missing input core locking to suspend/resume functions
|
|
Commit Message
Marek Szyprowski
Oct. 9, 2023, 12:10 p.m. UTC
Grab input->mutex during suspend/resume functions like it is done in
other input drivers. This fixes the following warning during system
suspend/resume cycle on Samsung Exynos5250-based Snow Chromebook:
------------[ cut here ]------------
WARNING: CPU: 1 PID: 1680 at drivers/input/input.c:2291 input_device_enabled+0x68/0x6c
Modules linked in: ...
CPU: 1 PID: 1680 Comm: kworker/u4:12 Tainted: G W 6.6.0-rc5-next-20231009 #14109
Hardware name: Samsung Exynos (Flattened Device Tree)
Workqueue: events_unbound async_run_entry_fn
unwind_backtrace from show_stack+0x10/0x14
show_stack from dump_stack_lvl+0x58/0x70
dump_stack_lvl from __warn+0x1a8/0x1cc
__warn from warn_slowpath_fmt+0x18c/0x1b4
warn_slowpath_fmt from input_device_enabled+0x68/0x6c
input_device_enabled from cyapa_gen3_set_power_mode+0x13c/0x1dc
cyapa_gen3_set_power_mode from cyapa_reinitialize+0x10c/0x15c
cyapa_reinitialize from cyapa_resume+0x48/0x98
cyapa_resume from dpm_run_callback+0x90/0x298
dpm_run_callback from device_resume+0xb4/0x258
device_resume from async_resume+0x20/0x64
async_resume from async_run_entry_fn+0x40/0x15c
async_run_entry_fn from process_scheduled_works+0xbc/0x6a8
process_scheduled_works from worker_thread+0x188/0x454
worker_thread from kthread+0x108/0x140
kthread from ret_from_fork+0x14/0x28
Exception stack(0xf1625fb0 to 0xf1625ff8)
...
---[ end trace 0000000000000000 ]---
...
------------[ cut here ]------------
WARNING: CPU: 1 PID: 1680 at drivers/input/input.c:2291 input_device_enabled+0x68/0x6c
Modules linked in: ...
CPU: 1 PID: 1680 Comm: kworker/u4:12 Tainted: G W 6.6.0-rc5-next-20231009 #14109
Hardware name: Samsung Exynos (Flattened Device Tree)
Workqueue: events_unbound async_run_entry_fn
unwind_backtrace from show_stack+0x10/0x14
show_stack from dump_stack_lvl+0x58/0x70
dump_stack_lvl from __warn+0x1a8/0x1cc
__warn from warn_slowpath_fmt+0x18c/0x1b4
warn_slowpath_fmt from input_device_enabled+0x68/0x6c
input_device_enabled from cyapa_gen3_set_power_mode+0x13c/0x1dc
cyapa_gen3_set_power_mode from cyapa_reinitialize+0x10c/0x15c
cyapa_reinitialize from cyapa_resume+0x48/0x98
cyapa_resume from dpm_run_callback+0x90/0x298
dpm_run_callback from device_resume+0xb4/0x258
device_resume from async_resume+0x20/0x64
async_resume from async_run_entry_fn+0x40/0x15c
async_run_entry_fn from process_scheduled_works+0xbc/0x6a8
process_scheduled_works from worker_thread+0x188/0x454
worker_thread from kthread+0x108/0x140
kthread from ret_from_fork+0x14/0x28
Exception stack(0xf1625fb0 to 0xf1625ff8)
...
---[ end trace 0000000000000000 ]---
Fixes: d69f0a43c677 ("Input: use input_device_enabled()")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
drivers/input/mouse/cyapa.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index a84098448f5b..cf23f95b5f11 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -1347,10 +1347,16 @@ static int cyapa_suspend(struct device *dev) u8 power_mode; int error; - error = mutex_lock_interruptible(&cyapa->state_sync_lock); + error = mutex_lock_interruptible(&cyapa->input->mutex); if (error) return error; + error = mutex_lock_interruptible(&cyapa->state_sync_lock); + if (error) { + mutex_unlock(&cyapa->input->mutex); + return error; + } + /* * Runtime PM is enable only when device is in operational mode and * users in use, so need check it before disable it to @@ -1385,6 +1391,8 @@ static int cyapa_suspend(struct device *dev) cyapa->irq_wake = (enable_irq_wake(client->irq) == 0); mutex_unlock(&cyapa->state_sync_lock); + mutex_unlock(&cyapa->input->mutex); + return 0; } @@ -1394,6 +1402,7 @@ static int cyapa_resume(struct device *dev) struct cyapa *cyapa = i2c_get_clientdata(client); int error; + mutex_lock(&cyapa->input->mutex); mutex_lock(&cyapa->state_sync_lock); if (device_may_wakeup(dev) && cyapa->irq_wake) { @@ -1412,6 +1421,7 @@ static int cyapa_resume(struct device *dev) enable_irq(client->irq); mutex_unlock(&cyapa->state_sync_lock); + mutex_unlock(&cyapa->input->mutex); return 0; }