summaryrefslogtreecommitdiffstats
path: root/drivers/staging/fsl-mc/bus/mc-allocator.c
diff options
context:
space:
mode:
authorJ. German Rivera <German.Rivera@freescale.com>2015-10-17 11:18:15 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-17 20:53:38 -0700
commitd2f8499153aa78b21881b3ca1fcdc026c3a79079 (patch)
tree0e93d6a8bb38e20655fef65642b49a50dc58ce38 /drivers/staging/fsl-mc/bus/mc-allocator.c
parentffcd52ef0907f56181a28f4ae5ab6f0b39e3cf58 (diff)
downloadop-kernel-dev-d2f8499153aa78b21881b3ca1fcdc026c3a79079.zip
op-kernel-dev-d2f8499153aa78b21881b3ca1fcdc026c3a79079.tar.gz
staging: fsl-mc: dpmcp opening/closing refactoring
Before, we were opening and closing a mc_io's dpmcp object in fsl_mc_portal_reset(), since that was the only function that was calling dpmcp MC operations. However, it is better for maintainability to open the dpmcp object when it gets associated with an mc_io object, and close it when this association is terminated. This way, we are free to call dpmcp operations on a mc_io's dpmcp object at any time, without having to check if the dpmcp object is opened or not. Consequently, the creation/teardown of the association between an mc_io object and a dpmcp is now encapsulated in two functions: fsl_mc_io_set_dpmcp()/fsl_mc_io_unset_dpmcp(). Besides, setting the corresponding pointers for the association, these functions open and close the dpmcp object respectively. Signed-off-by: J. German Rivera <German.Rivera@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fsl-mc/bus/mc-allocator.c')
-rw-r--r--drivers/staging/fsl-mc/bus/mc-allocator.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/drivers/staging/fsl-mc/bus/mc-allocator.c b/drivers/staging/fsl-mc/bus/mc-allocator.c
index c3222c6..33f5de4 100644
--- a/drivers/staging/fsl-mc/bus/mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/mc-allocator.c
@@ -373,30 +373,17 @@ EXPORT_SYMBOL_GPL(fsl_mc_portal_free);
int fsl_mc_portal_reset(struct fsl_mc_io *mc_io)
{
int error;
- u16 token;
struct fsl_mc_device *dpmcp_dev = mc_io->dpmcp_dev;
if (WARN_ON(!dpmcp_dev))
return -EINVAL;
- error = dpmcp_open(mc_io, 0, dpmcp_dev->obj_desc.id, &token);
- if (error < 0) {
- dev_err(&dpmcp_dev->dev, "dpmcp_open() failed: %d\n", error);
- return error;
- }
-
- error = dpmcp_reset(mc_io, 0, token);
+ error = dpmcp_reset(mc_io, 0, dpmcp_dev->mc_handle);
if (error < 0) {
dev_err(&dpmcp_dev->dev, "dpmcp_reset() failed: %d\n", error);
return error;
}
- error = dpmcp_close(mc_io, 0, token);
- if (error < 0) {
- dev_err(&dpmcp_dev->dev, "dpmcp_close() failed: %d\n", error);
- return error;
- }
-
return 0;
}
EXPORT_SYMBOL_GPL(fsl_mc_portal_reset);
OpenPOWER on IntegriCloud