From: Ivan Gomez Castellanos <ivan.gomez@ti.com>
To: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, gregkh@suse.de
Cc: Hiroshi.DOYU@nokia.com, ameya.palande@nokia.com,
felipe.contreras@nokia.com, omar.ramirez@ti.com, ohad@wizery.com,
rene.sapiens@ti.com, nm@ti.com, ernesto@ti.com, x0095078@ti.com,
Ivan Gomez Castellanos <ivan.gomez@ti.com>
Subject: [PATCH 09/11] staging: tidspbridge: Remove cfg_set_object()
Date: Wed, 25 Aug 2010 17:09:02 -0500 [thread overview]
Message-ID: <1282774144-11628-10-git-send-email-ivan.gomez@ti.com> (raw)
In-Reply-To: <1282774144-11628-1-git-send-email-ivan.gomez@ti.com>
As the services directory is going to be removed, the cfg_set_object
function has also to be removed.
Since the driver object handle is retrieved from the drv_data structure,
then the word "Registry" is replaced by "driver data" in the comments.
Signed-off-by: Ivan Gomez Castellanos <ivan.gomez@ti.com>
---
.../staging/tidspbridge/include/dspbridge/cfg.h | 17 -----------
drivers/staging/tidspbridge/rmgr/drv.c | 24 +++++++++++++---
drivers/staging/tidspbridge/rmgr/mgr.c | 20 +++++++++++--
drivers/staging/tidspbridge/services/cfg.c | 29 --------------------
4 files changed, 36 insertions(+), 54 deletions(-)
diff --git a/drivers/staging/tidspbridge/include/dspbridge/cfg.h b/drivers/staging/tidspbridge/include/dspbridge/cfg.h
index e1ae1bc..238215b 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/cfg.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/cfg.h
@@ -78,21 +78,4 @@ extern void cfg_get_perf_value(bool *enable_perf);
extern int cfg_get_zl_file(struct cfg_devnode *dev_node_obj,
u32 buf_size, char *str_zl_file_name);
-/*
- * ======== CFG_SetDrvObject ========
- * Purpose:
- * Store the Driver Object handle.
- * Parameters:
- * value: Arbitrary value to store.
- * dw_type Type of Object to Store
- * Returns:
- * 0: Success.
- * -EPERM: Internal Error.
- * Requires:
- * CFG initialized.
- * Ensures:
- * 0: The Private u32 was successfully set.
- */
-extern int cfg_set_object(u32 value, u8 dw_type);
-
#endif /* CFG_ */
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c
index fc1f49b..519053f 100644
--- a/drivers/staging/tidspbridge/rmgr/drv.c
+++ b/drivers/staging/tidspbridge/rmgr/drv.c
@@ -309,6 +309,7 @@ int drv_create(struct drv_object **drv_obj)
{
int status = 0;
struct drv_object *pdrv_object = NULL;
+ struct drv_data *drv_datap = dev_get_drvdata(bridge);
DBC_REQUIRE(drv_obj != NULL);
DBC_REQUIRE(refs > 0);
@@ -335,9 +336,16 @@ int drv_create(struct drv_object **drv_obj)
} else {
status = -ENOMEM;
}
- /* Store the DRV Object in the Registry */
- if (!status)
- status = cfg_set_object((u32) pdrv_object, REG_DRV_OBJECT);
+ /* Store the DRV Object in the driver data */
+ if (!status) {
+ if (drv_datap) {
+ drv_datap->drv_object = (void *)pdrv_object;
+ } else {
+ status = -EPERM;
+ pr_err("%s: Failed to store DRV object\n", __func__);
+ }
+ }
+
if (!status) {
*drv_obj = pdrv_object;
} else {
@@ -374,6 +382,7 @@ int drv_destroy(struct drv_object *driver_obj)
{
int status = 0;
struct drv_object *pdrv_object = (struct drv_object *)driver_obj;
+ struct drv_data *drv_datap = dev_get_drvdata(bridge);
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(pdrv_object);
@@ -386,8 +395,13 @@ int drv_destroy(struct drv_object *driver_obj)
kfree(pdrv_object->dev_list);
kfree(pdrv_object->dev_node_string);
kfree(pdrv_object);
- /* Update the DRV Object in Registry to be 0 */
- (void)cfg_set_object(0, REG_DRV_OBJECT);
+ /* Update the DRV Object in the driver data */
+ if (drv_datap) {
+ drv_datap->drv_object = NULL;
+ } else {
+ status = -EPERM;
+ pr_err("%s: Failed to store DRV object\n", __func__);
+ }
return status;
}
diff --git a/drivers/staging/tidspbridge/rmgr/mgr.c b/drivers/staging/tidspbridge/rmgr/mgr.c
index c6131c4..48702bb 100644
--- a/drivers/staging/tidspbridge/rmgr/mgr.c
+++ b/drivers/staging/tidspbridge/rmgr/mgr.c
@@ -58,6 +58,7 @@ int mgr_create(struct mgr_object **mgr_obj,
{
int status = 0;
struct mgr_object *pmgr_obj = NULL;
+ struct drv_data *drv_datap = dev_get_drvdata(bridge);
DBC_REQUIRE(mgr_obj != NULL);
DBC_REQUIRE(refs > 0);
@@ -67,7 +68,14 @@ int mgr_create(struct mgr_object **mgr_obj,
status = dcd_create_manager(ZLDLLNAME, &pmgr_obj->hdcd_mgr);
if (!status) {
/* If succeeded store the handle in the MGR Object */
- status = cfg_set_object((u32) pmgr_obj, REG_MGR_OBJECT);
+ if (drv_datap) {
+ drv_datap->mgr_object = (void *)pmgr_obj;
+ } else {
+ status = -EPERM;
+ pr_err("%s: Failed to store MGR object\n",
+ __func__);
+ }
+
if (!status) {
*mgr_obj = pmgr_obj;
} else {
@@ -94,6 +102,7 @@ int mgr_destroy(struct mgr_object *hmgr_obj)
{
int status = 0;
struct mgr_object *pmgr_obj = (struct mgr_object *)hmgr_obj;
+ struct drv_data *drv_datap = dev_get_drvdata(bridge);
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(hmgr_obj);
@@ -103,8 +112,13 @@ int mgr_destroy(struct mgr_object *hmgr_obj)
dcd_destroy_manager(hmgr_obj->hdcd_mgr);
kfree(pmgr_obj);
- /* Update the Registry with NULL for MGR Object */
- (void)cfg_set_object(0, REG_MGR_OBJECT);
+ /* Update the driver data with NULL for MGR Object */
+ if (drv_datap) {
+ drv_datap->mgr_object = NULL;
+ } else {
+ status = -EPERM;
+ pr_err("%s: Failed to store MGR object\n", __func__);
+ }
return status;
}
diff --git a/drivers/staging/tidspbridge/services/cfg.c b/drivers/staging/tidspbridge/services/cfg.c
index 5517201..32bb934 100644
--- a/drivers/staging/tidspbridge/services/cfg.c
+++ b/drivers/staging/tidspbridge/services/cfg.c
@@ -30,32 +30,3 @@
#include <dspbridge/cfg.h>
#include <dspbridge/drv.h>
-/*
- * ======== cfg_set_object ========
- * Purpose:
- * Store the Driver Object handle
- */
-int cfg_set_object(u32 value, u8 dw_type)
-{
- int status = -EINVAL;
- struct drv_data *drv_datap = dev_get_drvdata(bridge);
-
- if (!drv_datap)
- return -EPERM;
-
- switch (dw_type) {
- case (REG_DRV_OBJECT):
- drv_datap->drv_object = (void *)value;
- status = 0;
- break;
- case (REG_MGR_OBJECT):
- drv_datap->mgr_object = (void *)value;
- status = 0;
- break;
- default:
- break;
- }
- if (status)
- pr_err("%s: Failed, status 0x%x\n", __func__, status);
- return status;
-}
--
1.7.0.3
next prev parent reply other threads:[~2010-08-25 22:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-25 22:08 [PATCH 00/11] staging: tidspbridge: Remove services directory Ivan Gomez Castellanos
2010-08-25 22:08 ` [PATCH 01/11] staging: tidspbridge: Move sync.c from services to core Ivan Gomez Castellanos
2010-08-25 22:08 ` [PATCH 02/11] staging: tidspbridge: Remove ntfy.c Ivan Gomez Castellanos
2010-08-25 22:08 ` [PATCH 03/11] staging: tidspbridge: Remove cfg_get_auto_start() Ivan Gomez Castellanos
2010-08-25 22:08 ` [PATCH 04/11] staging: tidspbridge: Remove cfg_init() and cfg_exit() Ivan Gomez Castellanos
2010-08-25 22:08 ` [PATCH 05/11] staging: tidspbridge: Remove cfg_get_dev_object() and do a trivial cleanup Ivan Gomez Castellanos
2010-08-25 22:08 ` [PATCH 06/11] staging: tidspbridge: Remove cfg_get_exec_file() Ivan Gomez Castellanos
2010-08-25 22:09 ` [PATCH 07/11] staging: tidspbridge: Remove cfg_get_object() Ivan Gomez Castellanos
2010-08-25 22:09 ` [PATCH 08/11] staging: tidspbridge: Remove cfg_set_dev_object() Ivan Gomez Castellanos
2010-08-25 22:09 ` Ivan Gomez Castellanos [this message]
2010-08-25 22:09 ` [PATCH 10/11] staging: tidspbridge: Remove cfg.c and cfg.h files Ivan Gomez Castellanos
2010-08-25 22:09 ` [PATCH 11/11] staging: tidspbridge: Remove services.c and services.h Ivan Gomez Castellanos
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=1282774144-11628-10-git-send-email-ivan.gomez@ti.com \
--to=ivan.gomez@ti.com \
--cc=Hiroshi.DOYU@nokia.com \
--cc=ameya.palande@nokia.com \
--cc=ernesto@ti.com \
--cc=felipe.contreras@nokia.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=ohad@wizery.com \
--cc=omar.ramirez@ti.com \
--cc=rene.sapiens@ti.com \
--cc=x0095078@ti.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®