Re: [PATCH v3 1/2] cpufreq: tegra: Call tegra_cpufreq_init() specifically in machine code
On 12/17/2013 02:31 PM, Viresh Kumar wrote: On 5 December 2013 13:14, Bill Huang wrote: Move the call from module_init to Tegra machine codes so it won't be called in a multi-platform kernel running on non-Tegra SoCs. Signed-off-by: Bill Huang --- arch/arm/mach-tegra/tegra.c |2 ++ drivers/cpufreq/tegra-cpufreq.c | 13 ++--- include/linux/tegra-soc.h | 11 ++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c index 7336817..14490ad 100644 --- a/arch/arm/mach-tegra/tegra.c +++ b/arch/arm/mach-tegra/tegra.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -160,6 +161,7 @@ static void __init tegra_dt_init_late(void) { int i; + tegra_cpufreq_init(); tegra_init_suspend(); tegra_cpuidle_init(); tegra_powergate_debugfs_init(); diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c index 63f0059..ae1c0f1 100644 --- a/drivers/cpufreq/tegra-cpufreq.c +++ b/drivers/cpufreq/tegra-cpufreq.c @@ -155,7 +155,7 @@ static struct cpufreq_driver tegra_cpufreq_driver = { #endif }; Remove module.h as well ?? -static int __init tegra_cpufreq_init(void) +int __init tegra_cpufreq_init(void) { cpu_clk = clk_get_sys(NULL, "cclk"); if (IS_ERR(cpu_clk)) @@ -177,17 +177,8 @@ static int __init tegra_cpufreq_init(void) return cpufreq_register_driver(_cpufreq_driver); } - -static void __exit tegra_cpufreq_exit(void) -{ -cpufreq_unregister_driver(_cpufreq_driver); - clk_put(emc_clk); - clk_put(cpu_clk); -} - +EXPORT_SYMBOL(tegra_cpufreq_init); MODULE_AUTHOR("Colin Cross "); MODULE_DESCRIPTION("cpufreq driver for Nvidia Tegra2"); MODULE_LICENSE("GPL"); Remove these as well? As they don't have a meaning for Tegra cpufreq driver which can't be compiled as module. OK thanks. -module_init(tegra_cpufreq_init); -module_exit(tegra_cpufreq_exit); Rest as what Stephen suggested. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 1/2] cpufreq: tegra: Call tegra_cpufreq_init() specifically in machine code
On 12/17/2013 02:31 PM, Viresh Kumar wrote: On 5 December 2013 13:14, Bill Huang bilhu...@nvidia.com wrote: Move the call from module_init to Tegra machine codes so it won't be called in a multi-platform kernel running on non-Tegra SoCs. Signed-off-by: Bill Huang bilhu...@nvidia.com --- arch/arm/mach-tegra/tegra.c |2 ++ drivers/cpufreq/tegra-cpufreq.c | 13 ++--- include/linux/tegra-soc.h | 11 ++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c index 7336817..14490ad 100644 --- a/arch/arm/mach-tegra/tegra.c +++ b/arch/arm/mach-tegra/tegra.c @@ -34,6 +34,7 @@ #include linux/usb/tegra_usb_phy.h #include linux/clk/tegra.h #include linux/irqchip.h +#include linux/tegra-soc.h #include asm/hardware/cache-l2x0.h #include asm/mach-types.h @@ -160,6 +161,7 @@ static void __init tegra_dt_init_late(void) { int i; + tegra_cpufreq_init(); tegra_init_suspend(); tegra_cpuidle_init(); tegra_powergate_debugfs_init(); diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c index 63f0059..ae1c0f1 100644 --- a/drivers/cpufreq/tegra-cpufreq.c +++ b/drivers/cpufreq/tegra-cpufreq.c @@ -155,7 +155,7 @@ static struct cpufreq_driver tegra_cpufreq_driver = { #endif }; Remove module.h as well ?? -static int __init tegra_cpufreq_init(void) +int __init tegra_cpufreq_init(void) { cpu_clk = clk_get_sys(NULL, cclk); if (IS_ERR(cpu_clk)) @@ -177,17 +177,8 @@ static int __init tegra_cpufreq_init(void) return cpufreq_register_driver(tegra_cpufreq_driver); } - -static void __exit tegra_cpufreq_exit(void) -{ -cpufreq_unregister_driver(tegra_cpufreq_driver); - clk_put(emc_clk); - clk_put(cpu_clk); -} - +EXPORT_SYMBOL(tegra_cpufreq_init); MODULE_AUTHOR(Colin Cross ccr...@android.com); MODULE_DESCRIPTION(cpufreq driver for Nvidia Tegra2); MODULE_LICENSE(GPL); Remove these as well? As they don't have a meaning for Tegra cpufreq driver which can't be compiled as module. OK thanks. -module_init(tegra_cpufreq_init); -module_exit(tegra_cpufreq_exit); Rest as what Stephen suggested. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 1/2] cpufreq: tegra: Call tegra_cpufreq_init() specifically in machine code
On 5 December 2013 13:14, Bill Huang wrote: > Move the call from module_init to Tegra machine codes so it won't be > called in a multi-platform kernel running on non-Tegra SoCs. > > Signed-off-by: Bill Huang > --- > arch/arm/mach-tegra/tegra.c |2 ++ > drivers/cpufreq/tegra-cpufreq.c | 13 ++--- > include/linux/tegra-soc.h | 11 ++- > 3 files changed, 14 insertions(+), 12 deletions(-) > > diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c > index 7336817..14490ad 100644 > --- a/arch/arm/mach-tegra/tegra.c > +++ b/arch/arm/mach-tegra/tegra.c > @@ -34,6 +34,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -160,6 +161,7 @@ static void __init tegra_dt_init_late(void) > { > int i; > > + tegra_cpufreq_init(); > tegra_init_suspend(); > tegra_cpuidle_init(); > tegra_powergate_debugfs_init(); > diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c > index 63f0059..ae1c0f1 100644 > --- a/drivers/cpufreq/tegra-cpufreq.c > +++ b/drivers/cpufreq/tegra-cpufreq.c > @@ -155,7 +155,7 @@ static struct cpufreq_driver tegra_cpufreq_driver = { > #endif > }; Remove module.h as well ?? > -static int __init tegra_cpufreq_init(void) > +int __init tegra_cpufreq_init(void) > { > cpu_clk = clk_get_sys(NULL, "cclk"); > if (IS_ERR(cpu_clk)) > @@ -177,17 +177,8 @@ static int __init tegra_cpufreq_init(void) > > return cpufreq_register_driver(_cpufreq_driver); > } > - > -static void __exit tegra_cpufreq_exit(void) > -{ > -cpufreq_unregister_driver(_cpufreq_driver); > - clk_put(emc_clk); > - clk_put(cpu_clk); > -} > - > +EXPORT_SYMBOL(tegra_cpufreq_init); > > MODULE_AUTHOR("Colin Cross "); > MODULE_DESCRIPTION("cpufreq driver for Nvidia Tegra2"); > MODULE_LICENSE("GPL"); Remove these as well? As they don't have a meaning for Tegra cpufreq driver which can't be compiled as module. > -module_init(tegra_cpufreq_init); > -module_exit(tegra_cpufreq_exit); Rest as what Stephen suggested. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 1/2] cpufreq: tegra: Call tegra_cpufreq_init() specifically in machine code
On 5 December 2013 13:14, Bill Huang bilhu...@nvidia.com wrote: Move the call from module_init to Tegra machine codes so it won't be called in a multi-platform kernel running on non-Tegra SoCs. Signed-off-by: Bill Huang bilhu...@nvidia.com --- arch/arm/mach-tegra/tegra.c |2 ++ drivers/cpufreq/tegra-cpufreq.c | 13 ++--- include/linux/tegra-soc.h | 11 ++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c index 7336817..14490ad 100644 --- a/arch/arm/mach-tegra/tegra.c +++ b/arch/arm/mach-tegra/tegra.c @@ -34,6 +34,7 @@ #include linux/usb/tegra_usb_phy.h #include linux/clk/tegra.h #include linux/irqchip.h +#include linux/tegra-soc.h #include asm/hardware/cache-l2x0.h #include asm/mach-types.h @@ -160,6 +161,7 @@ static void __init tegra_dt_init_late(void) { int i; + tegra_cpufreq_init(); tegra_init_suspend(); tegra_cpuidle_init(); tegra_powergate_debugfs_init(); diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c index 63f0059..ae1c0f1 100644 --- a/drivers/cpufreq/tegra-cpufreq.c +++ b/drivers/cpufreq/tegra-cpufreq.c @@ -155,7 +155,7 @@ static struct cpufreq_driver tegra_cpufreq_driver = { #endif }; Remove module.h as well ?? -static int __init tegra_cpufreq_init(void) +int __init tegra_cpufreq_init(void) { cpu_clk = clk_get_sys(NULL, cclk); if (IS_ERR(cpu_clk)) @@ -177,17 +177,8 @@ static int __init tegra_cpufreq_init(void) return cpufreq_register_driver(tegra_cpufreq_driver); } - -static void __exit tegra_cpufreq_exit(void) -{ -cpufreq_unregister_driver(tegra_cpufreq_driver); - clk_put(emc_clk); - clk_put(cpu_clk); -} - +EXPORT_SYMBOL(tegra_cpufreq_init); MODULE_AUTHOR(Colin Cross ccr...@android.com); MODULE_DESCRIPTION(cpufreq driver for Nvidia Tegra2); MODULE_LICENSE(GPL); Remove these as well? As they don't have a meaning for Tegra cpufreq driver which can't be compiled as module. -module_init(tegra_cpufreq_init); -module_exit(tegra_cpufreq_exit); Rest as what Stephen suggested. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 1/2] cpufreq: tegra: Call tegra_cpufreq_init() specifically in machine code
On 12/06/2013 06:54 AM, Stephen Warren wrote: On 12/05/2013 12:44 AM, Bill Huang wrote: Move the call from module_init to Tegra machine codes so it won't be called in a multi-platform kernel running on non-Tegra SoCs. diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h It might be better to create for the interface to the cpufreq driver; tegra-soc.h is for the interface to core Tegra code *from* other drivers. Thanks, will do. +#ifdef CONFIG_ARM_TEGRA_CPUFREQ +int tegra_cpufreq_init(void); +#else +static inline int tegra_cpufreq_init(void) +{ + return -EINVAL; +} +#endif Probably best to "return 0" from the !CONFIG_ARM_TEGRA_CPUFREQ case; the whole point is to isolate callers from having to care whether CONFIG_ARM_TEGRA_CPUFREQ is enabled, and making the function act like it worked OK is part of that isolation. OK thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 1/2] cpufreq: tegra: Call tegra_cpufreq_init() specifically in machine code
On 12/06/2013 06:54 AM, Stephen Warren wrote: On 12/05/2013 12:44 AM, Bill Huang wrote: Move the call from module_init to Tegra machine codes so it won't be called in a multi-platform kernel running on non-Tegra SoCs. diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h It might be better to create linux/tegra-cpufreq.h for the interface to the cpufreq driver; tegra-soc.h is for the interface to core Tegra code *from* other drivers. Thanks, will do. +#ifdef CONFIG_ARM_TEGRA_CPUFREQ +int tegra_cpufreq_init(void); +#else +static inline int tegra_cpufreq_init(void) +{ + return -EINVAL; +} +#endif Probably best to return 0 from the !CONFIG_ARM_TEGRA_CPUFREQ case; the whole point is to isolate callers from having to care whether CONFIG_ARM_TEGRA_CPUFREQ is enabled, and making the function act like it worked OK is part of that isolation. OK thanks. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 1/2] cpufreq: tegra: Call tegra_cpufreq_init() specifically in machine code
On 12/05/2013 12:44 AM, Bill Huang wrote: > Move the call from module_init to Tegra machine codes so it won't be > called in a multi-platform kernel running on non-Tegra SoCs. > diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h It might be better to create for the interface to the cpufreq driver; tegra-soc.h is for the interface to core Tegra code *from* other drivers. > +#ifdef CONFIG_ARM_TEGRA_CPUFREQ > +int tegra_cpufreq_init(void); > +#else > +static inline int tegra_cpufreq_init(void) > +{ > + return -EINVAL; > +} > +#endif Probably best to "return 0" from the !CONFIG_ARM_TEGRA_CPUFREQ case; the whole point is to isolate callers from having to care whether CONFIG_ARM_TEGRA_CPUFREQ is enabled, and making the function act like it worked OK is part of that isolation. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 1/2] cpufreq: tegra: Call tegra_cpufreq_init() specifically in machine code
On 12/05/2013 12:44 AM, Bill Huang wrote: Move the call from module_init to Tegra machine codes so it won't be called in a multi-platform kernel running on non-Tegra SoCs. diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h It might be better to create linux/tegra-cpufreq.h for the interface to the cpufreq driver; tegra-soc.h is for the interface to core Tegra code *from* other drivers. +#ifdef CONFIG_ARM_TEGRA_CPUFREQ +int tegra_cpufreq_init(void); +#else +static inline int tegra_cpufreq_init(void) +{ + return -EINVAL; +} +#endif Probably best to return 0 from the !CONFIG_ARM_TEGRA_CPUFREQ case; the whole point is to isolate callers from having to care whether CONFIG_ARM_TEGRA_CPUFREQ is enabled, and making the function act like it worked OK is part of that isolation. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/