Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp418657ybx; Mon, 4 Nov 2019 23:02:51 -0800 (PST) X-Google-Smtp-Source: APXvYqyx3QGmeVVwgOSDRjdtpzjaeo1GgLdUAYwhXPBoQg0tjjyi7HZcjAUPXVof7uoca9NKfaTq X-Received: by 2002:a17:906:3418:: with SMTP id c24mr8045781ejb.121.1572937370920; Mon, 04 Nov 2019 23:02:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572937370; cv=none; d=google.com; s=arc-20160816; b=yPVrH7T0lSeRH+cl3L0/+7N7zgWHyb2HxjfhozMag6+CVC0TUkehf8lJ1+Xzd0fepC BGShDwOG5pFwDxWMO4DC8t5qWF8iPyNwoodl/Z3B6iHkzJxzyEKgbcBy1oy4bhf7Gwq+ ao9NSQfFnaClKy4YX7kp2FhKQuhVu3rWS9qm1GRQi+xb9wWPeu1IjCnvqO+xRBlU87tC jrPSHZTQwVeudRsHHY7My3KA3I0tzLN9loP9Ivb7Aq2v3vHg1ID8wtXvvPqoncKRcLQu LKOlKLk65LguMRf+UIT5Jt+rMDAdoCl6/VuiLUVHCrXN9kvJXJ+pSjAv360iAoPaiI7Z jVwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=eOnIFQHcDhAD7SB79Bna6KwaVIdNAT5feoJRf33zMT0=; b=KzRo/+JSYS6NhQFm4vPoUH2k1x+s7JJ2/5G5LmtGcDXc+FWcGGfdtMW44mrrM0V416 KC8F+zs6tnFEhTq1IJBhX0f12ZKyX8lF3rn0GVs8iX/UXxGYlBtLrOi//xsc9NcHaj+K qQB8U5jcCSn7Jmrptti+TTE3ZHxbeiAFVhu7g69/5/PJAoGuvhMe4XnaZpgExIq75TTL bhsxv2nD95fqiRiCUHUrwaBQt9IWLZ8z3usaJokF1xJZ9rqJcyS3M34IB9r+CQJQ12ks ZCNJcAFT53+rJbBLDFt9bZ06nf4fQ3ikJV8sbnDXVUtfqf/Bq7sDH6kP43q59Q1+bueJ 7Ydg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si12299309ejb.240.2019.11.04.23.02.19; Mon, 04 Nov 2019 23:02:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387591AbfKEHBk (ORCPT + 99 others); Tue, 5 Nov 2019 02:01:40 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:37019 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387517AbfKEHBk (ORCPT ); Tue, 5 Nov 2019 02:01:40 -0500 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iRsqI-00057P-4n; Tue, 05 Nov 2019 08:01:30 +0100 Received: from pza by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iRsqG-0008UW-VW; Tue, 05 Nov 2019 08:01:28 +0100 Date: Tue, 5 Nov 2019 08:01:28 +0100 From: Philipp Zabel To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: =?iso-8859-1?Q?Cl=E9ment_P=E9ron?= , Thierry Reding , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jernej Skrabec Subject: Re: [PATCH v2 2/7] pwm: sun4i: Add an optional probe for reset line Message-ID: <20191105070128.ve73ha5ibiymcxnx@pengutronix.de> References: <20191103203334.10539-1-peron.clem@gmail.com> <20191103203334.10539-3-peron.clem@gmail.com> <20191104081157.373v22atswsaktbe@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191104081157.373v22atswsaktbe@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 07:50:49 up 120 days, 13:01, 112 users, load average: 0.25, 0.17, 0.11 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: pza@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 04, 2019 at 09:11:57AM +0100, Uwe Kleine-K?nig wrote: > Hello, > > adding Philipp Zabel (= reset controller maintainer) to Cc: and so I'm > not stripping the uncommented parts of the patch. > > On Sun, Nov 03, 2019 at 09:33:29PM +0100, Cl?ment P?ron wrote: > > From: Jernej Skrabec > > > > H6 PWM core needs deasserted reset line in order to work. > > > > Add an optional probe for it. > > > > Signed-off-by: Jernej Skrabec > > Signed-off-by: Cl?ment P?ron > > --- > > drivers/pwm/pwm-sun4i.c | 32 ++++++++++++++++++++++++++++++-- > > 1 file changed, 30 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c > > index 6f5840a1a82d..d194b8ebdb00 100644 > > --- a/drivers/pwm/pwm-sun4i.c > > +++ b/drivers/pwm/pwm-sun4i.c > > @@ -16,6 +16,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -78,6 +79,7 @@ struct sun4i_pwm_data { > > struct sun4i_pwm_chip { > > struct pwm_chip chip; > > struct clk *clk; > > + struct reset_control *rst; > > void __iomem *base; > > spinlock_t ctrl_lock; > > const struct sun4i_pwm_data *data; > > @@ -365,6 +367,20 @@ static int sun4i_pwm_probe(struct platform_device *pdev) > > if (IS_ERR(pwm->clk)) > > return PTR_ERR(pwm->clk); > > > > + pwm->rst = devm_reset_control_get_optional(&pdev->dev, NULL); > > + if (IS_ERR(pwm->rst)) { > > + if (PTR_ERR(pwm->rst) == -EPROBE_DEFER) > > + return PTR_ERR(pwm->rst); > > + dev_info(&pdev->dev, "no reset control found\n"); > > I would degrade this to a dev_dbg. Otherwise this spams the log for all > unaffected machines. The _optional variants return NULL if the reset is not specified in the device tree, so this is not "no reset control found", but a real error that should be returned. > devm_reset_control_get_optional() is defined in a section that has a > comment "These inline function calls will be removed once all > consumers have been moved over to the new explicit API.", so I guess > you want devm_reset_control_get_optional_exclusive or even > devm_reset_control_get_optional_shared here. Correct. If this driver deasserts in probe() and asserts the reset in remove(), this can use the refcounting _shared variant. > @Philipp: maybe a check in checkpatch that warns about introduction of > such new instances would be good?! Yes, that would be helpful. regards Philipp