add i2c cleanup code to intelfb

Started by Dennis Munsie on Jun 16, 2006

DORMANTno replies

open the first message on its own page

Message details and related content
hello again,

looks like when I was putting together my i2c patches the other day,  
I forgot to include the cleanup code.  This patch fixes that.

dennis

---

From: Dennis Munsie <redacted>

Adds code to unregister the I2C buses in the cleanup function.

Signed-off-by: Dennis Munsie <redacted>

---

drivers/video/intelfb/intelfb.h     |    1 +
drivers/video/intelfb/intelfb_i2c.c |   16 ++++++++++++++++
drivers/video/intelfb/intelfbdrv.c  |    5 +++++
3 files changed, 22 insertions(+)

diff -Naurp -X linux-2.6.17-rc6-patched/Documentation/dontdiff  
linux-2.6.17-rc6-patched/drivers/video/intelfb/intelfb.h linux/ 
drivers/video/intelfb/intelfb.h
--- linux-2.6.17-rc6-patched/drivers/video/intelfb/intelfb.h	 
2006-06-14 15:27:30.000000000 -0500
+++ linux/drivers/video/intelfb/intelfb.h	2006-06-16  
08:38:25.000000000 -0500
@@ -367,6 +367,7 @@ extern int intelfb_var_to_depth(const st
#ifdef CONFIG_FB_INTEL_I2C
extern void intelfb_create_i2c_busses(struct intelfb_info *dinfo);
+extern void intelfb_delete_i2c_busses(struct intelfb_info *dinfo);
#endif
#endif /* _INTELFB_H */
diff -Naurp -X linux-2.6.17-rc6-patched/Documentation/dontdiff  
linux-2.6.17-rc6-patched/drivers/video/intelfb/intelfb_i2c.c linux/ 
drivers/video/intelfb/intelfb_i2c.c
--- linux-2.6.17-rc6-patched/drivers/video/intelfb/intelfb_i2c.c	 
2006-06-14 15:27:30.000000000 -0500
+++ linux/drivers/video/intelfb/intelfb_i2c.c	2006-06-16  
08:36:58.000000000 -0500
@@ -182,3 +182,19 @@ void intelfb_create_i2c_busses(struct in
	}
	dinfo->num_outputs = i;
}
+
+void intelfb_delete_i2c_busses(struct intelfb_info *dinfo)
+{
+	int i;
+	
+	for (i = 0; i < MAX_OUTPUTS; i++) {
+		if (dinfo->output[i].i2c_bus.dinfo) {
+			i2c_bit_del_bus(&dinfo->output[i].i2c_bus.adapter);
+			dinfo->output[i].i2c_bus.dinfo = NULL;
+		}
+		if (dinfo->output[i].ddc_bus.dinfo) {
+			i2c_bit_del_bus(&dinfo->output[i].ddc_bus.adapter);
+			dinfo->output[i].ddc_bus.dinfo = NULL;
+		}
+	}
+}
diff -Naurp -X linux-2.6.17-rc6-patched/Documentation/dontdiff  
linux-2.6.17-rc6-patched/drivers/video/intelfb/intelfbdrv.c linux/ 
drivers/video/intelfb/intelfbdrv.c
--- linux-2.6.17-rc6-patched/drivers/video/intelfb/intelfbdrv.c	 
2006-06-14 15:27:30.000000000 -0500
+++ linux/drivers/video/intelfb/intelfbdrv.c	2006-06-16  
08:47:31.000000000 -0500
@@ -474,6 +474,11 @@ cleanup(struct intelfb_info *dinfo)
		agp_free_memory(dinfo->gtt_ring_mem);
	}
+#ifdef CONFIG_FB_INTEL_I2C
+	/* un-register I2C bus */
+	intelfb_delete_i2c_busses(dinfo);
+#endif
+
	if (dinfo->mmio_base)
		iounmap((void __iomem *)dinfo->mmio_base);
	if (dinfo->aperture.virtual)
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help