lkml.org 
[lkml]   [2022]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/2] lib/string_helpers: Introduce strsplit_u32()
From
On 2022-07-08 6:49 PM, Andy Shevchenko wrote:
> On Fri, Jul 8, 2022 at 6:32 PM Cezary Rojewski
> <cezary.rojewski@intel.com> wrote:
>>
>> On 2022-07-08 5:25 PM, Andy Shevchenko wrote:
>>> On Fri, Jul 8, 2022 at 2:34 PM Péter Ujfalusi
>>> <peter.ujfalusi@linux.intel.com> wrote:
>
>> A long shot, but what if we were to modify get_options() so it takes
>> additional element-size parameter instead?
>
> But why? int / unsigned int, u32 / s32 are all compatible in the current cases.

I'd like to avoid any additional operations, so that the retrieved
payload can be provided to the IPC handler directly. The IPC handlers
for AudioDSP drivers are expecting payload in u32s.

// u32 **tkns, size_t *num_tkns as foo() arguments
// u32 *ints, int nints as locals

get_options(buf, 0, &nints);
if (!nints) {
ret = -ENOENT;
goto free_buf;
}

ints = kcalloc(nints + 1, sizeof(*ints), GFP_KERNEL);
if (!ints) {
ret = -ENOMEM;
goto free_buf;
}

get_num_options(buf, nints + 1, ints, sizeof(*ints));

*tkns = ints;
*num_tkns = nints;

No additional operations in between. The intermediate IPC handler can
later refer to the actual payload via &tkns[1] before passing it to the
generic one.

Casting int array into u32 array does not feel right, or perhaps I'm
missing something like in the doc case.


Regards,
Czarek

\
 
 \ /
  Last update: 2022-07-09 10:46    [W:0.662 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site