From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 126E63E9596 for ; Fri, 27 Mar 2026 14:06:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774620391; cv=none; b=I3nha8dUc5A3Bc66n/BCi/gf3BO6Syj2/Ynejh47kvQBbygvGTfIG3X2+Hy8LuY8+Ck3isyhetnhotJzUb3vGxPhL5h41GUY24yzui4TTTdThttDbUNSBof7xyk+uBLbY+NRy4EyGcJzvuEXiyvsEIL7bilvwPvG2X3BeK2Ju8w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774620391; c=relaxed/simple; bh=YG4r2XuxApAYu6LKzoe/5SwvEPoyF1OnlWcoZM1u4mI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UYJLU6mOpZhw/VS+8M5f9AHZLS2AQfkNnVD2AGFmWm3SijgPa/Q6a8YlCLDEx5kfBrOSjnMnzOdzs5PlDmDvjgJDzuJDMcnxIGGaoCPu+LFq3oHDadE8d0gI3YAMYRv/FforJ57oKwYmuBKJcJgNBYoZNoTJFCcr7BcQ8xcB62A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XJUcqaIg; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XJUcqaIg" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-43b40fb7f95so1876630f8f.3 for ; Fri, 27 Mar 2026 07:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774620388; x=1775225188; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QSUpIlblw1Y8p0Flz+2ps8AGucj2y3pRw8IP0aJ+OJI=; b=XJUcqaIgL71hXD8t8lZL96lttY7Xmh42IwKc368lwUvYfz9XpYn8Jd5XpIJeKwnEFm e8eEcTukPFBgYursd0S1J82POhJmnJ07m/jPGknii0EALdeJQlpPYMXIfLBUfdubcFIj v4nhPm+AeCgHb3KWllGs2ESKnlm4tp179tr921TTeSCc5Hr9eH1DjvukiwNCzf51SLoW 2MfPnhVEMpxMeVzt6APJbDIJZWCEvVK+wwNgO/1cEVZqpYH+ywjowG4JYq2Z2bxFnG7Z 6+zTinJphliFafoczfxB7EX2oh7tPuziJouOa+myu0yHg/jtkwyYv4++V98M6PyOO+TI ywGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774620388; x=1775225188; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QSUpIlblw1Y8p0Flz+2ps8AGucj2y3pRw8IP0aJ+OJI=; b=nclcD63T7a3WtDx7xaaQeo70UTv9KNwjWVRqJLRD2SwzdWWZ5C05eL9LBUXfXsU7g2 HnYbVlr9LLYdHLBD6uv8b8hWofaBpKOEmwu7BeUT2WgZxrAhgtSl5609xrElpbDLp3AN Kxahdoi3EA/Q3tfD0i9WE+/GZwCf5fzPpPozowrSemt8iPROxH2E6rieoQXIoTUMLpY1 HgTFFvFY7UNnaFlNtQlUixrCcxAVlK92UzUryRGAHTcL7DfIr3aYZXhfzzuG6HX7V9GT UDYZcOZY6RTfl13lW1FJa6tA3UOgjT5s57TrYX0O3AAMq1sm7vRaTNrTnsxUvnu9GvjU /5xQ== X-Forwarded-Encrypted: i=1; AJvYcCVIOGhD1JSWVfyZYRjlUS69nyKPSovABYEW6NHJaNuD60198j+zfjYRmQSqIBvM2IhDip2WpGzInb/N@vger.kernel.org X-Gm-Message-State: AOJu0Ywmqr4lSbjgBgOLMHJxpmk2gJ3BYKogGXf7kJnvL8y4MbqU9gjK YyqscnQIUT8cOweAuvgfnZYLBPr3NvCv6QRSpaS1qWyNywYiZ6tUtt32 X-Gm-Gg: ATEYQzxA3qdcvUkTvTv1dZ/YQDtPYIhoAar/hphAWdjmT6TGmKzjLNGjnRzZXSrbi54 8GzWgk5yg7jR5Iy+KKWIqq5R7igr8kphtX2I4GSMfH9Dp2af+riHr34/3slo/AInD++XFc1jGVr +zD8X+tzUPOJDrlud/6h27ZgQvPdOXMRHDw75cBYEoExeiCTaIV3tZW535r2QO1/Vfd1wLjVrAr Vu0InuboChkrZY7mcQmoj+f3R9ZeQRkkgLRy0TJaol5zEA4IJd6mO1tSFhSet9xz7N/H7LOwI7z gi1LT1o8D8ubqBtdctcq2ynGskUk833YwSqR3Ta3KeeJ6Sc4oXmIK9XaQ1MCYvFXybYaU6mCz26 YnM+5DQqSNeE+smAQuVxfphngJLVLa7037ak1CXdNTS2UFLqfAH5T0xyyR88MBGHcUWS6/P/nUH Ho87JI2nafdA1p5EFPmKub9ydkBGT9iNyxvRyzb8iJ6T06v9SUfRA5/p6HYM3O/hLQ+AcMDT6Wd OOAvn9xABOvug== X-Received: by 2002:a05:6000:4212:b0:43b:95e9:413c with SMTP id ffacd0b85a97d-43b9ea6390fmr4110385f8f.44.1774620388098; Fri, 27 Mar 2026 07:06:28 -0700 (PDT) Received: from orome (p200300e41f249a00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f24:9a00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b9192e305sm16052576f8f.8.2026.03.27.07.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2026 07:06:26 -0700 (PDT) Date: Fri, 27 Mar 2026 15:06:23 +0100 From: Thierry Reding To: Diogo Ivo Cc: Thierry Reding , Mathias Nyman , Greg Kroah-Hartman , Jonathan Hunter , JC Kuo , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org Subject: Re: [PATCH v2 2/6] usb: xhci: tegra: Remove redundant mutex when setting phy mode Message-ID: References: <20260127-diogo-tegra_phy-v2-0-787b9eed3ed5@tecnico.ulisboa.pt> <20260127-diogo-tegra_phy-v2-2-787b9eed3ed5@tecnico.ulisboa.pt> <00aeda7a-e5e5-4779-b212-6e56c2c5ec31@tecnico.ulisboa.pt> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ktw4w3vv6m4wgb3m" Content-Disposition: inline In-Reply-To: <00aeda7a-e5e5-4779-b212-6e56c2c5ec31@tecnico.ulisboa.pt> --ktw4w3vv6m4wgb3m Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH v2 2/6] usb: xhci: tegra: Remove redundant mutex when setting phy mode MIME-Version: 1.0 On Thu, Mar 26, 2026 at 02:17:33PM +0000, Diogo Ivo wrote: > Hello, >=20 > On 3/24/26 11:48, Thierry Reding wrote: > > On Tue, Jan 27, 2026 at 03:11:48PM +0000, Diogo Ivo wrote: > > > As the PHY subsystem already synchronizes concurrent accesses to a PHY > > > instance with a core-internal mutex remove the driver specific mutex > > > synchronization. > > >=20 > > > Signed-off-by: Diogo Ivo > > > --- > > > v1->v2: > > > - New patch > > > --- > > > drivers/usb/host/xhci-tegra.c | 4 ---- > > > 1 file changed, 4 deletions(-) > > >=20 > > > diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-te= gra.c > > > index 8b492871d21d..927861ca14f2 100644 > > > --- a/drivers/usb/host/xhci-tegra.c > > > +++ b/drivers/usb/host/xhci-tegra.c > > > @@ -1357,15 +1357,11 @@ static void tegra_xhci_id_work(struct work_st= ruct *work) > > > dev_dbg(tegra->dev, "host mode %s\n", str_on_off(tegra->host_mode)= ); > > > - mutex_lock(&tegra->lock); > > > - > > > if (tegra->host_mode) > > > phy_set_mode_ext(phy, PHY_MODE_USB_OTG, USB_ROLE_HOST); > > > else > > > phy_set_mode_ext(phy, PHY_MODE_USB_OTG, USB_ROLE_NONE); > > > - mutex_unlock(&tegra->lock); > > > - > >=20 > > It looks to me like the mutex here is trying to protect against > > tegra->host_mode changing while we're setting a different mode. That > > doesn't seem to be taken care of by the PHY internal mutex. >=20 > After taking another look at it I think I understand your point for the > mutex, but in that case wouldn't it also need to be held in the writer > of host_mode, tegra_xhci_id_notify()? Yes, I think it probably would need to. I don't know how likely it is, but I think the purpose of this is to protect against the ID notifier firing quickly in succession. Although, given that this runs on a work queue and work queue instances are non-reentrant to my knowledge, I don't think we need the mutex here after all. > This patch has been picked up as-is into usb-next so it would be nice to > figure this out before it gets merged in the next merge window. Given the above, I think it's fine. Maybe the commit message doesn't give a correct reason for why we don't need the mutex, but the resulting code looks like it should be fine regardless. Thierry --ktw4w3vv6m4wgb3m Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmnGjtwACgkQ3SOs138+ s6Goig//SnPG7Rf8K0gKeOP5TZWyD90YKXfxg4roWTYyRNVHdUU2H14n31xJS1Oo pMQvSFpK/kjChe09fFOUecq5vW68Rrfm2+Vi5rqfW+GHUlGo+5S70gJ8lbpV4wOh Ee7fuEilJgSjIMVxxwQY6rupnrXIPufzsSHGwbtaSYy04ibP9vhDn2REJ0bkIuZc AWzBBUQXf+aDMyKkliS5Ll15t54oQRdjZp/c02Zd1ffBX/6vx2/lx7hbSTBEm8mF eTyQV9XU3so3X9+mmff5uYEOLkHOxEJgOOVdMW8XDrTTLqR+PgTJ44zoGcOnCrNk 2sOuA8ThjZBqgmjmVvi1zTasc0jHB7McIwHD8XLHmBS1SM1k8y7Lwjzm3VXXqYOl aXaMCIEwzp+WeYuxLPDQp5Qj8HEbNmAqZMztnucMn0h6riFsFX1SICiQ7o8DXe3/ qTPjRWL7qvtiJSBCN068/hZF6l0m2hIfJqflvmF9CqDd4wzAfUqgSZiavmwpJpYt refzB/wklao+yrD+cp895hPidxJVmG6omcleeczxJmVVKWm6pOYJP3LCLGezArVn phgVYhRDOUvKWQk6sgtCqJbf6h0T1Nf1YvN/Cu1y6MAB1tgGiMUV6JEVuhaPN+kd PnN3cFTF/8ATfGpMSArmO8l4VYoGHx5FxgE/LFRPED4LZgaGlZU= =g7fB -----END PGP SIGNATURE----- --ktw4w3vv6m4wgb3m--