Commit 9e5ed094 authored by viresh kumar's avatar viresh kumar Committed by Russell King

ARM: 7362/1: AMBA: Add module_amba_driver() helper macro for amba_driver

For simple modules that contain a single amba_driver without any
additional setup code then ends up being a block of duplicated
boilerplate. This patch adds a new macro, module_amba_driver(),
which replaces the module_init()/module_exit() registrations with
template functions.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@st.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent a64ae394
...@@ -107,17 +107,6 @@ static struct amba_driver nmk_rng_driver = { ...@@ -107,17 +107,6 @@ static struct amba_driver nmk_rng_driver = {
.id_table = nmk_rng_ids, .id_table = nmk_rng_ids,
}; };
static int __init nmk_rng_init(void) module_amba_driver(nmk_rng_driver);
{
return amba_driver_register(&nmk_rng_driver);
}
static void __devexit nmk_rng_exit(void)
{
amba_driver_unregister(&nmk_rng_driver);
}
module_init(nmk_rng_init);
module_exit(nmk_rng_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -1035,18 +1035,7 @@ static struct amba_driver pl330_driver = { ...@@ -1035,18 +1035,7 @@ static struct amba_driver pl330_driver = {
.remove = pl330_remove, .remove = pl330_remove,
}; };
static int __init pl330_init(void) module_amba_driver(pl330_driver);
{
return amba_driver_register(&pl330_driver);
}
module_init(pl330_init);
static void __exit pl330_exit(void)
{
amba_driver_unregister(&pl330_driver);
return;
}
module_exit(pl330_exit);
MODULE_AUTHOR("Jaswinder Singh <jassi.brar@samsung.com>"); MODULE_AUTHOR("Jaswinder Singh <jassi.brar@samsung.com>");
MODULE_DESCRIPTION("API Driver for PL330 DMAC"); MODULE_DESCRIPTION("API Driver for PL330 DMAC");
......
...@@ -208,18 +208,7 @@ static struct amba_driver ambakmi_driver = { ...@@ -208,18 +208,7 @@ static struct amba_driver ambakmi_driver = {
.resume = amba_kmi_resume, .resume = amba_kmi_resume,
}; };
static int __init amba_kmi_init(void) module_amba_driver(ambakmi_driver);
{
return amba_driver_register(&ambakmi_driver);
}
static void __exit amba_kmi_exit(void)
{
amba_driver_unregister(&ambakmi_driver);
}
module_init(amba_kmi_init);
module_exit(amba_kmi_exit);
MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>");
MODULE_DESCRIPTION("AMBA KMI controller driver"); MODULE_DESCRIPTION("AMBA KMI controller driver");
......
...@@ -1519,18 +1519,8 @@ static struct amba_driver mmci_driver = { ...@@ -1519,18 +1519,8 @@ static struct amba_driver mmci_driver = {
.id_table = mmci_ids, .id_table = mmci_ids,
}; };
static int __init mmci_init(void) module_amba_driver(mmci_driver);
{
return amba_driver_register(&mmci_driver);
}
static void __exit mmci_exit(void)
{
amba_driver_unregister(&mmci_driver);
}
module_init(mmci_init);
module_exit(mmci_exit);
module_param(fmax, uint, 0444); module_param(fmax, uint, 0444);
MODULE_DESCRIPTION("ARM PrimeCell PL180/181 Multimedia Card Interface driver"); MODULE_DESCRIPTION("ARM PrimeCell PL180/181 Multimedia Card Interface driver");
......
...@@ -185,18 +185,7 @@ static struct amba_driver pl030_driver = { ...@@ -185,18 +185,7 @@ static struct amba_driver pl030_driver = {
.id_table = pl030_ids, .id_table = pl030_ids,
}; };
static int __init pl030_init(void) module_amba_driver(pl030_driver);
{
return amba_driver_register(&pl030_driver);
}
static void __exit pl030_exit(void)
{
amba_driver_unregister(&pl030_driver);
}
module_init(pl030_init);
module_exit(pl030_exit);
MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>");
MODULE_DESCRIPTION("ARM AMBA PL030 RTC Driver"); MODULE_DESCRIPTION("ARM AMBA PL030 RTC Driver");
......
...@@ -431,18 +431,7 @@ static struct amba_driver pl031_driver = { ...@@ -431,18 +431,7 @@ static struct amba_driver pl031_driver = {
.remove = pl031_remove, .remove = pl031_remove,
}; };
static int __init pl031_init(void) module_amba_driver(pl031_driver);
{
return amba_driver_register(&pl031_driver);
}
static void __exit pl031_exit(void)
{
amba_driver_unregister(&pl031_driver);
}
module_init(pl031_init);
module_exit(pl031_exit);
MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net"); MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net");
MODULE_DESCRIPTION("ARM AMBA PL031 RTC Driver"); MODULE_DESCRIPTION("ARM AMBA PL031 RTC Driver");
......
...@@ -370,17 +370,7 @@ static struct amba_driver sp805_wdt_driver = { ...@@ -370,17 +370,7 @@ static struct amba_driver sp805_wdt_driver = {
.remove = __devexit_p(sp805_wdt_remove), .remove = __devexit_p(sp805_wdt_remove),
}; };
static int __init sp805_wdt_init(void) module_amba_driver(sp805_wdt_driver);
{
return amba_driver_register(&sp805_wdt_driver);
}
module_init(sp805_wdt_init);
static void __exit sp805_wdt_exit(void)
{
amba_driver_unregister(&sp805_wdt_driver);
}
module_exit(sp805_wdt_exit);
module_param(nowayout, int, 0); module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, MODULE_PARM_DESC(nowayout,
......
...@@ -125,4 +125,13 @@ struct amba_device name##_device = { \ ...@@ -125,4 +125,13 @@ struct amba_device name##_device = { \
.periphid = id, \ .periphid = id, \
} }
/*
* module_amba_driver() - Helper macro for drivers that don't do anything
* special in module init/exit. This eliminates a lot of boilerplate. Each
* module may only use this macro once, and calling it replaces module_init()
* and module_exit()
*/
#define module_amba_driver(__amba_drv) \
module_driver(__amba_drv, amba_driver_register, amba_driver_unregister)
#endif #endif
...@@ -1110,18 +1110,7 @@ static struct amba_driver aaci_driver = { ...@@ -1110,18 +1110,7 @@ static struct amba_driver aaci_driver = {
.id_table = aaci_ids, .id_table = aaci_ids,
}; };
static int __init aaci_init(void) module_amba_driver(aaci_driver);
{
return amba_driver_register(&aaci_driver);
}
static void __exit aaci_exit(void)
{
amba_driver_unregister(&aaci_driver);
}
module_init(aaci_init);
module_exit(aaci_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("ARM PrimeCell PL041 Advanced Audio CODEC Interface driver"); MODULE_DESCRIPTION("ARM PrimeCell PL041 Advanced Audio CODEC Interface driver");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment