mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 16:31:13 +00:00
880de62f91
SVN-Revision: 31546
76 lines
2.0 KiB
Diff
76 lines
2.0 KiB
Diff
From 2c83888b2170d3883c9316c4d94dddc4b7f9ec68 Mon Sep 17 00:00:00 2001
|
|
From: Alison Wang <b18965@freescale.com>
|
|
Date: Thu, 4 Aug 2011 09:59:55 +0800
|
|
Subject: [PATCH 48/52] Fix i2c driver bug when reinserting as module
|
|
|
|
Signed-off-by: Alison Wang <b18965@freescale.com>
|
|
---
|
|
drivers/i2c/busses/i2c-mcf-slave.c | 14 ++++++++++++++
|
|
drivers/i2c/busses/i2c-mcf.c | 14 ++++++++++++++
|
|
2 files changed, 28 insertions(+), 0 deletions(-)
|
|
|
|
--- a/drivers/i2c/busses/i2c-mcf-slave.c
|
|
+++ b/drivers/i2c/busses/i2c-mcf-slave.c
|
|
@@ -273,8 +273,15 @@ static int __init gen_i2c_proc_init(void
|
|
return -ENOMEM;
|
|
return 0;
|
|
}
|
|
+
|
|
+static int gen_i2c_proc_deinit(void)
|
|
+{
|
|
+ remove_proc_entry("driver/i2c-adaptor-register", NULL);
|
|
+ return 0;
|
|
+}
|
|
#else
|
|
static inline int gen_i2c_proc_init(void) { return 0; }
|
|
+static inline int gen_i2c_proc_deinit(void) { return 0; }
|
|
#endif /* CONFIG_PROC_FS */
|
|
|
|
/*
|
|
@@ -345,6 +352,13 @@ static int __init i2c_coldfire_init(void
|
|
|
|
static void __exit i2c_coldfire_exit(void)
|
|
{
|
|
+ int retval;
|
|
+
|
|
+ retval = gen_i2c_proc_deinit();
|
|
+ if (retval < 0)
|
|
+ printk(KERN_INFO "remove /proc/i2c-adaptor-register "
|
|
+ "for i2c slave mode failed!\n");
|
|
+
|
|
/* disable I2C and Interrupt */
|
|
MCF_I2CR &= ~(MCF_I2CR_IEN | MCF_I2CR_IIEN);
|
|
free_irq(IRQ, NULL);
|
|
--- a/drivers/i2c/busses/i2c-mcf.c
|
|
+++ b/drivers/i2c/busses/i2c-mcf.c
|
|
@@ -669,8 +669,15 @@ static int __init gen_i2c_proc_init(void
|
|
return -ENOMEM;
|
|
return 0;
|
|
}
|
|
+
|
|
+static int gen_i2c_proc_deinit(void)
|
|
+{
|
|
+ remove_proc_entry("driver/i2c-adaptor-register", NULL);
|
|
+ return 0;
|
|
+}
|
|
#else
|
|
static inline int gen_i2c_proc_init(void) { return 0; }
|
|
+static inline int gen_i2c_proc_deinit(void) { return 0; }
|
|
#endif /* CONFIG_PROC_FS */
|
|
|
|
static int __init coldfire_i2c_init(void)
|
|
@@ -687,6 +694,13 @@ static int __init coldfire_i2c_init(void
|
|
|
|
static void __exit coldfire_i2c_exit(void)
|
|
{
|
|
+ int retval;
|
|
+
|
|
+ retval = gen_i2c_proc_deinit();
|
|
+ if (retval < 0)
|
|
+ printk(KERN_INFO "remove /proc/i2c-adaptor-register "
|
|
+ "for i2c master mode failed!\n");
|
|
+
|
|
platform_driver_unregister(&mcf_i2c_driver);
|
|
}
|
|
|