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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 CBD3BC433E6 for ; Fri, 19 Feb 2021 10:59:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CC8964EBF for ; Fri, 19 Feb 2021 10:59:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230354AbhBSK7g (ORCPT ); Fri, 19 Feb 2021 05:59:36 -0500 Received: from mga14.intel.com ([192.55.52.115]:27169 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbhBSK4q (ORCPT ); Fri, 19 Feb 2021 05:56:46 -0500 IronPort-SDR: YV3AQiQ/gnk/fNfRwoTCTLUCbHMMj9ajNTjQllYcA5F6ijeCsG5Nb+FlYCOgbmDIVDFiSV6Kam byH+Hj1HD8nw== X-IronPort-AV: E=McAfee;i="6000,8403,9899"; a="183019374" X-IronPort-AV: E=Sophos;i="5.81,189,1610438400"; d="scan'208";a="183019374" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2021 02:54:53 -0800 IronPort-SDR: p7C/p6MzoO4uNm4ocqFIV/LXDOUjmHqH6MR922Yg7RRcUiPYvSzMvCZ0FcEs2O9wtGFFAcLB2P D1EPvlFhMhnQ== X-IronPort-AV: E=Sophos;i="5.81,189,1610438400"; d="scan'208";a="590601518" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.163]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2021 02:54:50 -0800 Received: by lahna (sSMTP sendmail emulation); Fri, 19 Feb 2021 12:54:47 +0200 Date: Fri, 19 Feb 2021 12:54:47 +0200 From: Mika Westerberg To: Flavio Suligoi Cc: Wim Van Sebroeck , Guenter Roeck , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] watchdog: wdat: add param. to start wdog on module insertion Message-ID: <20210219105447.GI2542@lahna.fi.intel.com> References: <20210218163200.1154812-1-f.suligoi@asem.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210218163200.1154812-1-f.suligoi@asem.it> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, Feb 18, 2021 at 05:32:00PM +0100, Flavio Suligoi wrote: > Add the parameter "start_enable" to start the watchdog > directly on module insertion. > > In an embedded system, for some applications, the watchdog > must be activated as soon as possible. > > In some embedded x86 boards the watchdog can be activated > directly by the BIOS (with an appropriate setting of the > BIOS setup). In other cases, when this BIOS feature is not > present, the possibility to start the watchdog immediately > after the module loading can be very useful. > > Signed-off-by: Flavio Suligoi > --- > drivers/watchdog/wdat_wdt.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c > index cec7917790e5..b990d0197d2e 100644 > --- a/drivers/watchdog/wdat_wdt.c > +++ b/drivers/watchdog/wdat_wdt.c > @@ -61,6 +61,12 @@ module_param(timeout, int, 0); > MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default=" > __MODULE_STRING(WDAT_DEFAULT_TIMEOUT) ")"); > > +#define START_DEFAULT 0 > +static int start_enabled = START_DEFAULT; > +module_param(start_enabled, int, 0); > +MODULE_PARM_DESC(start_enabled, "Watchdog is started on module insertion " > + "(default=" __MODULE_STRING(START_DEFAULT) ")"); > + > static int wdat_wdt_read(struct wdat_wdt *wdat, > const struct wdat_instruction *instr, u32 *value) > { > @@ -437,6 +443,8 @@ static int wdat_wdt_probe(struct platform_device *pdev) > } > > wdat_wdt_boot_status(wdat); > + if (start_enabled) > + wdat_wdt_start(&wdat->wdd); No objections to this if it is really needed. However, I think it is better start the watchdog after devm_watchdog_register_device() has been called so we have everything initialized. > wdat_wdt_set_running(wdat); > > ret = wdat_wdt_enable_reboot(wdat); > -- > 2.25.1