Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1340255rdb; Mon, 19 Feb 2024 11:59:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVg7tTLX4roFhicr7XzdS6rc4R7DhNEYwhK/PyxW0VEkPLEjw4XVA/UnjtRWXHkTD8oz0jOnelPNI0CxgPGUYL0GfWQdYGXXrurp6Gh6Q== X-Google-Smtp-Source: AGHT+IGXr7ykR9SaADQGYBZ0TklElfUaFFvI2k/SI1yfoR/492D09aesYn7stkvqjNlZtSbMlSrx X-Received: by 2002:aa7:ccc8:0:b0:564:ab34:a9c2 with SMTP id y8-20020aa7ccc8000000b00564ab34a9c2mr971257edt.17.1708372794467; Mon, 19 Feb 2024 11:59:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708372794; cv=pass; d=google.com; s=arc-20160816; b=NFDf5fMFtZsiiymlFKfvCYyK8GHteVeYnAWfzM3R+nJDfe5Lm9654qRT9/JbBSJkiD smjIzct5W77F5jyHg3FSDhLCnSZAZJ09zG+P2EkadCgMg7M1rLfXEsuvEpUtnXnCA6xY xDUVwB8iulmby9OEO12SZ2y5iEt33aK24+kZOvhnBipvK4QkxXyqekyFXLTjZAFt8SFX Rh3JKd0O93Nu9zN/brnOHOAKXNd1azon6NPXQm9i99/qtE6y+JP8UkAMlXVfZm4ARk0p TR6mAUE6Kl/4Vho/awiNLZsOCTsActqvfm76WnpltQxdc7iZDZBQWZSFQ/Y3bz1l4UU1 yqvA== 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=htg8kYRNZIoVfW56cPMainX/lb36vC/kv5I6HAzDcOM=; fh=LOynIoGsIcCMdPC1QzzjJynRZ/faW1WIR3/UfREgjqw=; b=Gr3gQMKjtctChBBU9VDtEROZfyuS0Egci1cs98epWD/faN+mXlT5eLTiC3gEpZbxZc 497LIHcM4+pNYJPttg7LXFG0IITNMBUUYw2WryROYJ19iSBcmgAVXWNCP01hYRpNZRiV iEAwojDPVFOZb0LjYoGXPS2lZsbz8rteqj89+M8z2V+VX++XupGV1OTsTUOQjxr+o2jj P5LPt6ivLEjIm2Xaq2ESfq254idRNtRdpVAig7xMZdquxgB3QQdt8VKTSIi2R8EILfD8 j/GApRAGs7SyxI+fflJhrpmhSHGKsGVEq1ejWqgqMmTOtaEcy11UOgWx93CZfSD4SPAU Nymg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KseJSHvp; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-71933-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71933-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s19-20020a50d493000000b005642ea0a7besi2267819edi.164.2024.02.19.11.59.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 11:59:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71933-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KseJSHvp; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-71933-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71933-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0C0BA1F23794 for ; Mon, 19 Feb 2024 19:59:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 040AB535B0; Mon, 19 Feb 2024 19:58:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KseJSHvp" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 9B24251C3B for ; Mon, 19 Feb 2024 19:58:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372700; cv=none; b=Yjx/apO242M+IylS9M/Isl5rQjBApd25A42pVv7dTb2OKkMDwfXNvkazDEKefaWQfV7nRWTTRMscpTC+INmBj+YBJeXlrlRq88pEnfBMAuub1NxxzRaTTj89jWRJH0Lrzvxp1fwQDpmNVdLVqUbnw34h/UhVjucoGFVIIChv8m4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372700; c=relaxed/simple; bh=LQfcvhDhukePnMMEY/6b22ES5Z9aTSaVbHBODDBxTV4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r/SwLuo3IyrtkwH5zk2G/fWM+fbvb/HXLYLPFxddf1schAyvCCHCet1rEs7YGlhojZDzfhI/PQL3+BYTPxPBE4yZ56qEUoCL07TwteVsqItZ0694BkaUa0tJZeOEpobvVPHc7Dseal57cfNS5tpg/j9TO/g/EeqFf0N2B3yLCEw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KseJSHvp; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708372699; x=1739908699; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LQfcvhDhukePnMMEY/6b22ES5Z9aTSaVbHBODDBxTV4=; b=KseJSHvpEc1wtknMgeWZqvKEV5RoHg64hxMw4ETuO6xp6gh3lsdchTtI yEU9KjXu3vG4EXmDcBdn5rcwsoAb+p9saUiJjc/rdNJ8yoPWts8XKijm+ p6b8osnGKLGgh8Y9G6lRaKIXJeJSB5Q10ekxHVEKuIo6oTtP4N6uMGHqz fWuSvJ5qKtMgbs7xhuuyxCb3qCRSagyTac/CMZrJXNJ7Qoth6NEEi0pkq nwsinAcRy/8FlK5AtwROGMsmSYO1J4GCnOxIBBtS3LyVlOmmiYG+39/b7 ypuWaHWyfcCTI/uW1JxaBeBzP9ETi1VmjIayqPZLMnOgC8Ir03qFrc2r1 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10989"; a="19893443" X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="19893443" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2024 11:58:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="9239483" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2024 11:58:15 -0800 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 770F411FB11; Mon, 19 Feb 2024 21:58:10 +0200 (EET) From: Sakari Ailus To: linux-kernel@vger.kernel.org Cc: Hans de Goede , Tomas Winkler , Wentong Wu , Arnd Bergmann , Greg Kroah-Hartman Subject: [PATCH v2 2/3] mei: vsc: Don't use sleeping condition in wait_event_timeout() Date: Mon, 19 Feb 2024 21:58:06 +0200 Message-Id: <20240219195807.517742-3-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240219195807.517742-1-sakari.ailus@linux.intel.com> References: <20240219195807.517742-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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 2b69ada9349e..7b678005652b 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.39.2