diff mbox series

[v3,1/2] i2c: smbus: remove i801 assumptions from SPD probing

Message ID 20240709-piix4-spd-v3-1-9d1daa204983@weissschuh.net
State Accepted
Delegated to: Wolfram Sang
Headers show
Series i2c: smbus cleanups and SPD support for piix4 | expand

Commit Message

Thomas Weißschuh July 9, 2024, 5:35 p.m. UTC
The check and warning are very specific to the SPD usage of the i801
driver. That was fine as long as i801 was the only caller of
i2c_register_spd(). Now that piix4 will be added as another user of that
function, the check and warning are not accurate anymore.
Instead of introducing a more complicated calling protocol only to print
a warning, drop the warning.
Even in cases where not all slots can be probed,
then at least probe the 8 slots that can be.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/i2c/i2c-smbus.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

Comments

Andi Shyti July 9, 2024, 10:33 p.m. UTC | #1
On Tue, Jul 09, 2024 at 07:35:35PM GMT, Thomas Weißschuh wrote:
> The check and warning are very specific to the SPD usage of the i801
> driver. That was fine as long as i801 was the only caller of
> i2c_register_spd(). Now that piix4 will be added as another user of that
> function, the check and warning are not accurate anymore.
> Instead of introducing a more complicated calling protocol only to print
> a warning, drop the warning.

Well... it's not just a warning, it also returns.

> Even in cases where not all slots can be probed,
> then at least probe the 8 slots that can be.

I'm good with the change.

Jean, Heiner, any comment here? Do we want to add an extra check
for i801?

Andi
Heiner Kallweit July 12, 2024, 10:21 a.m. UTC | #2
On 09.07.2024 19:35, Thomas Weißschuh wrote:
> The check and warning are very specific to the SPD usage of the i801
> driver. That was fine as long as i801 was the only caller of
> i2c_register_spd(). Now that piix4 will be added as another user of that
> function, the check and warning are not accurate anymore.
> Instead of introducing a more complicated calling protocol only to print
> a warning, drop the warning.
> Even in cases where not all slots can be probed,
> then at least probe the 8 slots that can be.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  drivers/i2c/i2c-smbus.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 

Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
diff mbox series

Patch

diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index f809f0ef2004..f0ac35fd0c5a 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -352,18 +352,11 @@  void i2c_register_spd(struct i2c_adapter *adap)
 		return;
 
 	/*
-	 * If we're a child adapter on a muxed segment, then limit slots to 8,
-	 * as this is the max number of SPD EEPROMs that can be addressed per bus.
+	 * The max number of SPD EEPROMs that can be addressed per bus is 8.
+	 * If more slots are present either muxed or multiple busses are
+	 * necessary or the additional slots are ignored.
 	 */
-	if (i2c_parent_is_i2c_adapter(adap)) {
-		slot_count = 8;
-	} else {
-		if (slot_count > 8) {
-			dev_warn(&adap->dev,
-				 "More than 8 memory slots on a single bus, contact i801 maintainer to add missing mux config\n");
-			return;
-		}
-	}
+	slot_count = min(slot_count, 8);
 
 	/*
 	 * Memory types could be found at section 7.18.2 (Memory Device — Type), table 78