Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2015678ybg; Fri, 5 Jun 2020 03:27:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9Do/81HA6kLLl/4WpM79c1pMIvLrBruB4wDkij0CIqqmA6knEj29aI+xi0+ea8Tjy78mv X-Received: by 2002:a17:906:ae85:: with SMTP id md5mr7985797ejb.213.1591352850048; Fri, 05 Jun 2020 03:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591352850; cv=none; d=google.com; s=arc-20160816; b=SRhTnGIYRyG1N7lz+aE+Bsc2zniApBjKSkP3+tSxYvzeFTTx8DnZhTlNq0HOXNg2QB 2RMVjVhYVG4CjcSfIrgEukls28lf7cF7V466Qf5A3VJl4NGg0dMcNJVzRNoYoOXvShxJ t8Ffesw7Hcv1+CHFWZcj7KJ34gTf16x7COErubp0mfb6G8wPgwzQkDNXrOZPvIrveOnX Kag3X24l8SSjtYGG+Q1e2jIjaKvJT2NopS5//+kiXaph7lmnMvb4k417fnunXiUDERW4 MmWzcXayP9IlX6w0J8ItVzp0cQYeyIjxTm86FZjnT5SSBaVX/5YN/5g0AsImsTHcqdLv 6M9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=ILwM29qMSYKcVIWPmdUtNbrZy37LKLfK7PaTLUSzfUU=; b=c4gOihH7Mnwv6UVwBqwLOTnN9/AB0IGUv1HaxmINZ5vyWPdECXDU5dArJgsoZjok2z iimLaJLak9ZzVlhbEHYdrN/f6yc9y6wToesn59ScDiauLP4iNXzzEXPv6DR1Z9lVyQCM b1mH6lyGs8IdxW9ZnKKCTAuV21OOaOncjMx4A7vxH2/4vtVJHCOG5pMzZILxOGITMg2X 5HWdiIuA1G0e+kE6Kgsb7e/KqAYDDCthubW691qw1XWsrkqN8vEfiDqunX6zW72T/Qwk FFpctopOBcJI5KZ2PR4lc0oTU7ExgExv3Q8Khr/vvJdHeHGhKqtm1oQ8QZzQy/8epNVs gk+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=f4MCEfYD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr12si4239420ejc.352.2020.06.05.03.27.07; Fri, 05 Jun 2020 03:27:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=f4MCEfYD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726558AbgFEKY5 (ORCPT + 99 others); Fri, 5 Jun 2020 06:24:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726077AbgFEKY5 (ORCPT ); Fri, 5 Jun 2020 06:24:57 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4838C08C5C2; Fri, 5 Jun 2020 03:24:56 -0700 (PDT) Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 83D3C22EE4; Fri, 5 Jun 2020 12:24:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1591352694; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ILwM29qMSYKcVIWPmdUtNbrZy37LKLfK7PaTLUSzfUU=; b=f4MCEfYDpsR0K+oXpcdSTqRG43PxCzYJmSlibPHE6ofdGUuZ0CvMgQcaoPasbcub3jyhG3 T7/ZANjnNC6nRvAdE8mYArlV8+FVqCiV8I5Nf5F6LoVxDZEw+Y5qeiGxMLUXrNUBgbBTSn EEQf07mVqq8+OrOiS2L2exaQBCw7f7o= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 05 Jun 2020 12:24:54 +0200 From: Michael Walle To: Andy Shevchenko Cc: "open list:GPIO SUBSYSTEM" , devicetree , Linux Kernel Mailing List , linux-hwmon@vger.kernel.org, linux-pwm@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-arm Mailing List , Linus Walleij , Bartosz Golaszewski , Rob Herring , Jean Delvare , Guenter Roeck , Lee Jones , Thierry Reding , =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , Wim Van Sebroeck , Shawn Guo , Li Yang , Thomas Gleixner , Jason Cooper , Marc Zyngier , Mark Brown , Greg Kroah-Hartman , Andy Shevchenko Subject: Re: [PATCH v4 04/11] watchdog: add support for sl28cpld watchdog In-Reply-To: References: <20200604211039.12689-1-michael@walle.cc> <20200604211039.12689-5-michael@walle.cc> User-Agent: Roundcube Webmail/1.4.4 Message-ID: <8f042c2442852c29519c381833f3d289@walle.cc> X-Sender: michael@walle.cc Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 2020-06-05 10:14, schrieb Andy Shevchenko: > On Fri, Jun 5, 2020 at 12:14 AM Michael Walle wrote: >> >> Add support for the watchdog of the sl28cpld board management >> controller. This is part of a multi-function device driver. > > ... > >> +#include > > Didn't find a user of this. I guess mod_devicetable.h then. > > ... > >> +static bool nowayout = WATCHDOG_NOWAYOUT; >> +module_param(nowayout, bool, 0); >> +MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started >> (default=" >> + __MODULE_STRING(WATCHDOG_NOWAYOUT) >> ")"); >> + >> +static int timeout; >> +module_param(timeout, int, 0); >> +MODULE_PARM_DESC(timeout, "Initial watchdog timeout in seconds"); > > Guenter ACKed this, but I'm wondering why we still need module > parameters... How would a user change the nowayout or the timeout? For the latter there is a device tree entry, but thats not easy changable by the user. > > ... > >> + int ret; >> + >> + ret = regmap_read(wdt->regmap, wdt->offset + WDT_COUNT, &val); >> + >> + return (ret < 0) ? 0 : val; > > Besides extra parentheses and questionable ' < 0' part, the following > would look better I think > > ret = ... > if (ret) > return 0; > > return val; yes, you're right. > > ... > >> + int ret; >> + >> + ret = regmap_write(wdt->regmap, wdt->offset + WDT_TIMEOUT, >> timeout); >> + if (!ret) >> + wdd->timeout = timeout; >> + >> + return ret; > > Similar story here: > > ret = ... > if (ret) > return ret; > > wdd->... = ... > return 0; > > ... ok > >> + ret = regmap_read(wdt->regmap, wdt->offset + WDT_CTRL, >> &status); > >> + if (ret < 0) > > What ' < 0' means? Do we have some positive return values? > Ditto for all your code. probably not, I'll go over all return values and change them. >> + return ret; > > ... > >> + if (status & WDT_CTRL_EN) { >> + sl28cpld_wdt_start(wdd); > >> + set_bit(WDOG_HW_RUNNING, &wdd->status); > > Do you need atomic op here? Why? I'd say consistency, all watchdog drivers do it like that. I just had a look at where this is used, but it looks like access from userspace is protected by a lock. > >> + } > > ... > >> +static const struct of_device_id sl28cpld_wdt_of_match[] = { >> + { .compatible = "kontron,sl28cpld-wdt" }, > >> + {}, > > No comma. yeah ;) -- -michael