From patchwork Thu Aug 25 16:48:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 599977 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4192ECAA24 for ; Thu, 25 Aug 2022 16:40:51 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 79D94163C; Thu, 25 Aug 2022 18:39:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 79D94163C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661445649; bh=zAouvVhGGQU1mycPi0W4g/pSkl96QhPOemhs9ryS1uE=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=aB59yz9NtNUpuLIY3EWJwenYRsh8xRUEWB3a76yv3scwDb5kZ+q2BK0OLXNFlPmom QMGot/cPmqHxtBCpKgfy8TPHbmixFTFRhadCt5r1nJQfWGWzgToyAuljbJDeYqkgDh sFhxmjwjgX9jYI4sF9U/+wh+3/xvQW4M+s5AI+lc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7EC21F80526; Thu, 25 Aug 2022 18:39:17 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2650FF80525; Thu, 25 Aug 2022 18:39:16 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 86C48F80525 for ; Thu, 25 Aug 2022 18:39:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 86C48F80525 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JnQS77Ay" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661445550; x=1692981550; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=zAouvVhGGQU1mycPi0W4g/pSkl96QhPOemhs9ryS1uE=; b=JnQS77AyiVN+KsExNnL3oAyaDoGniMliSl5HrT7TiYY2u+8O9mrZjh4D 65liw7b4AJ1C2HBwRBy16WOVzL/4j7qvJ71gYyRjSe4YjvKkIBzvKd9p1 /BIH0IP0Cu9+D/feX/GDTW9p0+dpmjL3ENLh2ARUiN0VWmwLimK2kmbrv MD/7eH9BDqIiGSXKqAgMfbcdvmRhkUPhKHlXAcBTFRLM3MHBEgmNcFzEd q6+oo2rD/eyfU67GLbc2FeQCtcFVM5WHR1w6Cz0K3Lu+LczHquE+oiN3N OMazTpRt3yVaRc2M6syUTpk0bO++18h+/6gA0JJnKZmDanuT8NEmgzY1Q A==; X-IronPort-AV: E=McAfee;i="6500,9779,10450"; a="274045973" X-IronPort-AV: E=Sophos;i="5.93,263,1654585200"; d="scan'208";a="274045973" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 09:38:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,263,1654585200"; d="scan'208";a="671070402" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga008.fm.intel.com with ESMTP; 25 Aug 2022 09:38:45 -0700 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH v2 0/2] libfs: Introduce tokenize_user_input() Date: Thu, 25 Aug 2022 18:48:31 +0200 Message-Id: <20220825164833.3923454-1-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Cc: Cezary Rojewski , kai.vehmanen@linux.intel.com, yung-chuan.liao@linux.intel.com, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, lgirdwood@gmail.com, hdegoede@redhat.com, andy.shevchenko@gmail.com, ranjani.sridharan@linux.intel.com, amadeuszx.slawinski@linux.intel.com, linux-fsdevel@vger.kernel.org, peter.ujfalusi@linux.intel.com, linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Continuation of recent upstream discussion [1] regarding user string tokenization. First, tokenize_user_input() 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 fs code and provide a unified solution. 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 thourough review [1]: https://lore.kernel.org/alsa-devel/20220707091301.1282291-1-cezary.rojewski@intel.com/ Cezary Rojewski (2): libfs: Introduce tokenize_user_input() ASoC: SOF: Remove strsplit_u32() and tokenize_input() fs/libfs.c | 45 +++++++++++++++ include/linux/fs.h | 1 + sound/soc/sof/sof-client-probes.c | 92 ++++--------------------------- 3 files changed, 57 insertions(+), 81 deletions(-)