Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2400840lqp; Sun, 24 Mar 2024 17:56:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUIJqvsNceQ+lvLxnFjLHTqxOJIwxsZ5vUCOSrdGtSxaIH5yVyZio2bmE8ZH+kWVk4AMUtapOkdi3yzgIbpYv3MAfM/XSlRLHB02QVj7w== X-Google-Smtp-Source: AGHT+IEndWyCrwV4QtFScGiAur95UEZgILr5JvM+uy7NtZd0CDWbVubui4FV7luoltyev95/5rVr X-Received: by 2002:a67:ce86:0:b0:472:eca1:46c with SMTP id c6-20020a67ce86000000b00472eca1046cmr2328296vse.30.1711328185582; Sun, 24 Mar 2024 17:56:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711328185; cv=pass; d=google.com; s=arc-20160816; b=rv7yIiKQVf1VW8rPAhICGw43A+tFltMRSbAzVJzVzuEz994fB+f3HcRsist6Vn2P/t 7Xkv0/Ks7sV6YLruk5QDFkfVxA7rXwb1D/LugEfbMxpx3HQLWpb9XXh94gK5GOjEz1lc KMiBkb1mjYDaSu5qVBFJ8ykWfOsYW0d4KBerxEb3jmfU/eiKVvssggGUfa8SGy1PoQz6 oy/9Wl5OCXO7/afN9+g2ZVH3trVeWUcB47OBF/1SwTYpSc0vGxmrU2UwOkexMTfEpP+3 ZKPjfexqJbGhBfEj5tke15KeX9yWjw//zckuox4fiKMflEsSt8mvNsEWbK26P1A0GrzR f1pQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ZbsoenYV3vfvREQD/zSh3S+SB3i11OHf/xtOR9JltYw=; fh=eUHZ4eNukG9n0kWymJpOuaUcZ4MCQlb/ohIeDvid0So=; b=kqrNkmebjPf5yJ+QIDbHxfcpJWwksFHPR/jyLjGyAH/H4Qd5G+tmgvkMOyygyWmIbH zHWmuvO0qPZ2l/h165o8Y7lLaawfbNo/KpFwwELzQebsk97vebCRqtIUN67slR4yOlwt 2H2A5x0ABv86FtTZmpKXvlXqTb1sPDEFsdEsq02ksu4TqSUY9LuEUZ+3X+MA6G6f0TU5 yvdJwRgY1F2fSnnaTSX1J5YEB7Tr1uWXsJLmcfYaJ6ExbNGf/B0uK+jfYMxFOzW5+2Kg OIa2aU50gpcbxLGtNZy1Pix6k5lxmdf93OO3zeWVX37q4SJC1KDXrB1ChKzsoLh75a+i i3Fg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=l61SKecK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f26-20020a05620a15ba00b00787b85281e7si4354203qkk.714.2024.03.24.17.56.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:56:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=l61SKecK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 508E91C243E3 for ; Mon, 25 Mar 2024 00:56:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27D137352C; Sun, 24 Mar 2024 22:45:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="l61SKecK" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29AB513DDC0; Sun, 24 Mar 2024 22:45:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320325; cv=none; b=INAUmq97LBYpnS84HN4EnmGEWRz6M3nmfOUXrfREU+8Apls1JevQHpL6hxIsyxBlldhla4quo/sdDM2p/MEO1vQVQj8CM/c8ZmvGz3snQxZF74wxa271zNzzCAcFgUJ3DysBYhg2j+/oGBhwqRrQaBTdfe9YChAcNqLKv+V5zAc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320325; c=relaxed/simple; bh=ArYKYqU7frp1Dl3+qp4fleofAfeQEKMgQdDiu9ogk3w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EHBh9rv3RazB3Dt6npL3qUZ9zGgCiUUc9u4zmlTgTjN2LCRsLvdnFIFIwHJLY3pFeblOXU3ywwCKLuGhIxnXiBI7/DVy4JmhZLPYZlfpSmrsxiQm3OmxBXjqsHnfB+gPZm4UMDrpogg4MaqlENI0v8yp42l1vS/cpAaJGBSZjxg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l61SKecK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48ACDC43390; Sun, 24 Mar 2024 22:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320325; bh=ArYKYqU7frp1Dl3+qp4fleofAfeQEKMgQdDiu9ogk3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l61SKecKlk8xQXzmBT/Wx0Sm/ntin+nbic2k1nIvHMG4R6+aeg18lTdcn0JBq+azP 3CyFdsGmpS6deF9dtaciqJN5OpZywQ5x/7OkN+c4BO/CISu4yUN+/yHda7TlzAWNHJ mj0xZcpgf8S6AyXxiBKoWFBUCOPYLd+9pxx4aHksN90flqTxZSMRB39NukrpaooUNV zrVNGtlXEdNbZbIAFAxYtDbch2sRdiUMW1en7VwREbvRGZJKQzoexbDWmxSlcD4XXJ MCE28FSGYuxG7S4FS9Lz1LkSGTZY27gM93T5x1uya5q1l8PV35HQ0Oj8vxo9Tjq/Dh caVLZDGDgKnfA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sakari Ailus , Wentong Wu , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 6.8 632/715] mei: vsc: Don't use sleeping condition in wait_event_timeout() Date: Sun, 24 Mar 2024 18:33:31 -0400 Message-ID: <20240324223455.1342824-633-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Sakari Ailus [ Upstream commit b8b19acfafdeacbedd4e2795cb18c81c4d8bb6cc ] vsc_tp_wakeup_request() called wait_event_timeout() with gpiod_get_value_cansleep() which may sleep, and does so as the implementation is that of gpio-ljca. Move the GPIO state check outside the call. Fixes: 566f5ca97680 ("mei: Add transport driver for IVSC device") Signed-off-by: Sakari Ailus Tested-and-Reviewed-by: Wentong Wu Link: https://lore.kernel.org/r/20240219195807.517742-3-sakari.ailus@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/misc/mei/vsc-tp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/misc/mei/vsc-tp.c b/drivers/misc/mei/vsc-tp.c index 0e623700c3b0e..682c62c635b63 100644 --- a/drivers/misc/mei/vsc-tp.c +++ b/drivers/misc/mei/vsc-tp.c @@ -25,7 +25,8 @@ #define VSC_TP_ROM_BOOTUP_DELAY_MS 10 #define VSC_TP_ROM_XFER_POLL_TIMEOUT_US (500 * USEC_PER_MSEC) #define VSC_TP_ROM_XFER_POLL_DELAY_US (20 * USEC_PER_MSEC) -#define VSC_TP_WAIT_FW_ASSERTED_TIMEOUT (2 * HZ) +#define VSC_TP_WAIT_FW_POLL_TIMEOUT (2 * HZ) +#define VSC_TP_WAIT_FW_POLL_DELAY_US (20 * USEC_PER_MSEC) #define VSC_TP_MAX_XFER_COUNT 5 #define VSC_TP_PACKET_SYNC 0x31 @@ -101,13 +102,15 @@ static int vsc_tp_wakeup_request(struct vsc_tp *tp) gpiod_set_value_cansleep(tp->wakeupfw, 0); ret = wait_event_timeout(tp->xfer_wait, - atomic_read(&tp->assert_cnt) && - gpiod_get_value_cansleep(tp->wakeuphost), - VSC_TP_WAIT_FW_ASSERTED_TIMEOUT); + atomic_read(&tp->assert_cnt), + VSC_TP_WAIT_FW_POLL_TIMEOUT); if (!ret) return -ETIMEDOUT; - return 0; + return read_poll_timeout(gpiod_get_value_cansleep, ret, ret, + VSC_TP_WAIT_FW_POLL_DELAY_US, + VSC_TP_WAIT_FW_POLL_TIMEOUT, false, + tp->wakeuphost); } static void vsc_tp_wakeup_release(struct vsc_tp *tp) -- 2.43.0