From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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 C0D8933BBC0 for ; Thu, 23 Jul 2026 11:36:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784806596; cv=none; b=OTyowVRnq37XCKO1DKgbmYXBJxz/Z0F0P8AsEmX4ooOeHFKz1U8r0QxqDo5nCUwCRYety/4gqo6Q6t/8MAO+UeKMCorvuynBfCCHoKeOEiQNPmfeY4Gs/5ONy+m6EMf0u6EiJ3+/fj693iFyYr1+bU9yN2C3Ey1X7tZPgC8ZJJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784806596; c=relaxed/simple; bh=3fzE7QX96TA6InJnpjFGsnjlRpj7E0/XiyaA3d4eAOA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ptxm+7049NrzJDlsxJdcnjmKT5onPf8vJLnFT4hwB4qYqRuSN1OCJ2mg5dr06NSp/2FRe5ZRqvQLgwehopjGljrDt6wI6x9JnDpLfsht77uSOeV3SsEXxaaQGck29ZubHBtQOljSXBBErZlhTFO2YSGykexqURPWX0AcYjZ/He4= 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=ssi6C/vP; arc=none smtp.client-ip=209.85.208.48 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="ssi6C/vP" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-698e5859a3cso854163a12.0 for ; Thu, 23 Jul 2026 04:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784806593; x=1785411393; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=FAUuYkKzKbrrKb0ZtaRbfH0JfxAr3PFg0MM+Bw2KxlA=; b=ssi6C/vPxhBMGKa7sDyDjep67hVJ5Q1g4XNNqnaMd0ExPFLY1DREjop0Nvk1Vh/oA/ rh6cSGDF6ecrin7+Quf2/t5thVvDV84dJxO2gNGJ0XFrBMPFvB4oc4xlc8esJcQItpen a4PQaHGfuB90TLP+RA9oG6PRr1mrtkLfhEtCX7ZE4uVoW8g6Du3NyMQPxSWW2MNplUPi cWmh7A8a+4Fj+ez6gBvzx0GjH2GjCaD9JFCDTTqdSKSp1jOC306RlLAWhQWctfZpsnwG srCBJ5VsJKrer4AdHomdO34qztyi5uuzM59cCr+6pCaY0C70MaoZQw4KCzc+r2APCTmp z28g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784806593; x=1785411393; h=in-reply-to:content-disposition:content-type: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 :content-type; bh=FAUuYkKzKbrrKb0ZtaRbfH0JfxAr3PFg0MM+Bw2KxlA=; b=jZPCKq13TGRKlfoLKxJgDfraTwBMOHHRVIQC+W+CahBux2tBIIbBEB2OsYhgDb407G HKe8QJ1ecxUVoANLsrDwxS51MCKnwQI35AaJK+FiNHCnwR31a5ZxYC++SiBAMA5Kg4H3 YtuBwDzQBt4uLB6qzAN5gFJRwSLcVmjc0vXRVkQXvn3NTcsAmEvRcDzSKSmXCJOFkoJ9 +M4Y+Vkqa+lXUhSrW7dIyGtHgqlxeeUb6GPWfM68PqLPJebl8atMclkqfYaO02ZZNGi/ QhxjyS0G6AKDZ4yCb4Jve46G+MNGVxX261O8uNJvFs1TiWUMUXa8niIDKUC9KU7fcqaa lA8g== X-Forwarded-Encrypted: i=1; AHgh+RpEaOvTcaXckOMFSYsKdYMVPQY3/Avlj3EzrXffmoCiLc+mb574bmPOkuRi+WNZYZ+IlV4i7poTSUUzoJM=@vger.kernel.org X-Gm-Message-State: AOJu0Yx06npma86JB0Lp2MdJ2vS0922DiwJR/nQufNyzN01ZCXLLaFs5 7SXCDGHzA9JwZph7guZqhv9ob3ZhXGAVmMqGG6PFPsRI7En3V5zA2zJp X-Gm-Gg: AR+sD13WItOB+hY18aEviPV+fOpMecURMZRQ0ePeTDy9Gv1PL8Fhui4GPMT5qOnO2Lk JUSmRObyvW5pqeFw2NDwT7ntWW05xW1mGHXF06up4Gim3ff7EHSsWJDppM9V/0Bp3bNVr2JNb9g p/2kCRYGuisTAoEY3/knmNiNp+uvPF0TD+WF8Mic9F6MzVJyWJk1O4P/kBRbJGM8pVmckVzcpEL EZ+hNWSVN7rUl1YW02x2U4niGX+0Cbfq7U7w65zKp0A811j64CAId6X1We6v3xhuHmtZbT4gyzp fVqItxZ0erupNk+yTTwzky7BogE0cmxwAkf4twDxxtZYLAQkqa3OivBwF/YBhDTeSzgnW2S7PxG 2zIyxNI90SYoa6HLm5kCW1PREEQE6e38/QtXDHbwbI2Xwv9jiy8jYEwTEZ9sGDiTXC1gThspWdn tsrIR4BF3SWkbmV6emsL0EtUYI0bfkhJYaUTtFdlg= X-Received: by 2002:a05:6402:1ecc:b0:698:7418:57a9 with SMTP id 4fb4d7f45d1cf-69f748ae779mr1009923a12.17.1784806592716; Thu, 23 Jul 2026 04:36:32 -0700 (PDT) Received: from gmail.com (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-69f350377b7sm1980490a12.27.2026.07.23.04.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 04:36:31 -0700 (PDT) Date: Thu, 23 Jul 2026 13:36:29 +0200 From: Marcus Folkesson To: Peter Rosin Cc: Wolfram Sang , Michael Hennerich , Bartosz Golaszewski , Andi Shyti , Andy Shevchenko , Bartosz Golaszewski , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v12 1/7] i2c: core: add callback to change bus frequency Message-ID: References: <20260719-i2c-mux-v12-0-a5010d623a57@gmail.com> <20260719-i2c-mux-v12-1-a5010d623a57@gmail.com> <19dbf4be-5f17-46b3-924d-eb24ae41fdd9@lysator.liu.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="OVfm+UyA/qXeCYnJ" Content-Disposition: inline In-Reply-To: <19dbf4be-5f17-46b3-924d-eb24ae41fdd9@lysator.liu.se> --OVfm+UyA/qXeCYnJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Peter! On Thu, Jul 23, 2026 at 01:03:53PM +0200, Peter Rosin wrote: > > + * > > + * @set_clk_freq: Set clock frequency for the adapter. Returns the act= ual set frequency. > > + * This function is optional. > > */ > > struct i2c_adapter { > > struct module *owner; > > @@ -742,6 +745,8 @@ struct i2c_adapter { > > struct rt_mutex mux_lock; > > =20 > > int timeout; /* in jiffies */ > > + u32 clock_Hz; /* bus clock speed */ > > + int (*set_clk_freq)(struct i2c_adapter *adap, u32 clock_Hz); /* Optio= nal */ >=20 > To expand on the comment from v9 by Wolfram [1], I too think it > would be good if this function pointer did not live directly in > i2c_adapter but instead in some other struct so that the actual > pointer could live in read-only memory. I.e. if i2c_algorithm > does not fit for some reason, a new function pointer struct might > be called for? My objection to move it to i2c_algorithm, was mostly based on that the algorithm should not be aware of the current clock frequency. When I reread the comment from Wolfram (and you), I realize that we are only talking about the function pointer, which is fine to put into the i2c_algorithm struct. Sorry for the misinterpretation, I will move the pointer to i2c_algorithm and keep clock_Hz in i2c_adapter. >=20 > Also, returning int instead of unsigned hints that the function > might return a negative error code, but the new code in 3/7 does > not handle errors. So, either change to unsigned int, or update > the support code in 3/7 to handle errors. I think the latter is > the better approach. Agree, thanks. >=20 > Cheers, > Peter >=20 > [1] https://lore.kernel.org/all/ahX44_rzaRlTLSLU@shikoro/ >=20 > > int retries; > > struct device dev; /* the adapter device */ > > unsigned long locked_flags; /* owned by the I2C core */ > >=20 >=20 Best regards, Marcus Folkesson --OVfm+UyA/qXeCYnJ Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEBVGi6LZstU1kwSxliIBOb1ldUjIFAmph/LgACgkQiIBOb1ld UjImNA//dFlLVBf+3iuSWVyzi5/TaqJrTyo993+vC/Iq8vZPYcabFRIM7vl7+adb +df/fj8ph8NtPZAmGiaq+da6i6bKEdVowVEgrD/sactK6PRAcxFxeNMdHpKgsaY7 HnOAf8YEFcwjZ0QPoQimY5Idh/Qv0NTw8Pf7iPIvPfFxBuwVKT5XDB2ncoccxjMW ezPMdzk3sBED7xPcys/Z6Qeh41EdP4ez2uRfWdDaPBBJ94kEY3LTuEDX0oCnIoCS y7MBafA2mqwT1bAuZYKOAqBCzqgkx9oiGN9gWH7DWrPpj8l7sGO3BcsPzJ0JlFNo VabrYsyPA84qPo3Z6ZAb9uRbnrIlVmr+3sfAmBJfJ//1uSRfY3RWqelps7XZrt6d oO0NX19S1rXeChsLEcT+YfCGXE2a3Jdnsy53PDvCduUaVyUs/euPjMacICzOfbQm Hbv5fUTEq+rej6BmwBpAcQxaap0liwf4qBF7vzgKJIxpsMa826qM83q7x4fbhUgn Ph/2jvBQFX0v5vdME4J18smKjXQalggtU9dxREWJ/cQ42JYh7eG5iaTD8wr+7K4y Ing9Tm5Y5kRBUAs3oRvgyAoPQkpxQagvaqJ7H0fzDNTF5djqX4F7h14uk+zB2XOm qDrt7QPJNmHqdzSBAj5okLUlhMIp9mFuMiAPlCc920QS2yfBSms= =nf2D -----END PGP SIGNATURE----- --OVfm+UyA/qXeCYnJ--