[i2c] [PATCH] ARM: OMAP: Release i2c_adapter after use (Siemens SX1)

Jean Delvare khali at linux-fr.org
Sun Feb 24 09:37:25 CET 2008


Each call to i2c_get_adapter() must be followed by a call to
i2c_put_adapter() to release the grabbed reference. Otherwise the
reference count grows forever and the adapter can never be
unregistered.

Signed-off-by: Jean Delvare <khali at linux-fr.org>
Acked-by: Vladimir Ananiev <vovan888 at gmail.com>
Cc: Tony Lindgren <tony at atomide.com>
---
 arch/arm/mach-omap1/board-sx1.c |    2 ++
 1 file changed, 2 insertions(+)

--- linux-2.6.24-rc4.orig/arch/arm/mach-omap1/board-sx1.c	2007-10-24 09:59:18.000000000 +0200
+++ linux-2.6.24-rc4/arch/arm/mach-omap1/board-sx1.c	2007-12-07 11:56:22.000000000 +0100
@@ -61,6 +61,7 @@ int i2c_write_byte(u8 devaddr, u8 regoff
 	data[0] = regoffset;	/* register num */
 	data[1] = value;		/* register data */
 	err = i2c_transfer(adap, msg, 1);
+	i2c_put_adapter(adap);
 	if (err >= 0)
 		return 0;
 	return err;
@@ -91,6 +92,7 @@ int i2c_read_byte(u8 devaddr, u8 regoffs
 	msg->buf = data;
 	err = i2c_transfer(adap, msg, 1);
 	*value = data[0];
+	i2c_put_adapter(adap);
 
 	if (err >= 0)
 		return 0;


-- 
Jean Delvare



More information about the i2c mailing list