From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 243FCCA5A for ; Thu, 12 Feb 2026 21:47:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770932865; cv=none; b=i75EeX2bWF9vAPSfs8ffmCHfQHj3scxskuhEkgYEOKEQGrcpAI935NQy07lDzfRwuk2dp7Xp5wwpogC4qWravipXV3m7IOEzYxo41OHjsnk4tYF5lcAAqmRXka2tKBE20u4PM051pEyjq5uwEQVjaU6YMCKWNgNnCeQnQM+XzOs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770932865; c=relaxed/simple; bh=WUVEbns8lbGeXg02l+QeZugnAQx0JP+e9sc/HPp2eXU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nANaDSuC+oWeUl3cSAwZORkV/LC44/GKSqSy60fdNuqakiDTBKFIQoK3cixWzT4feVPAS/exrJ5pLvWEHPaAt4RY7QcaUsQSR0A4vwrJekdhyFGb/eIBD6E9mB/7N3wSpPPwcARTBI6GO1IQy23MWXzQed/99W2Bzy9VVsr3F2U= 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=Nd3hY9dn; arc=none smtp.client-ip=209.85.167.41 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="Nd3hY9dn" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-59dd4bec4ecso325143e87.0 for ; Thu, 12 Feb 2026 13:47:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770932862; x=1771537662; 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=uI0DWSxvm6NFySyRZeE8NYakt+hMKZcgOA3uk/TYi0k=; b=Nd3hY9dnzXCWJokcsBbEVxCNf7afxrkt/I+IMe/Tar9pK5L7/zWVWgmaye+YcXPh41 Q49U8lbir0ERb2nQ8bwNLAcTdfpI+Y8/k/ssu8Kk+fItzdyn51TMv3GybYHElUddaOMV gyIUn8yt2DBYtyWbeRyn0jgAsrTIZcSjyDfyR9c/bnhNQD3vlmC69IRmVTzbZxoYA2Dj LtsSSRL+q5C9G4oAyNv8y4oth1FcSv10ft41AQeZRPYIR5MVTZmsuF1HIN154YGxg7WO mxeorrrwIkxwD+Rbi7rOsPxkU7We244j6r1WZTw/3JXg2mRtb+qwUxMVGTibcamMomv9 tgKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770932862; x=1771537662; 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=uI0DWSxvm6NFySyRZeE8NYakt+hMKZcgOA3uk/TYi0k=; b=tCBhgDtcRVEJkKX12Lfo5PkHYzxcWfEAkRJer+qPgpiBGJb+6BJHNrcKp6K09p9uPT TBcGOv6QD+lS/5XsFzOL2bJx0FqqGS8XmZ1hPQ7keATwft0kHiUSVt9h/2sgXtU3Htic BrMOCrR22CdrECZ0uS/+oaYwrxX77VfxW3F7WPZGV74YrlMIXcoqkUVgW+UcgTLQhFGM DQsgjkHLRHzfIPdWwakkIqlI6aEKPVqqIydntUjG+jhv3JobRK8+QI8IB/V+T9nrgIOr YBjctCBnplml27rM73tRaK7aaCuYE8rG4d9HXWexMc/s5AXMibmjpIrerFaVYbFtgKBc mQfg== X-Forwarded-Encrypted: i=1; AJvYcCXAHaJkEFKcmxzutPdxF1ZyLvRNAEZfWnbI4h6xM68Fn9eSiUgFeR9QtMIxem97Yxv7BRY8GLOq5owHU4Y=@vger.kernel.org X-Gm-Message-State: AOJu0YwjCZ9XSZ0D/B4h18jRflfRgQ6ksWWKmWk7h0P1SCMWvktULlLz tFgt1aQKLvNA2CABkRHpHRg112H+Rddz/7v89KxLogEdBBV+oj58yJTG X-Gm-Gg: AZuq6aJC0dqdFyQQ3uk0sVtkUgwi9wlpLdcTgGhS315TOihege45okwTNUnVFPrQgSE kvmkvwsOhd4KxHLv4isWSpfdtoS1AEHN6luWk/xq9ps0mqajtpg8WCWq48lQ7dCSbdviVnDrLG1 MhpJwD7hMyOEgqARRgjCZpARgkbF69JKpTp/CoYG/kUJ5w4YNCtcT/WPRC1IT9pCjwCx0dDcmIA P9X1RZ2aGLeOTmBVCPju1ZQZU9VRb2LQ6xlRVf41GXULYtTcp7qMJ2bkJwZJCa0fkP22AjPKt4x 1KCDZv7X1NnoGsW+d49vXw0eYZYBP2RxMrFDoLic4ndKWueH+BBSu1rGz1Hg/dKBYOsEcgWojk7 fiSETu62vG7lT+45uh441e6zhUrIw8M83TTPGWXW8RWQzpgstc+S/PKfPJSmLFA3GPAgBzSfC8t Zl2k7jeZv0KevpQ6wJeWm4zjpx2QlORPMJb4htoYZAPCnrj+LqwzN48BWu35Zr X-Received: by 2002:a05:651c:41c7:b0:385:f7ce:f322 with SMTP id 38308e7fff4ca-387f80ded45mr477031fa.35.1770932861977; Thu, 12 Feb 2026 13:47:41 -0800 (PST) Received: from gmail.com (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-38706928d9esm10989251fa.42.2026.02.12.13.47.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Feb 2026 13:47:39 -0800 (PST) Date: Thu, 12 Feb 2026 22:47:36 +0100 From: Marcus Folkesson To: Peter Rosin Cc: Wolfram Sang , Michael Hennerich , Bartosz Golaszewski , Andi Shyti , Bartosz Golaszewski , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 2/5] i2c: mux: add support for per channel bus frequency Message-ID: References: <20260128-i2c-mux-v4-0-dee49ce276c0@gmail.com> <20260128-i2c-mux-v4-2-dee49ce276c0@gmail.com> <2ecbebd8-0842-34fa-a593-25168c91aa6b@axentia.se> Precedence: bulk X-Mailing-List: linux-kernel@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="+EwcLp+XXXrhpKBe" Content-Disposition: inline In-Reply-To: <2ecbebd8-0842-34fa-a593-25168c91aa6b@axentia.se> --+EwcLp+XXXrhpKBe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Peter! Thank you so much for your thoughs! On Thu, Feb 12, 2026 at 04:02:16PM +0100, Peter Rosin wrote: > Hi! >=20 [...] > > +static int i2c_mux_select_chan(struct i2c_adapter *adap, u32 chan_id) > > +{ > > + struct i2c_mux_priv *priv =3D adap->algo_data; > > + struct i2c_mux_core *muxc =3D priv->muxc; > > + struct i2c_adapter *parent =3D muxc->parent; > > + struct i2c_adapter *root; > > + int ret; > > + > > + if (priv->adap.clock_hz && priv->adap.clock_hz !=3D parent->clock_hz)= { > > + root =3D i2c_root_adapter(&adap->dev); > > + > > + /* if we are parent-locked and the root adapter is our parent, > > + * we already have the lock we need. Otherwise take the bus lock for= the root > > + * adapter before changing bus clock. > > + */ >=20 > The assumptions made for the "otherwise" case is wrong, I think. I think you are right. > Consider e.g. the case where we are parent-locket, our parent is > another parent-locked mux and our grand-parent is the root adapter. > In that case we also have all the locks we need. Trying to grab > them again will be a deadlock. >=20 > The more correct approach is to do the parent walk in search of > the first ancestor mux that is not parent-locked and then call Hrm, does it not apply for all mutex-locked ancestors? Consider the following chain: Root - P1 - M1 - M2 - P2 - D1 P - Parent locked M - Mux locked D - Device In this case we need to lock both M1 and M2, not just M2 ? I'm not completely sure though, I need to refresh myself on the code base. >=20 > i2c_lock_bus(ancestor->parent, I2C_LOCK_ROOT_ADAPTER); >=20 > for it. >=20 > Again, I think. Famous last words. Handwaving... >=20 > Cheers, > Peter Best regards, Marcus Folkesson --+EwcLp+XXXrhpKBe Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEBVGi6LZstU1kwSxliIBOb1ldUjIFAmmOSnMACgkQiIBOb1ld UjJJuxAAry/YKUutgdQpqDwjHcLxJ8g9+h48FnCkvCuZYOtcjYn9DnGyzNEHJFRU QHHwGWr5YkH1I+mxO33fLPHDPcrvXiUeyPNaMbtzc5TJoLPa+3ijYKO0reKvQ2ky gg66PjR9X1GYAwCbObk7fuBjkMQvsOEG0z8nfT/1EMOMFBgnnkGB8rV/JajjsScT iek1dWSsdogCaaeC9HBMDrJtiybreMtIVpd6AyKSP4BZJ3SoCxnSzEfmUNsRbkTR FiekVhRCzE4x/ENnUAffaiPJJ85jkiAh/oiFCGXTbhaVrX3ECmuKBzXgwMG/KfUH A4Wkn2N/0XmO5DwlBgZjJgoPM+3jEBGmdxtR/8Els3/sbJeopKRJj/K+ugDX+sOi /aRgqSQSlbXfEGjCFdofLekKmHgu15IxqX6yMjKCVkF1nlUtSKlOyXwunSEwhTXd rPLJFXTFDd9VyEZt6kPD1QbaAyTqlXGmqD539T9vr/fOB9lYZRUxgS6J729XbWFg JDjkeEBsZZ+ET5mdGEboFzJY+Mdy5Pgt9sYv/MWsGuvAG4tdilD/EkCCueypcxt3 syAtReFNlgkJCQkV0OI0pS1ttYdom3yzhdNH7GylSbERUTuCpsFX21fgWlgYsiaP OS+t0KqO4nCKaTEYkS28ZhUBmkgj41PN1vTFsRawGBrCntIfSDI= =NZ95 -----END PGP SIGNATURE----- --+EwcLp+XXXrhpKBe--