diff options
author | Omar Ramirez Luna <omar.ramirez@copitl.com> | 2012-08-16 18:33:26 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-17 08:10:28 -0700 |
commit | 424d56ec3ca0ea5a4cc4caad885d8e49a3cfafc8 (patch) | |
tree | 18a9e1440f7587665a1227e7ff3ee535287734e7 /drivers/staging/tidspbridge | |
parent | 1021bb5c62a13b05242bbfdc8a5a241025dad883 (diff) |
staging: tidspbridge: fix uuid strings
Commit 8cb05f4b54535cb91d7a5f9f8eb230bd4fa86e4e (staging:
tidspbridge: eliminate uuid_uuid_to_string), not only broke
compilation but also functionality for tidspbridge driver.
So:
- Replace remaining instances of uuid_uuid_to_string with snprintf
to fix compilation.
- Fix the format from %pU to %pUL.
- Since these UUIDs are used in the firmware to reference section
names, the firmware doesn't follow the standard uuid delimiter '-'
it uses '_' instead. The driver can follow the standard convention
however for dsp sections we must transform the uuid to what is
expected by the firmware. E.g.:
tidspbridge sees: 24BC8D90-BB45-11D4-B756-006008BDB66F
firmware expects: .24BC8D90_BB45_11D4_B756_006008BDB66F
Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com>
CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/tidspbridge')
-rw-r--r-- | drivers/staging/tidspbridge/rmgr/dbdcd.c | 27 | ||||
-rw-r--r-- | drivers/staging/tidspbridge/rmgr/node.c | 3 |
2 files changed, 23 insertions, 7 deletions
diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c b/drivers/staging/tidspbridge/rmgr/dbdcd.c index e05670dfeb46..9d52c3cb92f0 100644 --- a/drivers/staging/tidspbridge/rmgr/dbdcd.c +++ b/drivers/staging/tidspbridge/rmgr/dbdcd.c @@ -346,11 +346,13 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr, struct dcd_manager *dcd_mgr_obj = hdcd_mgr; /* ptr to DCD mgr */ struct cod_libraryobj *lib = NULL; int status = 0; + int len; u32 ul_addr = 0; /* Used by cod_get_section */ u32 ul_len = 0; /* Used by cod_get_section */ u32 dw_buf_size; /* Used by REG functions */ char sz_reg_key[DCD_MAXPATHLENGTH]; char *sz_uuid; /*[MAXUUIDLEN]; */ + char *tmp; struct dcd_key_elem *dcd_key = NULL; char sz_sect_name[MAXUUIDLEN + 2]; /* ".[UUID]\0" */ char *psz_coff_buf; @@ -395,7 +397,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr, } /* Create UUID value to set in registry. */ - snprintf(sz_uuid, MAXUUIDLEN, "%pU", obj_uuid); + snprintf(sz_uuid, MAXUUIDLEN, "%pUL", obj_uuid); if ((strlen(sz_reg_key) + MAXUUIDLEN) < DCD_MAXPATHLENGTH) strncat(sz_reg_key, sz_uuid, MAXUUIDLEN); @@ -429,12 +431,27 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr, } /* Ensure sz_uuid + 1 is not greater than sizeof sz_sect_name. */ + len = strlen(sz_uuid); + if (len + 1 > sizeof(sz_sect_name)) { + status = -EPERM; + goto func_end; + } /* Create section name based on node UUID. A period is * pre-pended to the UUID string to form the section name. * I.e. ".24BC8D90_BB45_11d4_B756_006008BDB66F" */ + + len -= 4; /* uuid has 4 delimiters '-' */ + tmp = sz_uuid; + strncpy(sz_sect_name, ".", 2); - strncat(sz_sect_name, sz_uuid, strlen(sz_uuid)); + do { + char *uuid = strsep(&tmp, "-"); + if (!uuid) + break; + len -= strlen(uuid); + strncat(sz_sect_name, uuid, strlen(uuid) + 1); + } while (len && strncat(sz_sect_name, "_", 2)); /* Get section information. */ status = cod_get_section(lib, sz_sect_name, &ul_addr, &ul_len); @@ -666,7 +683,7 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr, status = -EPERM; } /* Create UUID value to find match in registry. */ - uuid_uuid_to_string(uuid_obj, sz_uuid, MAXUUIDLEN); + snprintf(sz_uuid, MAXUUIDLEN, "%pUL", uuid_obj); if ((strlen(sz_reg_key) + MAXUUIDLEN) < DCD_MAXPATHLENGTH) strncat(sz_reg_key, sz_uuid, MAXUUIDLEN); else @@ -706,7 +723,7 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr, } else { status = -EPERM; } - uuid_uuid_to_string(uuid_obj, sz_uuid, MAXUUIDLEN); + snprintf(sz_uuid, MAXUUIDLEN, "%pUL", uuid_obj); if ((strlen(sz_reg_key) + MAXUUIDLEN) < DCD_MAXPATHLENGTH) strncat(sz_reg_key, sz_uuid, MAXUUIDLEN); else @@ -797,7 +814,7 @@ int dcd_register_object(struct dsp_uuid *uuid_obj, status = -EPERM; /* Create UUID value to set in registry. */ - uuid_uuid_to_string(uuid_obj, sz_uuid, MAXUUIDLEN); + snprintf(sz_uuid, MAXUUIDLEN, "%pUL", uuid_obj); if ((strlen(sz_reg_key) + MAXUUIDLEN) < DCD_MAXPATHLENGTH) strncat(sz_reg_key, sz_uuid, MAXUUIDLEN); else diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c index f17c128b3d5f..c2fc6137c770 100644 --- a/drivers/staging/tidspbridge/rmgr/node.c +++ b/drivers/staging/tidspbridge/rmgr/node.c @@ -2714,8 +2714,7 @@ static int get_node_props(struct dcd_manager *hdcd_mgr, hnode->ntype = node_type = pndb_props->ntype; /* Create UUID value to set in registry. */ - uuid_uuid_to_string((struct dsp_uuid *)node_uuid, sz_uuid, - MAXUUIDLEN); + snprintf(sz_uuid, MAXUUIDLEN, "%pUL", node_uuid); dev_dbg(bridge, "(node) UUID: %s\n", sz_uuid); /* Fill in message args that come from NDB */ |