Skip to contentSkip to conversation

OMAP2/3: mmc-twl4030: Free up MMC regulators while cleaning up

PATCH In review Roger Quadros 2 participants 4 messages Jun 23, 2009 – Aug 6, 2009

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

PATCH 1/1 OMAP2/3: mmc-twl4030: Free up MMC regulators while cleaning up

twl_mmc_cleanup() must free up the regulators that were allocated by twl_mmc_late_init().
This eliminates the below error when 'omap_hsmmc' module is repeatedly loaded and unloaded.

"sysfs: cannot create duplicate filename '/devices/platform
/mmci-omap-hs.0/microamps_requested_vmmc'"

---
 arch/arm/mach-omap2/mmc-twl4030.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +6 -0
index 06b252f..0007115 100644
@@ -119,6 +119,7 @@ static int twl_mmc_late_init(struct device *dev)
 				if (i != 0)
 					break;
 				ret = PTR_ERR(reg);
+				hsmmc[i].vcc = NULL;
 				goto err;
 			}
 			hsmmc[i].vcc = reg;
@@ -165,8 +166,13 @@ done:
 static void twl_mmc_cleanup(struct device *dev)
 {
 	struct omap_mmc_platform_data *mmc = dev->platform_data;
+	int i;
 
 	gpio_free(mmc->slots[0].switch_pin);
+	for(i = 0; i < ARRAY_SIZE(hsmmc); i++) {
+		regulator_put(hsmmc[i].vcc);
+		regulator_put(hsmmc[i].vcc_aux);
+	}
 }
 
 #ifdef CONFIG_PM
Signature · 1 line
1.6.0.4
#1 lore raw

Tony,

any comments on this?

regards,
-roger

Quoted 39 lines · ext Roger Quadros

twl_mmc_cleanup() must free up the regulators that were allocated by twl_mmc_late_init().
This eliminates the below error when 'omap_hsmmc' module is repeatedly loaded and unloaded.

"sysfs: cannot create duplicate filename '/devices/platform
/mmci-omap-hs.0/microamps_requested_vmmc'"

---
 arch/arm/mach-omap2/mmc-twl4030.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +6 -0
index 06b252f..0007115 100644
@@ -119,6 +119,7 @@ static int twl_mmc_late_init(struct device *dev)
 				if (i != 0)
 					break;
 				ret = PTR_ERR(reg);
+				hsmmc[i].vcc = NULL;
 				goto err;
 			}
 			hsmmc[i].vcc = reg;
@@ -165,8 +166,13 @@ done:
 static void twl_mmc_cleanup(struct device *dev)
 {
 	struct omap_mmc_platform_data *mmc = dev->platform_data;
+	int i;
 
 	gpio_free(mmc->slots[0].switch_pin);
+	for(i = 0; i < ARRAY_SIZE(hsmmc); i++) {
+		regulator_put(hsmmc[i].vcc);
+		regulator_put(hsmmc[i].vcc_aux);
+	}
 }
 
 #ifdef CONFIG_PM
maintainer
#2 lore raw
Quoted 3 lines · Roger Quadros

Tony,

any comments on this?

Thanks for pinging me, will add it to my omap-fixes queue.

Tony

Quoted 42 lines

regards,
-roger

Quoted 37 lines · ext Roger Quadros

twl_mmc_cleanup() must free up the regulators that were allocated by twl_mmc_late_init().
This eliminates the below error when 'omap_hsmmc' module is repeatedly loaded and unloaded.

"sysfs: cannot create duplicate filename '/devices/platform
/mmci-omap-hs.0/microamps_requested_vmmc'"

---
 arch/arm/mach-omap2/mmc-twl4030.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +6 -0
index 06b252f..0007115 100644
@@ -119,6 +119,7 @@ static int twl_mmc_late_init(struct device *dev)
 				if (i != 0)
 					break;
 				ret = PTR_ERR(reg);
+				hsmmc[i].vcc = NULL;
 				goto err;
 			}
 			hsmmc[i].vcc = reg;
@@ -165,8 +166,13 @@ done:
 static void twl_mmc_cleanup(struct device *dev)
 {
 	struct omap_mmc_platform_data *mmc = dev->platform_data;
+	int i;
  	gpio_free(mmc->slots[0].switch_pin);
+	for(i = 0; i < ARRAY_SIZE(hsmmc); i++) {
+		regulator_put(hsmmc[i].vcc);
+		regulator_put(hsmmc[i].vcc_aux);
+	}
 }
  #ifdef CONFIG_PM
maintainer
#3 lore raw

PATCH 1/1 OMAP2/3: mmc-twl4030: Free up MMC regulators while cleaning

In reply to Roger Quadros

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: omap-fixes

Initial commit ID (Likely to change): 8b28d125dcfa4a250a897baa2425d1f30dd56219

PatchWorks
http://patchwork.kernel.org/patch/31970/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=8b28d125dcfa4a250a897baa2425d1f30dd56219