Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp4209107rwi; Wed, 2 Nov 2022 08:04:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uJZqvNpmdMLmj5qCzoyojGiBjzhH3MpxroSecPoLtiYddPYLaeA7KqgIIlXgfEgS7Z2AA X-Received: by 2002:a05:6a00:2409:b0:54e:a3ad:d5ab with SMTP id z9-20020a056a00240900b0054ea3add5abmr25531858pfh.11.1667401475104; Wed, 02 Nov 2022 08:04:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667401475; cv=none; d=google.com; s=arc-20160816; b=OVyVCNUsPzmU2T2TnDCiq9KTBjNFpAYf8Hi/Ska6pgatf0zGVeva2wem2JKrgGzXvk lNRq/DVfBVwZ+z1nmY+86769fIPT+gENdPuRLL/VW0KwFd331k0wRyXhJ43ipQ3HdWS2 3vUSXthisSGeHH1W3xm9707fNQvTf4i0C541siTClMMthmbrXgTng+6L/H5iM48bpNbK CFW2GK5tLtuRj9hK1qPllNMRq3cFdl8QwRyuuSR/swQtSrRJTBUfbCdNqXwUJnXxwbr0 Ngb0DSNRswhzJwL00mtutPLLuKPApk8dEdoYvOjY5JNACbvV2WCVSCBaO+aUfNDNNYwu QvBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vp/5/8JqpN7Xs8eUHXrACEk2HNwpH6nBlBd/T3KeW44=; b=fEGof/RR1G9zBXQ4L0VApjh4DDbTXHQzV/clWtkteULuviiEgnauII0ApnG0Csb5Yd jQYlNXpBq3u7Vafykyww5dQ+pnF5QgJs3h1IuEQSceVlWukzFVYvM33HJWxOIDZ7OGAn gTutQrnen6M8TOl6H0CpYQ6LLtWZzWoESppBWlCcrVmqbh43febj+StUZF0rcaumr3bv KKRIExlj3VyTc5cldvXRAnEow3lu5tPasL1im+EIACdWG0m/wBHucmRJBs0CvW+5bsCe ICts4DhDMeUMn03LCre4CecxR+gWrfA8O/RB6p+b4cG9AgJP8glKWwsD42/1mKnvuTwU BVmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YYpj4b97; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n22-20020a63f816000000b0042b30f95f99si16595096pgh.807.2022.11.02.08.04.21; Wed, 02 Nov 2022 08:04:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YYpj4b97; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230241AbiKBPBM (ORCPT + 66 others); Wed, 2 Nov 2022 11:01:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230254AbiKBPBJ (ORCPT ); Wed, 2 Nov 2022 11:01:09 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3BEE2A974 for ; Wed, 2 Nov 2022 08:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667401268; x=1698937268; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=t52MlG452EomOIcuvqgpmKPAVzIKYRvDLfN++Xk9CL0=; b=YYpj4b977awRPvNlP8x4Fz+vPtxoIPEkfH1uBsTFKxrTlc0P5DEln+Yc mKjgTyJQy7qAbEpFARRJ83SJh33+dpChVxDL30jq/eAdc9Bwnjt546AHs YKy3V5/MPTJpApH4pxsxsQIhFz7By4AyM5eWIsgeRk3Jsjxk8BK9594BQ BO0yXurK6kgT08Kalo2mHr1MGooBRKz5Veysb1sK+CB0WN3Tn+DM04DuP SkHHI4lWKZFV2jT2TEzm77CZaQ6pIAyLGK796yEY7iz2BmUpSjNNBDYCY sNFEFa7wIlSDTowOEKnZMSUvE7n0y3I2KpXGpBD+UIrU44tNM3TQ3dVA6 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10519"; a="371523574" X-IronPort-AV: E=Sophos;i="5.95,234,1661842800"; d="scan'208";a="371523574" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2022 08:00:59 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10519"; a="636810685" X-IronPort-AV: E=Sophos;i="5.95,234,1661842800"; d="scan'208";a="636810685" Received: from apetrush-mobl1.ger.corp.intel.com (HELO ggreenma-mobl2.intel.com) ([10.251.180.25]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2022 08:00:56 -0700 From: gregory.greenman@intel.com To: kvalo@kernel.org, johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Avraham Stern , Gregory Greenman Subject: [PATCH 09/11] wifi: iwlwifi: mei: use wait_event_timeout() return value Date: Wed, 2 Nov 2022 16:59:56 +0200 Message-Id: <20221102165239.33159054626f.Ief9e2dc42f96f8044c197d32172003a5ead0f8d3@changeid> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221102145958.342864-1-gregory.greenman@intel.com> References: <20221102145958.342864-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Avraham Stern wait_event_timeout() return value indicates whether the condition evaluated to true or not, so no need to re-take the lock and check the got_ownership flag. Signed-off-by: Avraham Stern Signed-off-by: Gregory Greenman --- drivers/net/wireless/intel/iwlwifi/mei/main.c | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mei/main.c b/drivers/net/wireless/intel/iwlwifi/mei/main.c index a467da8b2aed..ef5d2938deb5 100644 --- a/drivers/net/wireless/intel/iwlwifi/mei/main.c +++ b/drivers/net/wireless/intel/iwlwifi/mei/main.c @@ -1447,26 +1447,7 @@ int iwl_mei_get_ownership(void) ret = wait_event_timeout(mei->get_ownership_wq, mei->got_ownership, HZ / 2); - if (!ret) - return -ETIMEDOUT; - - mutex_lock(&iwl_mei_mutex); - - /* In case we didn't have a bind */ - if (!iwl_mei_is_connected()) { - ret = 0; - goto out; - } - - mei = mei_cldev_get_drvdata(iwl_mei_global_cldev); - - if (!mei) { - ret = -ENODEV; - goto out; - } - - ret = !mei->got_ownership; - + return (!ret) ? -ETIMEDOUT : 0; out: mutex_unlock(&iwl_mei_mutex); return ret; -- 2.35.3