Prechádzať zdrojové kódy

PCMCIA: soc_common: convert to a stand alone module

Convert soc_common.c to be a stand alone module, rather than wrapping
it up into the individual SoC specific base modules.  In doing this,
we need to add init/exit functions for soc_common to register/remove
the cpufreq notifier.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Russell King - ARM Linux 16 rokov pred
rodič
commit
0f767de6a2

+ 6 - 0
drivers/pcmcia/Kconfig

@@ -178,9 +178,13 @@ config PCMCIA_BCM63XX
 	tristate "bcm63xx pcmcia support"
 	tristate "bcm63xx pcmcia support"
 	depends on BCM63XX && PCMCIA
 	depends on BCM63XX && PCMCIA
 
 
+config PCMCIA_SOC_COMMON
+	bool
+
 config PCMCIA_SA1100
 config PCMCIA_SA1100
 	tristate "SA1100 support"
 	tristate "SA1100 support"
 	depends on ARM && ARCH_SA1100 && PCMCIA
 	depends on ARM && ARCH_SA1100 && PCMCIA
+	select PCMCIA_SOC_COMMON
 	help
 	help
 	  Say Y here to include support for SA11x0-based PCMCIA or CF
 	  Say Y here to include support for SA11x0-based PCMCIA or CF
 	  sockets, found on HP iPAQs, Yopy, and other StrongARM(R)/
 	  sockets, found on HP iPAQs, Yopy, and other StrongARM(R)/
@@ -191,6 +195,7 @@ config PCMCIA_SA1100
 config PCMCIA_SA1111
 config PCMCIA_SA1111
 	tristate "SA1111 support"
 	tristate "SA1111 support"
 	depends on ARM && ARCH_SA1100 && SA1111 && PCMCIA
 	depends on ARM && ARCH_SA1100 && SA1111 && PCMCIA
+	select PCMCIA_SOC_COMMON
 	help
 	help
 	  Say Y  here to include support for SA1111-based PCMCIA or CF
 	  Say Y  here to include support for SA1111-based PCMCIA or CF
 	  sockets, found on the Jornada 720, Graphicsmaster and other
 	  sockets, found on the Jornada 720, Graphicsmaster and other
@@ -204,6 +209,7 @@ config PCMCIA_PXA2XX
 	depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
 	depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \
 		    || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
 		    || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \
 		    || ARCH_VIPER || ARCH_PXA_ESERIES || MACH_STARGATE2)
 		    || ARCH_VIPER || ARCH_PXA_ESERIES || MACH_STARGATE2)
+	select PCMCIA_SOC_COMMON
 	help
 	help
 	  Say Y here to include support for the PXA2xx PCMCIA controller
 	  Say Y here to include support for the PXA2xx PCMCIA controller
 
 

+ 4 - 6
drivers/pcmcia/Makefile

@@ -22,8 +22,9 @@ obj-$(CONFIG_I82365)				+= i82365.o
 obj-$(CONFIG_I82092)				+= i82092.o
 obj-$(CONFIG_I82092)				+= i82092.o
 obj-$(CONFIG_TCIC)				+= tcic.o
 obj-$(CONFIG_TCIC)				+= tcic.o
 obj-$(CONFIG_PCMCIA_M8XX)			+= m8xx_pcmcia.o
 obj-$(CONFIG_PCMCIA_M8XX)			+= m8xx_pcmcia.o
-obj-$(CONFIG_PCMCIA_SA1100)			+= sa11xx_core.o sa1100_cs.o
-obj-$(CONFIG_PCMCIA_SA1111)			+= sa11xx_core.o sa1111_cs.o
+obj-$(CONFIG_PCMCIA_SOC_COMMON)			+= soc_common.o
+obj-$(CONFIG_PCMCIA_SA1100)			+= sa11xx_base.o sa1100_cs.o
+obj-$(CONFIG_PCMCIA_SA1111)			+= sa11xx_base.o sa1111_cs.o
 obj-$(CONFIG_M32R_PCC)				+= m32r_pcc.o
 obj-$(CONFIG_M32R_PCC)				+= m32r_pcc.o
 obj-$(CONFIG_M32R_CFC)				+= m32r_cfc.o
 obj-$(CONFIG_M32R_CFC)				+= m32r_cfc.o
 obj-$(CONFIG_PCMCIA_AU1X00)			+= au1x00_ss.o
 obj-$(CONFIG_PCMCIA_AU1X00)			+= au1x00_ss.o
@@ -35,9 +36,6 @@ obj-$(CONFIG_BFIN_CFPCMCIA)			+= bfin_cf_pcmcia.o
 obj-$(CONFIG_AT91_CF)				+= at91_cf.o
 obj-$(CONFIG_AT91_CF)				+= at91_cf.o
 obj-$(CONFIG_ELECTRA_CF)			+= electra_cf.o
 obj-$(CONFIG_ELECTRA_CF)			+= electra_cf.o
 
 
