Messages in this thread | | | Date | Wed, 23 Jun 2010 18:43:31 +0300 | Subject | Re: [PATCH 06/11] staging: ti dspbridge: add generic utilities | From | Andy Shevchenko <> |
| |
On Wed, Jun 23, 2010 at 4:02 PM, Ohad Ben-Cohen <ohad@wizery.com> wrote: > Add TI's DSP Bridge generic utilities driver sources > Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
> +++ b/drivers/staging/tidspbridge/gen/uuidutil.c
Following part could be significantly simplified
> +/* > + * ======== htoi ======== > + * Purpose: > + * Converts a hex value to a decimal integer. > + */
> +/* > + * ======== uuid_uuid_from_string ======== > + * Purpose: > + * Converts a string to a struct dsp_uuid. > + */
There is a code (because I am already in s-o-b list I just put here the excerpts, however, I could prepare patch in standard form, if you want to)
static s32 uuid_hex_to_bin(char *buf, s32 len) { s32 i; s32 result = 0;
for (i = 0; i < len; i++) { value = hex_to_bin(*buf++); result *= 16; if (value > 0) result += value; }
return result; }
void uuid_uuid_from_string(IN char *pszUuid, OUT struct dsp_uuid *uuid_obj) { s32 j;
uuid_obj->ul_data1 = uuid_hex_to_bin(pszUuid, 8); pszUuid += 8;
/* Step over underscore */ pszUuid++;
uuid_obj->us_data2 = (u16) uuid_hex_to_bin(pszUuid, 4); pszUuid += 4;
/* Step over underscore */ pszUuid++;
uuid_obj->us_data3 = (u16) uuid_hex_to_bin(pszUuid, 4); pszUuid += 4;
/* Step over underscore */ pszUuid++;
uuid_obj->uc_data4 = (u8) uuid_hex_to_bin(pszUuid, 2); pszUuid += 2;
uuid_obj->uc_data5 = (u8) uuid_hex_to_bin(pszUuid, 2); pszUuid += 2;
/* Step over underscore */ pszUuid++;
for (j = 0; j < 6; j++) { uuid_obj->uc_data6[j] = (u8) uuid_hex_to_bin(pszUuid, 2); pszUuid += 2; } }
-- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |