Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1354005lqt; Wed, 20 Mar 2024 00:48:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVPDNd0itsOXsU3Lw5Me75kJU51UgRiDcgCIK0Tkh12qeFnVPT8ZhdBcVtS7HZ3/CWKt2UJipcNsazFNZnXS7jFRZB0ot/0UZtdqO2jEw== X-Google-Smtp-Source: AGHT+IFnNuBzDZbiWgqKk0UyX6hcemo7NLrsijGR7Dhz0AvRDK0a7PiXlsFm4bZTh+V6ye5CMRlI X-Received: by 2002:a17:90a:bf16:b0:2a0:55a:af49 with SMTP id c22-20020a17090abf1600b002a0055aaf49mr362024pjs.29.1710920935668; Wed, 20 Mar 2024 00:48:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710920935; cv=pass; d=google.com; s=arc-20160816; b=U5CU/m97Tm8aGJf1aBI+cLmW+hoDBCkSS8p6uQGrav/o6ezTinMX9r0bUIlqX4hJvI mYzWxzw1GCMk4f7ZZz5h5neA80wFfiCa/P6z+nbGm7HUnWArH72Yb5j8PauIIFWSv5QV Vz5v2zTnKj+jd1+X6jHFj0JNuecFz7vLvPkKMyM2jWoS45eskRKgwq106+sliQeMJYTD 4YjSqfmKk3HGMyxNMxk73Jtms30uo32WhXHOs21cuSk88QSPDPDJoFOhA/HTT+nwMClh VyDrbVDJ3YK1eg3yCA8e2VEweYixkKdnYaiTsVlKFnXgmoV4gRSL8Lg7behZaSfOPYR/ iFmg== 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; bh=J1G19KRZdit0U8aCNWerUwKF+p+inI8+1rRg5UTVWh8=; fh=t7qge2pgQ1KGYNFJFP5O5P99eTkxe/9M9cwHlxSyYyw=; b=Wl9ZnuGyYPhjwbFSX3qOW9AfH8Wwq6x+WHvBZsiNT2OXfDmTVC1+WukuoH6yG8ihsr ZSaGOgbfWSBNQW/pfIvnuU0p5itfkk5uqSNuL+i/geqXHJwQhyWJ4nfXGifXZKxwOGby NoF/OMLFz+1UFZI5lYVqSSyQ7XjbEhGvDJDYFG+100F5OkdrXLsSfuxTa6M8VQznrDco Gy0SBFW9mJfhcl+WF7Fvz2nM3QdRvpWU6KmYiCiI74WNss7V82rpc0PqPtTCF5QCEW3Q 4oAMwldMBeDnRokirqVUeR7PYIJtUuh7WBSJzCXgDyBTldqhftxZYHhCLeSnG/Y10g1l Czdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=c--e.de); spf=pass (google.com: domain of linux-kernel+bounces-108570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108570-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s60-20020a17090a2f4200b0029bb8f40085si913503pjd.18.2024.03.20.00.48.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 00:48:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=c--e.de); spf=pass (google.com: domain of linux-kernel+bounces-108570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108570-linux.lists.archive=gmail.com@vger.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D88172832EB for ; Wed, 20 Mar 2024 07:48:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4157D2C861; Wed, 20 Mar 2024 07:48:39 +0000 (UTC) Received: from cae.in-ulm.de (cae.in-ulm.de [217.10.14.231]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E30D41EB44; Wed, 20 Mar 2024 07:48:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.10.14.231 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710920918; cv=none; b=evtcBuri8uK3XC/t6QiNLdmHAWwNNo/d1XP+OW5DXC0XfK3k6wQlI/ycSQAF9tkmQvzsTAUtahY+DC+q1GSAk0FgLQcaRSd7Yhztdhss9Lmced9ZlEszxxO709MaQfHlc/87HGlipby9wb07UCzFOEqMTTaD4fdQBRCcU9GuUIE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710920918; c=relaxed/simple; bh=/KZAiC6JOq0ybeDq5lNdxzeP0cezbAGpHMCtN60ZSCE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hO5rXVXqi/IWtxdh4V+a4rjj86MDsqpv+CGwH449QVLg9EONZZG0pRM2iguIMTx9ZJmHS57iQPyCNAIsuxBrb3aRC1/PzoafhqwD9tgfxzwCTVtmijhqBEhDNusMBQxMLeEpwnjscqWpULHM6AdtbSlHYf73ExQqgS3gXKmhNFg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=c--e.de; spf=pass smtp.mailfrom=c--e.de; arc=none smtp.client-ip=217.10.14.231 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=c--e.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=c--e.de Received: by cae.in-ulm.de (Postfix, from userid 1000) id 89B9E14055A; Wed, 20 Mar 2024 08:40:03 +0100 (CET) From: "Christian A. Ehrhardt" To: linux-kernel@vger.kernel.org Cc: "Christian A. Ehrhardt" , Heikki Krogerus , Greg Kroah-Hartman , Prashant Malani , Jameson Thies , Abhishek Pandit-Subedi , Neil Armstrong , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , =?UTF-8?q?Samuel=20=C4=8Cavoj?= , linux-usb@vger.kernel.org, Kenneth Crudup Subject: [PATCH 1/5] usb: typec: ucsi: Clear EVENT_PENDING under PPM lock Date: Wed, 20 Mar 2024 08:39:22 +0100 Message-Id: <20240320073927.1641788-2-lk@c--e.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240320073927.1641788-1-lk@c--e.de> References: <20240320073927.1641788-1-lk@c--e.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Suppose we sleep on the PPM lock after clearing the EVENT_PENDING bit because the thread for another connector is executing a command. In this case the command completion of the other command will still report the connector change for our connector. Clear the EVENT_PENDING bit under the PPM lock to avoid another useless call to ucsi_handle_connector_change() in this case. Fixes: c9aed03a0a68 ("usb: ucsi: Add missing ppm_lock") Signed-off-by: Christian A. Ehrhardt --- drivers/usb/typec/ucsi/ucsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index cf52cb34d285..8a6645ffd938 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1215,11 +1215,11 @@ static void ucsi_handle_connector_change(struct work_struct *work) if (con->status.change & UCSI_CONSTAT_CAM_CHANGE) ucsi_partner_task(con, ucsi_check_altmodes, 1, 0); - clear_bit(EVENT_PENDING, &con->ucsi->flags); - mutex_lock(&ucsi->ppm_lock); + clear_bit(EVENT_PENDING, &con->ucsi->flags); ret = ucsi_acknowledge_connector_change(ucsi); mutex_unlock(&ucsi->ppm_lock); + if (ret) dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret); -- 2.40.1