-sa11xx_core-y					+= soc_common.o sa11xx_base.o
-pxa2xx_core-y					+= soc_common.o pxa2xx_base.o
-
 au1x00_ss-y					+= au1000_generic.o
 au1x00_ss-y					+= au1000_generic.o
 au1x00_ss-$(CONFIG_MIPS_PB1000)			+= au1000_pb1x00.o
 au1x00_ss-$(CONFIG_MIPS_PB1000)			+= au1000_pb1x00.o
 au1x00_ss-$(CONFIG_MIPS_PB1100)			+= au1000_pb1x00.o
 au1x00_ss-$(CONFIG_MIPS_PB1100)			+= au1000_pb1x00.o
@@ -77,4 +75,4 @@ pxa2xx-obj-$(CONFIG_MACH_PALMLD)		+= pxa2xx_palmld.o
 pxa2xx-obj-$(CONFIG_MACH_E740)			+= pxa2xx_e740.o
 pxa2xx-obj-$(CONFIG_MACH_E740)			+= pxa2xx_e740.o
 pxa2xx-obj-$(CONFIG_MACH_STARGATE2)		+= pxa2xx_stargate2.o
 pxa2xx-obj-$(CONFIG_MACH_STARGATE2)		+= pxa2xx_stargate2.o
 
 
-obj-$(CONFIG_PCMCIA_PXA2XX)			+= pxa2xx_core.o $(pxa2xx-obj-y)
+obj-$(CONFIG_PCMCIA_PXA2XX)			+= pxa2xx_base.o $(pxa2xx-obj-y)

+ 7 - 9
drivers/pcmcia/soc_common.c

@@ -609,15 +609,14 @@ static int soc_pcmcia_cpufreq_register(void)
 				"notifier for PCMCIA (%d)\n", ret);
 				"notifier for PCMCIA (%d)\n", ret);
 	return ret;
 	return ret;
 }
 }
+fs_initcall(soc_pcmcia_cpufreq_register);
 
 
 static void soc_pcmcia_cpufreq_unregister(void)
 static void soc_pcmcia_cpufreq_unregister(void)
 {
 {
 	cpufreq_unregister_notifier(&soc_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
 	cpufreq_unregister_notifier(&soc_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
 }
 }
+module_exit(soc_pcmcia_cpufreq_unregister);
 
 
-#else
-static int soc_pcmcia_cpufreq_register(void) { return 0; }
-static void soc_pcmcia_cpufreq_unregister(void) {}
 #endif
 #endif
 
 
 int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
 int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
@@ -668,9 +667,6 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops
 			goto out_err_5;
 			goto out_err_5;
 		}
 		}
 
 
-		if (list_empty(&soc_pcmcia_sockets))
-			soc_pcmcia_cpufreq_register();
-
 		list_add(&skt->node, &soc_pcmcia_sockets);
 		list_add(&skt->node, &soc_pcmcia_sockets);
 
 
 		/*
 		/*
@@ -743,6 +739,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops
 	mutex_unlock(&soc_pcmcia_sockets_lock);
 	mutex_unlock(&soc_pcmcia_sockets_lock);
 	return ret;
 	return ret;
 }
 }
+EXPORT_SYMBOL(soc_common_drv_pcmcia_probe);
 
 
 int soc_common_drv_pcmcia_remove(struct device *dev)
 int soc_common_drv_pcmcia_remove(struct device *dev)
 {
 {
@@ -773,9 +770,6 @@ int soc_common_drv_pcmcia_remove(struct device *dev)
 		release_resource(&skt->res_io);
 		release_resource(&skt->res_io);
 		release_resource(&skt->res_skt);
 		release_resource(&skt->res_skt);
 	}
 	}
-	if (list_empty(&soc_pcmcia_sockets))
-		soc_pcmcia_cpufreq_unregister();
-
 	mutex_unlock(&soc_pcmcia_sockets_lock);
 	mutex_unlock(&soc_pcmcia_sockets_lock);
 
 
 	kfree(sinfo);
 	kfree(sinfo);
@@ -783,3 +777,7 @@ int soc_common_drv_pcmcia_remove(struct device *dev)
 	return 0;
 	return 0;
 }
 }
 EXPORT_SYMBOL(soc_common_drv_pcmcia_remove);
 EXPORT_SYMBOL(soc_common_drv_pcmcia_remove);
+
+MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>");
+MODULE_DESCRIPTION("Linux PCMCIA Card Services: Common SoC support");
+MODULE_LICENSE("Dual MPL/GPL");