From: "J. German Rivera" <German.Rivera@freescale.com>
To: <gregkh@linuxfoundation.org>, <arnd@arndb.de>,
<devel@driverdev.osuosl.org>, <linux-kernel@vger.kernel.org>
Cc: <stuart.yoder@freescale.com>, <Kim.Phillips@freescale.com>,
<scottwood@freescale.com>, <agraf@suse.de>,
<bhamciu1@freescale.com>, <R89243@freescale.com>,
<bhupesh.sharma@freescale.com>, <nir.erez@freescale.com>,
<richard.schmitt@freescale.com>,
"J. German Rivera" <German.Rivera@freescale.com>
Subject: [PATCH 5/6] staging: fsl-mc: Refactored fsl_mc_object_allocator driver init/exit
Date: Fri, 27 Mar 2015 16:01:08 -0500 [thread overview]
Message-ID: <1427490069-3142-6-git-send-email-German.Rivera@freescale.com> (raw)
In-Reply-To: <1427490069-3142-1-git-send-email-German.Rivera@freescale.com>
The fsl_mc_allocator driver does not need to be its own module
as it is tightly integrated into the MC bus main driver. It is really
just a sub-component of the MC bus driver. By not making fsl_mc_allocator
its own module, we can have more control of when its initialization happens
and we want it to happen before any driver that depends on the MC bus
driver gets initialized.
Signed-off-by: J. German Rivera <German.Rivera@freescale.com>
---
drivers/staging/fsl-mc/bus/Makefile | 12 +++++-------
drivers/staging/fsl-mc/bus/mc-allocator.c | 12 ++++++++----
drivers/staging/fsl-mc/bus/mc-bus.c | 8 ++++++++
drivers/staging/fsl-mc/include/mc-private.h | 4 ++++
4 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/fsl-mc/bus/Makefile b/drivers/staging/fsl-mc/bus/Makefile
index bd09fc8..25433a9 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -5,15 +5,13 @@
#
# This file is released under the GPLv2
#
-obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o \
- mc-allocator-driver.o
+obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
mc-bus-driver-objs := mc-bus.o \
mc-sys.o \
dprc.o \
dpmng.o \
- dprc-driver.o
-
-mc-allocator-driver-objs := mc-allocator.o \
- dpmcp.o \
- dpbp.o
+ dprc-driver.o \
+ mc-allocator.o \
+ dpmcp.o \
+ dpbp.o
diff --git a/drivers/staging/fsl-mc/bus/mc-allocator.c b/drivers/staging/fsl-mc/bus/mc-allocator.c
index cc4a7d3..e36235d 100644
--- a/drivers/staging/fsl-mc/bus/mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/mc-allocator.c
@@ -562,8 +562,12 @@ static struct fsl_mc_driver fsl_mc_allocator_driver = {
.remove = fsl_mc_allocator_remove,
};
-module_fsl_mc_driver(fsl_mc_allocator_driver);
+int __init fsl_mc_allocator_driver_init(void)
+{
+ return fsl_mc_driver_register(&fsl_mc_allocator_driver);
+}
-MODULE_AUTHOR("Freescale Semiconductor Inc.");
-MODULE_DESCRIPTION("Freescale's MC object device allocator");
-MODULE_LICENSE("GPL");
+void __exit fsl_mc_allocator_driver_exit(void)
+{
+ fsl_mc_driver_unregister(&fsl_mc_allocator_driver);
+}
diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c
index d943d99..b347db9 100644
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
@@ -730,8 +730,15 @@ static int __init fsl_mc_bus_driver_init(void)
if (error < 0)
goto error_cleanup_driver;
+ error = fsl_mc_allocator_driver_init();
+ if (error < 0)
+ goto error_cleanup_dprc_driver;
+
return 0;
+error_cleanup_dprc_driver:
+ dprc_driver_exit();
+
error_cleanup_driver:
platform_driver_unregister(&fsl_mc_bus_driver);
@@ -750,6 +757,7 @@ static void __exit fsl_mc_bus_driver_exit(void)
if (WARN_ON(!mc_dev_cache))
return;
+ fsl_mc_allocator_driver_exit();
dprc_driver_exit();
platform_driver_unregister(&fsl_mc_bus_driver);
bus_unregister(&fsl_mc_bus_type);
diff --git a/drivers/staging/fsl-mc/include/mc-private.h b/drivers/staging/fsl-mc/include/mc-private.h
index 8e67075..c045f49 100644
--- a/drivers/staging/fsl-mc/include/mc-private.h
+++ b/drivers/staging/fsl-mc/include/mc-private.h
@@ -102,6 +102,10 @@ int __init dprc_driver_init(void);
void __exit dprc_driver_exit(void);
+int __init fsl_mc_allocator_driver_init(void);
+
+void __exit fsl_mc_allocator_driver_exit(void);
+
int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
enum fsl_mc_pool_type pool_type,
struct fsl_mc_resource
--
2.3.3
next prev parent reply other threads:[~2015-03-27 21:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-27 21:01 [PATCH 0/6] staging: fsl-mc: cleanup and minor corrections J. German Rivera
2015-03-27 21:01 ` [PATCH 1/6] staging: fsl-mc: Name MC object devices using decimal numbers J. German Rivera
2015-03-27 21:01 ` [PATCH 2/6] staging: fsl-mc: Removed reordering of MC objects during bus scan J. German Rivera
2015-03-27 21:01 ` [PATCH 3/6] staging: fsl-mc: Bind/unbind driver when MC object is plugged/unplugged J. German Rivera
2015-03-27 21:01 ` [PATCH 4/6] staging: fsl-mc: Fix crash in fsl_mc_device_remove() J. German Rivera
2015-03-27 21:01 ` J. German Rivera [this message]
2015-03-27 21:01 ` [PATCH 6/6] staging: fsl-mc: Changed version matching rules for MC object drivers J. German Rivera
2015-04-08 23:11 ` Alexander Graf
2015-04-08 23:11 ` [PATCH 0/6] staging: fsl-mc: cleanup and minor corrections Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1427490069-3142-6-git-send-email-German.Rivera@freescale.com \
--to=german.rivera@freescale.com \
--cc=Kim.Phillips@freescale.com \
--cc=R89243@freescale.com \
--cc=agraf@suse.de \
--cc=arnd@arndb.de \
--cc=bhamciu1@freescale.com \
--cc=bhupesh.sharma@freescale.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nir.erez@freescale.com \
--cc=richard.schmitt@freescale.com \
--cc=scottwood@freescale.com \
--cc=stuart.yoder@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®