From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C8A5C432BE for ; Fri, 13 Aug 2021 15:44:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0A476109D for ; Fri, 13 Aug 2021 15:44:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236900AbhHMPod (ORCPT ); Fri, 13 Aug 2021 11:44:33 -0400 Received: from mga02.intel.com ([134.134.136.20]:32407 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236037AbhHMPoc (ORCPT ); Fri, 13 Aug 2021 11:44:32 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10075"; a="202771790" X-IronPort-AV: E=Sophos;i="5.84,319,1620716400"; d="scan'208";a="202771790" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2021 08:44:05 -0700 X-IronPort-AV: E=Sophos;i="5.84,319,1620716400"; d="scan'208";a="571833136" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2021 08:43:52 -0700 Received: from andy by smile with local (Exim 4.94.2) (envelope-from ) id 1mEZLU-009Hky-Ik; Fri, 13 Aug 2021 18:43:44 +0300 Date: Fri, 13 Aug 2021 18:43:44 +0300 From: Andy Shevchenko To: Jim Cromie Cc: gregkh@linuxfoundation.org, seanpaul@chromium.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , "Pan, Xinhui" , Harry Wentland , Leo Li , Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Jason Baron , Hawking Zhang , Tao Zhou , Huang Rui , Likun Gao , Chengming Gui , Aaron Liu , John Clements , Kevin Wang , Ashley Thomas , Qingqing Zhuo , Wyatt Wood , Aurabindo Pillai , Johan Hovold , Jessica Yu , Nick Desaulniers , Joe Perches , Miguel Ojeda , Andrew Morton , Masahiro Yamada , Peter Zijlstra , "Paul E. McKenney" , Tetsuo Handa , Thomas Gleixner , Vitor Massaru Iha , Sedat Dilek , Zhen Lei , Marco Elver , Jarkko Sakkinen , Alexander Potapenko , Palmer Dabbelt , Patricia Alfonso , Jiri Olsa , James Bottomley , Arvind Sankar , Johannes Berg , Arnd Bergmann , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: Re: [PATCH v5 2/9] moduleparam: add data member to struct kernel_param Message-ID: References: <20210813151734.1236324-1-jim.cromie@gmail.com> <20210813151734.1236324-3-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210813151734.1236324-3-jim.cromie@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 13, 2021 at 09:17:10AM -0600, Jim Cromie wrote: > Add a const void* data member to the struct, to allow attaching > private data that will be used soon by a setter method (via kp->data) > to perform more elaborate actions. > > To attach the data at compile time, add new macros: > > module_param_cbd() derives from module_param_cb(), adding data param, > and latter is redefined to use former. > > It calls __module_param_call_wdata(), which accepts a new data param > and inits .data with it. Re-define __module_param_call() to use it. > > Use of this new data member will be rare, it might be worth redoing > this as a separate/sub-type to de-bloat the base case. ... > +#define module_param_cbd(name, ops, arg, perm, data) \ > + __module_param_call_wdata(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0, data) Cryptic name. Moreover, inconsistent with the rest. What about module_param_cb_data() ? > #define module_param_cb_unsafe(name, ops, arg, perm) \ > __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \ > KERNEL_PARAM_FL_UNSAFE) (above left for the above comment) ... > +#define __module_param_call_wdata(prefix, name, ops, arg, perm, level, flags, data) \ Similar __module_param_call_with_data() -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F638C4320A for ; Fri, 13 Aug 2021 15:44:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A973D60FBF for ; Fri, 13 Aug 2021 15:44:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A973D60FBF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 76B666E86C; Fri, 13 Aug 2021 15:44:07 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BD356E85A; Fri, 13 Aug 2021 15:44:06 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10075"; a="215571979" X-IronPort-AV: E=Sophos;i="5.84,319,1620716400"; d="scan'208";a="215571979" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2021 08:44:05 -0700 X-IronPort-AV: E=Sophos;i="5.84,319,1620716400"; d="scan'208";a="571833136" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2021 08:43:52 -0700 Received: from andy by smile with local (Exim 4.94.2) (envelope-from ) id 1mEZLU-009Hky-Ik; Fri, 13 Aug 2021 18:43:44 +0300 Date: Fri, 13 Aug 2021 18:43:44 +0300 From: Andy Shevchenko To: Jim Cromie Cc: gregkh@linuxfoundation.org, seanpaul@chromium.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , "Pan, Xinhui" , Harry Wentland , Leo Li , Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Jason Baron , Hawking Zhang , Tao Zhou , Huang Rui , Likun Gao , Chengming Gui , Aaron Liu , John Clements , Kevin Wang , Ashley Thomas , Qingqing Zhuo , Wyatt Wood , Aurabindo Pillai , Johan Hovold , Jessica Yu , Nick Desaulniers , Joe Perches , Miguel Ojeda , Andrew Morton , Masahiro Yamada , Peter Zijlstra , "Paul E. McKenney" , Tetsuo Handa , Thomas Gleixner , Vitor Massaru Iha , Sedat Dilek , Zhen Lei , Marco Elver , Jarkko Sakkinen , Alexander Potapenko , Palmer Dabbelt , Patricia Alfonso , Jiri Olsa , James Bottomley , Arvind Sankar , Johannes Berg , Arnd Bergmann , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Message-ID: References: <20210813151734.1236324-1-jim.cromie@gmail.com> <20210813151734.1236324-3-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210813151734.1236324-3-jim.cromie@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: Re: [Intel-gfx] [PATCH v5 2/9] moduleparam: add data member to struct kernel_param X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, Aug 13, 2021 at 09:17:10AM -0600, Jim Cromie wrote: > Add a const void* data member to the struct, to allow attaching > private data that will be used soon by a setter method (via kp->data) > to perform more elaborate actions. > > To attach the data at compile time, add new macros: > > module_param_cbd() derives from module_param_cb(), adding data param, > and latter is redefined to use former. > > It calls __module_param_call_wdata(), which accepts a new data param > and inits .data with it. Re-define __module_param_call() to use it. > > Use of this new data member will be rare, it might be worth redoing > this as a separate/sub-type to de-bloat the base case. ... > +#define module_param_cbd(name, ops, arg, perm, data) \ > + __module_param_call_wdata(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0, data) Cryptic name. Moreover, inconsistent with the rest. What about module_param_cb_data() ? > #define module_param_cb_unsafe(name, ops, arg, perm) \ > __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \ > KERNEL_PARAM_FL_UNSAFE) (above left for the above comment) ... > +#define __module_param_call_wdata(prefix, name, ops, arg, perm, level, flags, data) \ Similar __module_param_call_with_data() -- With Best Regards, Andy Shevchenko