mbox series

[v5,0/2] lib/string_helpers: Introduce parse_int_array_user()

Message ID 20220902133256.789165-1-cezary.rojewski@intel.com
Headers show
Series lib/string_helpers: Introduce parse_int_array_user() | expand

Message

Cezary Rojewski Sept. 2, 2022, 1:32 p.m. UTC
Continuation of recent upstream discussion [1] regarding user string
tokenization.

First, parse_int_array_user() is introduced to allow for splitting
specified user string into a sequence of integers. Makes use of
get_options() internally so the parsing logic is not duplicated.

With that done, redundant parts of the sound driver are removed.

Originally similar functionality was added for the SOF sound driver. As
more users are on the horizon, it is desirable to update existing
string_helpers code and provide a unified solution.


Changes in v5:
- fixed kernel doc for parse_int_array_user()

Changes in v4:
- renamed the function to parse_int_array_user()
- at the name several local variable names have been reworded to match
  the above

Changes in v3:
- relocated tokenize_user_input() implementation to string_helpers as
  requested by Matthew

Changes in v2:
- reused get_options() so no parsing logic is duplicated
- simplified __user variant with help of memdup_user_nul()
  Both suggested by Andy, thanks for thorough review


[1]: https://lore.kernel.org/alsa-devel/20220707091301.1282291-1-cezary.rojewski@intel.com/


Cezary Rojewski (2):
  lib/string_helpers: Introduce parse_int_array_user()
  ASoC: SOF: Remove strsplit_u32() and tokenize_input()

 include/linux/string_helpers.h    |   2 +
 lib/string_helpers.c              |  44 +++++++++++++
 sound/soc/sof/sof-client-probes.c | 104 ++++++------------------------
 3 files changed, 64 insertions(+), 86 deletions(-)

Comments

Andy Shevchenko Sept. 2, 2022, 2:16 p.m. UTC | #1
On Fri, Sep 02, 2022 at 03:32:54PM +0200, Cezary Rojewski wrote:
> Continuation of recent upstream discussion [1] regarding user string
> tokenization.
> 
> First, parse_int_array_user() is introduced to allow for splitting
> specified user string into a sequence of integers. Makes use of
> get_options() internally so the parsing logic is not duplicated.
> 
> With that done, redundant parts of the sound driver are removed.
> 
> Originally similar functionality was added for the SOF sound driver. As
> more users are on the horizon, it is desirable to update existing
> string_helpers code and provide a unified solution.

Feel free to route it via SOF or related tree since you have my tag
for the library part.