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=-10.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 CADE9C433E6 for ; Mon, 8 Mar 2021 19:40:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A2A05652AC for ; Mon, 8 Mar 2021 19:40:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbhCHTkB (ORCPT ); Mon, 8 Mar 2021 14:40:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbhCHTj3 (ORCPT ); Mon, 8 Mar 2021 14:39:29 -0500 Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78825C06174A; Mon, 8 Mar 2021 11:39:29 -0800 (PST) Received: by mail-ot1-x334.google.com with SMTP id a17so10415184oto.5; Mon, 08 Mar 2021 11:39:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=fchs7bSeiqCmhuaprvM6DnK2VYhgG5gbLzQ0p1oAtqw=; b=Tw4VdLX4zEoX1X2Xe36F0gHuMEm1YXzcIopl22XhsDucKZQ/ztsB7ronV9tBwOQ2RN QyFyd4l+fbqV45EKLng3Q2D+DTRLQ+bbZQzkB2wQGks2G//5zVOmOZHaPvuZqmvTbEQm ZFQ2AiH0LTvXQDdPGXsWVlurhxzSsxcekKXgjeWdXjNbzBqu/N91aZhk20S5bP1xiqRm k2S8+VdNl/PB3TkJMYj1/4SmKV0C+fhc8h/n1mQ2lLTmC2wUtfq+6tvgjb+YKmqh9OFi puZtXoirQeG6CVhkL7N3n+DJaZis5Upmt1zgORwqzK+wsfj6n2wi0jFFOpiMaUFznoLh QvFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=fchs7bSeiqCmhuaprvM6DnK2VYhgG5gbLzQ0p1oAtqw=; b=S/3dkKRcOyFGGsK8rLbIliMLgnpGLZ/6j+ounJpijLfU67XY1rP/grBnYZPAnBg8oq O4EuVZMR00FDBKtsxCIZ+0/dYpnrHY1Nw9EATYyb+Ae7d8EGmGncbufxweg3/j0Q68r/ RBshNl3Dgws6h6rucf8FqlvTYsrFR7I5VRcLr43Y2niIpDBVRX23p2K2rYxxTc5xpuW8 hEqK5FWwX5t6+ylWSCDcFbZhB+4s5p50iaolBh7A+KIUG0udVZHNuf2cyFjhS6IGK944 CpXGWH6ecNveyxkcM25ORw1gHDGSDe8/9yJuJ3JfNiQKrkZikMA3sMp+nvbAvMMLtJHY U5Ww== X-Gm-Message-State: AOAM53008uOdtwJ/vvERtlEb1O4WmozFuphISsCZdYmT9uV00R/Jp1H3 jUiLMwUmpbGIPrPM2wzTcevT04+Vqv8= X-Google-Smtp-Source: ABdhPJwR8xXSWsiou78MEUS6QZ3+WEa9F5CAGtBR8McuUFZvFrhvrv8cAdvR/WTSFKZizPx7bZG3HQ== X-Received: by 2002:a9d:4e14:: with SMTP id p20mr13439516otf.94.1615232368599; Mon, 08 Mar 2021 11:39:28 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id f29sm2942544ots.22.2021.03.08.11.39.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Mar 2021 11:39:27 -0800 (PST) Sender: Guenter Roeck Subject: Re: [PATCH v1 0/2] Watchdog Core Global Parameters To: Flavio Suligoi , Wim Van Sebroeck , Mika Westerberg Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210308112151.716315-1-f.suligoi@asem.it> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d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Mg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: Date: Mon, 8 Mar 2021 11:39:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210308112151.716315-1-f.suligoi@asem.it> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/8/21 3:21 AM, Flavio Suligoi wrote: > This patch series add a new way to consider the module parameters for the > watchdog module. > > Instead of adding this kind of module parameters independently to each > driver, the best solution is declaring each feature only once, > in the watchdog core. > I agree to and like the idea, but I don't see the point of letting drivers opt in or opt out. This adds a lot of complexity for little if any gain. Guenter > Additionally, I added a implementation example of this "global" parameters > using the module "wdat_wdt" > > In details: > > =============================== > Watchdog Core Global Parameters > =============================== > > Information for watchdog kernel modules developers. > > Introduction > ============ > > Different watchdog modules frequently require the same type of parameters > (for example: *timeout*, *nowayout* feature, *start_enabled* to start the > watchdog on module insertion, etc.). > Instead of adding this kind of module parameters independently to each > driver, the best solution is declaring each feature only once, > in the watchdog core. > > In this way, each driver can read these "global" parameters and then, > if needed, can implement them, according to the particular hw watchdog > characteristic. > > Using this approach, it is possible reduce some duplicate code in the *new* > watchdog drivers and simplify the code maintenance. Moreover, the code > will be clearer, since the same kind of parameters are often called > with different names (see Documentation/watchdog/watchdog-parameters.rst). > Obviously, for compatibility reasons, we cannot remove the already existing > parameters from the code of the various watchdog modules, but we can use > this "global" approach for the new watchdog drivers. > > > Global parameters declaration > ============================== > > The global parameters data structure is declared in > include/linux/watchdog.h, as:: > > struct watchdog_global_parameters_struct { > int timeout; > int ioport; > int irq; > unsigned long features; > /* Bit numbers for features flags */ > #define WDOG_GLOBAL_PARAM_VERBOSE 0 > #define WDOG_GLOBAL_PARAM_TEST_MODE 1 > #define WDOG_GLOBAL_PARAM_START_ENABLED 2 > #define WDOG_GLOBAL_PARAM_NOWAYOUT 3 > }; > > The variable "feature" is a bitwise flags container, to store boolean > features, such as: > > * nowayout > * start_enable > * etc... > > Other variables can be added, to store some numerical values and other data > required. > > The global parameters are declared (as usual for the module parameters) > in the first part of drivers/watchdog/watchdog_core.c file. > The above global data structure is then managed by the function > *void global_parameters_init()*, in the same file. > > Global parameters use > ===================== > > Each watchdog driver, to check if one of the global parameters is enabled, > can use the corresponding in-line function declared in > include/linux/watchdog.h. > At the moment the following functions are ready to use: > > * watchdog_global_param_verbose_enabled() > * watchdog_global_param_test_mode_enabled() > * watchdog_global_param_start_enabled() > * watchdog_global_param_nowayout_enabled() > > > > Flavio Suligoi (2): > watchdog: add global watchdog kernel module parameters structure > watchdog: wdat: add start_enable global parameter > > Documentation/watchdog/index.rst | 1 + > .../watchdog-core-global-parameters.rst | 74 +++++++++++++++++++ > drivers/watchdog/watchdog_core.c | 74 +++++++++++++++++++ > drivers/watchdog/wdat_wdt.c | 2 + > include/linux/watchdog.h | 42 +++++++++++ > 5 files changed, 193 insertions(+) > create mode 100644 Documentation/watchdog/watchdog-core-global-parameters.rst >