Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp579911ybl; Sat, 18 Jan 2020 06:33:50 -0800 (PST) X-Google-Smtp-Source: APXvYqw8zJ5y1D5Il5PogNCCx3lz01Io0OJ6yGzSdGPq1kfea88z/VJP4Zd5Jsby54JjoUPXW2eD X-Received: by 2002:a9d:65cb:: with SMTP id z11mr9462721oth.348.1579358030468; Sat, 18 Jan 2020 06:33:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579358030; cv=none; d=google.com; s=arc-20160816; b=VD6vuOc1YktjPyjCVHtHSqsORwpN/nyHv4n/5Nw92KYZazcG8HRACBNRRnq7v22k85 iCGgPtBc+U4qjk6/0Ru3OGtC2NIpy9t2bvn+cvYi3kGXNNVNlT+XAP8UqYZ3s25G0HTa Mm7CBwUpFLzwqtqHeBIBQD9Ck2E4MA2MktKMfOkEm4CCgDRf4quPDZjFzhMjRIgQaTG/ SwdplDnxbAF++Q97L9vNd/lpmFwfQPGNx+OSdgQU0ZBFTwYU9UtZsxOT2hFyeLZs9oyz Nzx7N5acuSexmX8c+GTjYZvdCY6l9dp+dGhQZsTTxilrPPOlS2sGu88D00n8P9rEeQVY tM6A== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=F7A3KCBBGjh+UWvRRbFd6nHnlSJZBf1zbR/HwhVyDwQ=; b=TWeNigZLQqq68lxQfXGUay6YNaMwKd+qoEPP0ZvZbbEiC+FnRJ3cT4l2IdJu4pvHaw JvPUjpxfZSERs/9elWwUjd58jmGpx10+yVYsRyfHjnrGCTkr5t/LcFIvtEKk4SgzQYsE 6tJ5zHH6cn/A7Azk/t8azWey4fbZNmuUh6nPJH0srZe8clitrhAR33HhkY0okxXpF3gq qiOJnIFHglxV4v21eS9rsTT8y8PLd02chclkb/wskHVjlEA9zNrsAcNw9+Evraxln+eb pNPjA/oHsZ7EaBxwbmEf31hOi5Rpy92EG2OC4fX9kgjZJMjSOrFOUahKLMa/ZRioq918 AFgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0GL8Sn03; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x11si14974843oic.185.2020.01.18.06.33.38; Sat, 18 Jan 2020 06:33: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; dkim=pass header.i=@kernel.org header.s=default header.b=0GL8Sn03; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726579AbgAROcl (ORCPT + 99 others); Sat, 18 Jan 2020 09:32:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:54398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726208AbgAROcl (ORCPT ); Sat, 18 Jan 2020 09:32:41 -0500 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 046A72469A; Sat, 18 Jan 2020 14:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579357961; bh=2gpBuuvhYqy8RvrcBZ6bAFOgb2g6EP4XMMQ95aGZvKA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=0GL8Sn03Xa52kpQ5+KYaDSu2O5damtoCfh914pmIzR1RJ0uoqJTGmjBL+smWd3DhC eofUbsfz99ZMPKpe1VakxqNVaBnlJwftR+9Mi5ZBF17402M3timem9g35dIx+p+klp tIEQP2CwbuYIrNghF2HSrfDv+U2VJ72qZUaMGB2U= Date: Sat, 18 Jan 2020 14:32:35 +0000 From: Jonathan Cameron To: Fabrice Gasnier Cc: , , , , , , , , , , Subject: Re: [PATCH 2/2] iio: dac: stm32-dac: better handle reset controller failures Message-ID: <20200118143235.71a67b76@archlinux> In-Reply-To: <1578921266-6025-3-git-send-email-fabrice.gasnier@st.com> References: <1578921266-6025-1-git-send-email-fabrice.gasnier@st.com> <1578921266-6025-3-git-send-email-fabrice.gasnier@st.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 13 Jan 2020 14:14:26 +0100 Fabrice Gasnier wrote: > From: Etienne Carriere > > Use devm_reset_control_get_optional_exclusive() instead of > devm_reset_control_get_exclusive() as reset controller is optional. > > Nevertheless if reset controller is expected but reports an > error, propagate the error code to the caller. In such case > a nice error trace is emitted unless we're deferring the probe > operation. > > Signed-off-by: Etienne Carriere > Signed-off-by: Fabrice Gasnier Applied to the togreg branch of iio.git and pushed out as testing. Thanks, Jonathan > --- > drivers/iio/dac/stm32-dac-core.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c > index 4d93446..7e5809b 100644 > --- a/drivers/iio/dac/stm32-dac-core.c > +++ b/drivers/iio/dac/stm32-dac-core.c > @@ -147,8 +147,16 @@ static int stm32_dac_probe(struct platform_device *pdev) > priv->common.vref_mv = ret / 1000; > dev_dbg(dev, "vref+=%dmV\n", priv->common.vref_mv); > > - rst = devm_reset_control_get_exclusive(dev, NULL); > - if (!IS_ERR(rst)) { > + rst = devm_reset_control_get_optional_exclusive(dev, NULL); > + if (rst) { > + if (IS_ERR(rst)) { > + ret = PTR_ERR(rst); > + if (ret != -EPROBE_DEFER) > + dev_err(dev, "reset get failed, %d\n", ret); > + > + goto err_hw_stop; > + } > + > reset_control_assert(rst); > udelay(2); > reset_control_deassert(rst);