Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp1880613rwb; Sun, 4 Sep 2022 04:18:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR6AE12ysH8QIsa9Kktn5J5Hft/eJLkpan8FWweXEWp4GbMSoBCvCgHMBRSCBRyo8czLJn0t X-Received: by 2002:a17:907:7b94:b0:731:1b11:c241 with SMTP id ne20-20020a1709077b9400b007311b11c241mr33571502ejc.676.1662290292399; Sun, 04 Sep 2022 04:18:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662290292; cv=none; d=google.com; s=arc-20160816; b=y3Lng/Zr3PmtkGRhnoqVi2Rgzbrt/uoVIbBOQi2zLhgZnOpcC9X0imuuxLShIFJG2J sZcAHSYbp50RCVU9JM4EoSkERxCGqNucBDT/b82ky80x60BPTOiHE019vG/WGyJkTZFx 8mmqTKK4u0/3Kdb9pu8n6AgLAvJ4YbbbDpLn+EBPybWndiNunJSiCtxYNe8n1tAUdzjs yd3U9wuzYvGLF0Ziw10qY0repZIkYzzBAO2bGFfjavjK9mcY00VznDLm18RmbRzp8iSj VJfMSOluM9wydPyv3uFUDXGuQ1KdyH3b4V7gHIix1kckEYiRVOpRH4l6gTXt8qosNM1b x8OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ekJd9g9Bq2u7DxZJgzxSy0s2YGnMOneEZOGPvszyJFk=; b=fl9IEZDsG62xChm2k1pBBfR/8XX9mFcK4ldCTLxSPH1GosSkXMfrUndmEEDpzIPk0A x3cF4/IqSkjFSPq4dD7boJQ8JzCgOJbt6+Lfe0/Rar/kRwKL+EC9bV01Oi3rkymy1F5c pc7EwtEjhdfeghXb+WLC12+JDlFcRxLkEQscmJcg4gCzMv45BGfYdUd+zgMbYa1Gghh+ 4lLspCCFhN2xlXQTq0dVUXIZuOcBfokAIGAa4DRZpahxm7kPeiw0X+9EjcnP3CrH6R3d 1rHNLJ8bLeH7kAZIYiv1/wQjsnMNsbGbNpxv9G32gxvfsG+HvjaQbm+RsvT1/u3ErtuL pdBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CqOcCbJ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd9-20020a170907628900b0073dd6d901dbsi5624814ejc.72.2022.09.04.04.17.47; Sun, 04 Sep 2022 04:18:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CqOcCbJ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233046AbiIDKTA (ORCPT + 99 others); Sun, 4 Sep 2022 06:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbiIDKS6 (ORCPT ); Sun, 4 Sep 2022 06:18:58 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F52445063 for ; Sun, 4 Sep 2022 03:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662286738; x=1693822738; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=oSm3YqgcF0nA/3IBQeWOjYMotwEj1+DdQMUXqyLYEAg=; b=CqOcCbJ9vfNh2xPzrzdIagU/ZOJ8thO3xmdkw/kCRdBhlGVylZIWfzda 4Txum0+4+b7fKgL+ZJ1mGqJ/shpPYD7eUXaASHPpnaatNfCwYbBa8VSzk O+Xg5sn8g6nrlBZCT2r7fSiWcWREvGXIpoMfQNI3saI9YEZUSnQoMxypq /gA9ZSCZsWooX5hx/ImB38tUr2t1ce24HyiW85aF37c1N5TjVtfh3MJru Z4X55ma4T7JZ3C5VtRPZ97bymeJrx8+O/nrw3Qo/LLVmhGMXycx3kb6rE l7oVLLOEWqEpp+KgpglTEoZeXh+vEEfUP2j7L/5ci3dXzxTgul5xHuBqR g==; X-IronPort-AV: E=McAfee;i="6500,9779,10459"; a="297016176" X-IronPort-AV: E=Sophos;i="5.93,289,1654585200"; d="scan'208";a="297016176" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2022 03:18:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,289,1654585200"; d="scan'208";a="646589492" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga001.jf.intel.com with ESMTP; 04 Sep 2022 03:18:53 -0700 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com, lgirdwood@gmail.com, kai.vehmanen@linux.intel.com, peter.ujfalusi@linux.intel.com, ranjani.sridharan@linux.intel.com, yung-chuan.liao@linux.intel.com, willy@infradead.org, linux-kernel@vger.kernel.org, andy@kernel.org, intel-poland@eclists.intel.com, andy.shevchenko@gmail.com, Cezary Rojewski Subject: [PATCH v6 0/2] lib/string_helpers: Introduce parse_int_array_user() Date: Sun, 4 Sep 2022 12:28:38 +0200 Message-Id: <20220904102840.862395-1-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 v6: - minor improvements in SOF code: dropped superfluous array-empty checks as suggested by Andy 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, 61 insertions(+), 89 deletions(-) -- 2.25.1