Skip to contentSkip to conversation

Fix bus reset in i2c-philips-par

PATCH New Jean Delvare 2 participants 3 messages Jan 25, 2004 – May 19, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix bus reset in i2c-philips-par

Hi Greg,

This patch fixes the bus reset in i2c-philips-par when it is loaded with type!=0. For now, the reset is always made as is type=0. I guess that this driver will be abandoned in a while, but it probably doesn't hurt to fix that.

I've committed a similar fix to our i2c CVS repository, and will send a patch to Marcelo someday, in case he is interested in the fix for 2.4 too.

Thanks.

drivers/i2c/busses/i2c-philips-par.c renamed from drivers/i2c/busses/i2c-philips-par.c.orig +2 -2
@@ -184,8 +184,8 @@
 		return;
 	}
 	/* reset hardware to sane state */
-	bit_lp_setsda(port, 1);
-	bit_lp_setscl(port, 1);
+	adapter->bit_lp_data.setsda(port, 1);
+	adapter->bit_lp_data.setscl(port, 1);
 	parport_release(adapter->pdev);
 
 	if (i2c_bit_add_bus(&adapter->adapter) < 0) {
Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#1 lore raw

PATCH 1/1 Fix bus reset in i2c-philips-par

Hi Marcelo,

This patch fixes the bus reset in i2c-philips-par when it is loaded with type!=0. For now, the reset is always made as if type==0. This patch was built and tested on 2.4.25-pre7.

I've committed a similar fix to our i2c CVS repository, and have sent a patch to Greg KH for 2.6 too, which he already accepted.

This is a bug fix, however:
* I think that the i2c-philips-par driver isn't much used.
* I think that the i2c-philips-par driver with type!=0 is even less used.
* The bus reset is more or less optional. Skipping it doesn't hurt much.
* The wrong reset doesn't hurt either.
So this is in no way critical (and explains why the bug wasn't discovered earlier).

On the other hand the fix is easy and clear. Anyway I leave it to you to decide if it should be applied to 2.4 or not.

Thanks.

drivers/i2c/i2c-philips-par.c renamed from drivers/i2c/i2c-philips-par.c.orig +2 -2
@@ -212,8 +212,8 @@
 
 	/* reset hardware to sane state */
 	parport_claim_or_block(adapter->pdev);
-	bit_lp_setsda(port, 1);
-	bit_lp_setscl(port, 1);
+	adapter->bit_lp_data.setsda(port, 1);
+	adapter->bit_lp_data.setscl(port, 1);
 	parport_release(adapter->pdev);
 
 	if (i2c_bit_add_bus(&adapter->adapter) < 0)
Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
Applied
#2 lore raw

PATCH 1/1 Fix bus reset in i2c-philips-par

In reply to Jean Delvare
Quoted 6 lines · Jean Delvare

Hi Greg,

This patch fixes the bus reset in i2c-philips-par when it is loaded with type!=0. For now, the reset is always made as is type=0. I guess that this driver will be abandoned in a while, but it probably doesn't hurt to fix that.

Applied, thanks.

greg k-h