Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3066634rdb; Wed, 13 Sep 2023 00:23:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEu/SFhx0Ic+hiYydm7Cb94cqwTgkDOjaV6ZEtlFkKQBI8CQwMKi8olviXOhTF8lWYbaHhD X-Received: by 2002:a17:90a:6447:b0:268:5c3b:6f28 with SMTP id y7-20020a17090a644700b002685c3b6f28mr1403486pjm.19.1694589821512; Wed, 13 Sep 2023 00:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694589821; cv=none; d=google.com; s=arc-20160816; b=F+I1CUITA1oJDJAP4ad9r8PVenvHnH1vAAxw025Gqe+AE1CQ1sYzDOxdK/uJrTy2HU b5h+9Aaj6nltmffoz6f9+bDDAVKh0AgKALh7b9f0dPgma7QNlduJG1x7Uv2HyA3aG80b 6ejeNDsAfOElSJKeFB6W9MdwpRjLNVqCHQbT4eEaqSrC+uc9RoOWD2OyUQgqYXN2HIy8 DfxTjvrQLEzAPpW/uDaRF52KqVJFfG/yHR1ID9zbVAEOZ5RmVq7CK9cwUkmGnXqvCaE/ sCpIBGIqPViKDxw3a0/+5TtyHvIWD6D/yYQQzVe1pyY28XvO6a6BsOTcP5rdXSkabmUm Alcg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3QeYUxc2VQo1uvPu5+NNW0+SQ2gh02BvKMUl4xQCUC8=; fh=bHBp+PJACSvucKAvnO3bf9DILRtfHT5RT33jsVWkQ4A=; b=HES6iN+dHSueMAXSkFPbYOxJ0hKhph/FZTbcsaUe1uiDKgRhMp5xlZ/rfijdFdZ+Xb lH3Kx4vvK35dVY4tBU3Z5trBX7yMTQa4D4RbfplkdupKB6zRJaa9+uLG0UXsC20tP/bv eBR6hXqTGWUmdI0iXJxbmhDG0cIYO6oty2tB6iHELRrEdxP8/Fuvg1U6Fc4+czbhe8jY NCZ8xK1sUDpEYIsFgD898UG/YILRrZde5G4zzAShkS9dP/GTSxgWXhxdmPRC4mJ8yrJg xPOgsbmHwGW6w5wgEblRx2BkxmKl/ZIJ7ky+vE8OIorigbG2OaehM1sVG9C3AI7yaXvs WDPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DQoFv4sY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d24-20020a17090ab31800b0025bcf85bda2si1036074pjr.7.2023.09.13.00.23.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 00:23:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DQoFv4sY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C04008070654; Tue, 12 Sep 2023 08:07:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236203AbjILPH0 (ORCPT + 99 others); Tue, 12 Sep 2023 11:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236229AbjILPHV (ORCPT ); Tue, 12 Sep 2023 11:07:21 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4053A10DD for ; Tue, 12 Sep 2023 08:07:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694531234; x=1726067234; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IiHm5qqjR8NdKDjufrZuWY5WFVXJIdbQ2oc8nS645Xw=; b=DQoFv4sYqfZSTQ1FYxNoV5Qt9QUzcN3zAD9pJz1OkVoyCsJFgqy2c5Tw 1Org4vprZc0+MoO6+J+jmCm9EXWksb3khuFpjoqWh/OuZ+s/2Kgst97kh v8lySsEsw9AqRnlGc1NdmqX3d2DJYXdMA0yIHWsgeh+fuRr/E9oXn0h8I 3TVtuZyQjHvctOL721+ltbaXNyLUgRNGMaIlH+wn205lyDDWBCZIAYr7J Ff5r1c4nGOK4IU/WjcVIo6IMiddn/L7tXpMdOBO0tpB/UzzBbJMR+xxGY 7VYL/DAQeG4f+hmeZdNY5bx5e9pKNBmwD24k5ZzWC76UZiGJdaqmlddlg w==; X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="409356431" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="409356431" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 08:05:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="858836455" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="858836455" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 12 Sep 2023 08:05:55 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6CF9D1A7; Tue, 12 Sep 2023 18:05:54 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Luis Chamberlain Subject: [PATCH v1 2/6] params: Introduce the param_unknown_fn type Date: Tue, 12 Sep 2023 18:05:47 +0300 Message-Id: <20230912150551.401537-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230912150551.401537-1-andriy.shevchenko@linux.intel.com> References: <20230912150551.401537-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 12 Sep 2023 08:07:29 -0700 (PDT) Introduce a new type for the callback to parse an unknown argument. This unifies function prototypes which takes that as a parameter. Signed-off-by: Andy Shevchenko --- include/linux/moduleparam.h | 6 +++--- kernel/params.c | 8 ++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 962cd41a2cb5..3800d1e2a3ab 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -381,6 +381,8 @@ extern bool parameq(const char *name1, const char *name2); */ extern bool parameqn(const char *name1, const char *name2, size_t n); +typedef int (*parse_unknown_fn)(char *param, char *val, const char *doing, void *arg); + /* Called on module insert or kernel boot */ extern char *parse_args(const char *name, char *args, @@ -388,9 +390,7 @@ extern char *parse_args(const char *name, unsigned num, s16 level_min, s16 level_max, - void *arg, - int (*unknown)(char *param, char *val, - const char *doing, void *arg)); + void *arg, parse_unknown_fn unknown); /* Called by module remove. */ #ifdef CONFIG_SYSFS diff --git a/kernel/params.c b/kernel/params.c index 3efe6b98a600..fb594132ffc7 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -120,9 +120,7 @@ static int parse_one(char *param, unsigned num_params, s16 min_level, s16 max_level, - void *arg, - int (*handle_unknown)(char *param, char *val, - const char *doing, void *arg)) + void *arg, parse_unknown_fn handle_unknown) { unsigned int i; int err; @@ -165,9 +163,7 @@ char *parse_args(const char *doing, unsigned num, s16 min_level, s16 max_level, - void *arg, - int (*unknown)(char *param, char *val, - const char *doing, void *arg)) + void *arg, parse_unknown_fn unknown) { char *param, *val, *err = NULL; -- 2.40.0.1.gaa8946217a0b