Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp751819ybx; Tue, 5 Nov 2019 05:06:27 -0800 (PST) X-Google-Smtp-Source: APXvYqx5QjVrpHlPb0aFNgg0JzmDcPgrMsmMXp9upuzc0k494h8Lp0lKR+PuF4NVABDW8tmlWhZ8 X-Received: by 2002:a50:b626:: with SMTP id b35mr31486817ede.183.1572959187219; Tue, 05 Nov 2019 05:06:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572959187; cv=none; d=google.com; s=arc-20160816; b=s2aaUPWMORqae3mgZVwjBjFuV6tB+wMe0Q6n6URC65R2nx1KD5S38YGBC+dMV4/Dru /PEwSTN47ytWQuH2e/feibsL+NxJRQoFqFVpPf4d3giicPN/jlG6a1k0YfirbxTzie4m 1unGhweGRZl1rrqvK3fzQbTAJ35+tg19hS1LEP31C/n8C7HdkzTrp06jDdH8FcSLHgBS 5Jr7llfUBlesg41KymZNEkL0Fz0Yth7uooIVTxrR5tlmcam6BfLJnBASKQtTdcSKCmA3 4QVdESB6m2UlGCDLri/8GgejYAv204xAm087/sMCT4O9/5rsjOPAiuFv6ePn2O3ThduO L47Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Z7ne9Wa4hkz+N8qPGF4Ypu88eeGd3GHGKnFHgzFLi7Q=; b=OXz4kg+Yx8nGBLvnttLoDfNpcrEYQINZoDQI/cZA4Tigbj1ox0yy43sktEcCdYUGCN aqRVs5X8ryhMq5VS4fUwREHMcol+gyGBqzT+9RfXUlXg3EoANdzsDrAq9DG2noMUaZ1W bSfrPkk84esQRg1MUDH7Rz+riFRTOFB5hqV3dPASdXA86cWm0z5Z3Sb7bJLXS1jmU5qy h+dxuzpUbsXUqwehlqHeHrv6bOserWnzNmtCbjXhDsruHHqHmtVOPiMLj7hRpKGKGkAH ANnQndELKmp17lbWRrdpEtn4rusxZFpQtj1C2B3N5Uf+sywsHd/E4LOGoYY5yPRLBKD+ zD0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=txABY5fF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z35si9745494edz.260.2019.11.05.05.06.01; Tue, 05 Nov 2019 05:06:27 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=txABY5fF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388971AbfKENDn (ORCPT + 99 others); Tue, 5 Nov 2019 08:03:43 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34329 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388925AbfKENDm (ORCPT ); Tue, 5 Nov 2019 08:03:42 -0500 Received: by mail-wm1-f66.google.com with SMTP id v3so16464529wmh.1; Tue, 05 Nov 2019 05:03:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Z7ne9Wa4hkz+N8qPGF4Ypu88eeGd3GHGKnFHgzFLi7Q=; b=txABY5fF1AnrWY9DzF/uQFqxAFxDVFjW/2ptH7Oh3g77rHSCwX8bWUoRWCU44tjyho jknQ5DAzGqGmeOTu6oxMNjkHgPOVmNxawihgF9EaOwTkZLRIp//0XfPPx1EosvhOP1jb /no4Fax2YHDPut8GAzFOjiRxg5DsLBkgUVME5Hj4bfsFWwj+YlNMuZQxxXQPu+F9LHzt KbFArlYcbYVFo6Fr1ELHBKE/rTyiCg4Sib2m3XTzIjrtlo1fZc25EHipn72C3jH00JaL ssYfNt4wPQaI3rsCIozs6VSVVMr5DRf5VJFM9PiH1oS11VJs63BC1jUbFJOHC+x8j+xm cCUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Z7ne9Wa4hkz+N8qPGF4Ypu88eeGd3GHGKnFHgzFLi7Q=; b=FtErgCCSLkS95DJk3bpYN6csDYsPQORrxquV/FzKGnTJCKcCGdojdVzcNGOw6GLWlQ c5m6bI5H5jLURp8DhdPacox/gzzsv0P6g8lkNpE98N0i4pnDl7tN9sV0lTcfy04HaCkd a8XU6oJwBb79s4z0nN+XYkugmxZxlph52lXq2maYvGTKn8PfYxMp0XhdH7kzEczM+K8e OSclzG7EpUkffe8lopzfRc9rN8gjl3CZpMoSFNRv0sYVBM/UHvX7tMZiWciXDlNBHyuG Fh86bcyrLl8Y8d7DEnsWjsvvMEHD4tRxsV1o5RbXwFATx1SjanCUOolPMczBkTEcrq9t /JvA== X-Gm-Message-State: APjAAAUiUtDrbuuktxlapIN6tWO8MzqqZ1MX8Ptq+0cOBITXFIaZssVQ 2obLCBfhTFg/B8YDUsj5yx7QGt8TZvrDhJUoMCs= X-Received: by 2002:a1c:2342:: with SMTP id j63mr3964562wmj.56.1572959020153; Tue, 05 Nov 2019 05:03:40 -0800 (PST) MIME-Version: 1.0 References: <20191103203334.10539-1-peron.clem@gmail.com> <20191103203334.10539-3-peron.clem@gmail.com> <20191104081157.373v22atswsaktbe@pengutronix.de> <20191105070128.ve73ha5ibiymcxnx@pengutronix.de> In-Reply-To: <20191105070128.ve73ha5ibiymcxnx@pengutronix.de> From: =?UTF-8?B?Q2zDqW1lbnQgUMOpcm9u?= Date: Tue, 5 Nov 2019 14:03:29 +0100 Message-ID: Subject: Re: [PATCH v2 2/7] pwm: sun4i: Add an optional probe for reset line To: Philipp Zabel Cc: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Thierry Reding , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , linux-pwm@vger.kernel.org, devicetree , linux-arm-kernel , linux-kernel , Jernej Skrabec Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Philipp, On Tue, 5 Nov 2019 at 08:01, Philipp Zabel wrote: > > On Mon, Nov 04, 2019 at 09:11:57AM +0100, Uwe Kleine-K=C3=B6nig wrote: > > Hello, > > > > adding Philipp Zabel (=3D 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=C3=A9ment P=C3=A9ron 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=C3=A9ment P=C3=A9ron > > > --- > > > 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_devic= e *pdev) > > > if (IS_ERR(pwm->clk)) > > > return PTR_ERR(pwm->clk); > > > > > > + pwm->rst =3D devm_reset_control_get_optional(&pdev->dev, NULL); > > > + if (IS_ERR(pwm->rst)) { > > > + if (PTR_ERR(pwm->rst) =3D=3D -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. Correct, Thanks for the catch, Cl=C3=A9ment > > > 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