Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp683367imm; Fri, 12 Oct 2018 05:09:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV63mjEGQ6X00Oai3T1NHiSDSOwTixTTXlehFe9Eq5umnfoK7qndxltMkDz1xmjsSsvVX9N3e X-Received: by 2002:a63:2441:: with SMTP id k62-v6mr5428169pgk.26.1539346180368; Fri, 12 Oct 2018 05:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539346180; cv=none; d=google.com; s=arc-20160816; b=v/UdF4nmoBzRtD828RHyDJwJT3RlX5nHD4YnY/8CpvJ6FCP4S4o+Xh23ACnY3tK4YO MiRmw1AH5RZ3HqDYX1tbVaYOi6ekUnd3PkZpYZfUXWGvm6DGrrIs4B6W8NtVxhy9B0gZ ExgsyvPxLm+CfUyfob11AdQuuRhwxXHRV421K0V/Fu/LNXvbjsOLLQ1woa2mv4QywX0D BiF5r9mNFkkjDqbKimasb4EffRxO/oj72hhuagvzQfcdP98TaQgemVnfOG1f9NWKaGBn WhhIyCsa0QS/Icu6lO0sbcvXtaKTmNWQJG3mfKZ1CgxWRLKCGXtWt6zzi8Ly47jRCxp5 UMVg== 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:date:cc:to:from:subject:message-id; bh=sTne+Z9IBU8rJmvoFgzIznZ4mXBzCRK0xtd7x/fVZIM=; b=IUy39mwNgw2d9bBXjLqtH53mFJBJq75CTGGx6z5VgPkrorV4Y0zbGUm2DGvbm4JJsD opLjzTRTOOfrw+8ACqchHrL1GsevPaLXVT9DeDuychD9bVuLEHsojSuPjc4g1Bo3ImVq 5fdD9lrCCNF1j39o2LJU7Cs9NfisVqXVXKuCD73L6B58ZyFpTOaX9v8Ptp3oZtGilzWY DeBdDFQh3rhwlru8UYfPhKbb/UbbrYA5PvXRwTzqxf+XVI2aUTTWkmDQZtZPcasz5beb Tr0Iqs8kjc+RtzJ1cW2esZebV1pFcfvuXr9GkknZhcW+JODBdTuszNU4zbWkhAfqOLkY z9lw== 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 s203-v6si1087234pgs.499.2018.10.12.05.09.25; Fri, 12 Oct 2018 05:09:40 -0700 (PDT) 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 S1728553AbeJLTkt (ORCPT + 99 others); Fri, 12 Oct 2018 15:40:49 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:50239 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728040AbeJLTkt (ORCPT ); Fri, 12 Oct 2018 15:40:49 -0400 Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1gAwFA-0005NX-1D; Fri, 12 Oct 2018 14:08:36 +0200 Message-ID: <1539346114.6204.5.camel@pengutronix.de> Subject: Re: [PATCH v2] ARC: HSDK: improve reset driver From: Philipp Zabel To: Eugeniy Paltsev Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, Alexey Brodkin Date: Fri, 12 Oct 2018 14:08:34 +0200 In-Reply-To: <20180928162856.4726-1-Eugeniy.Paltsev@synopsys.com> References: <20180928162856.4726-1-Eugeniy.Paltsev@synopsys.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@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 Hi Eugeniy, thank you for the update. On Fri, 2018-09-28 at 19:28 +0300, Eugeniy Paltsev wrote: > As for today HSDK reset driver implements only > .reset() callback. > > In case of driver which implements one of standard > reset controller usage pattern > (call *_deassert() in probe(), call *_assert() in remove()) > that leads to inoperability of this reset driver. > > Improve HSDK reset driver by calling .reset() callback inside of > .deassert() callback to avoid each reset controller > user adaptation for work with both reset methods > (reset() and {.assert() & .deassert()} pair) > > Signed-off-by: Eugeniy Paltsev > --- > Changes v1->v2: > * Don't call hsdk_reset_reset in .assert callback. > > drivers/reset/reset-hsdk.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/reset/reset-hsdk.c b/drivers/reset/reset-hsdk.c > index 8bce391c6943..399440f197c5 100644 > --- a/drivers/reset/reset-hsdk.c > +++ b/drivers/reset/reset-hsdk.c > @@ -84,8 +84,21 @@ static int hsdk_reset_reset(struct reset_controller_dev *rcdev, > return ret; > } > > +static int hsdk_reset_dummy(struct reset_controller_dev *rcd, unsigned long id) > +{ > + return 0; > +} > + > +/* > + * Doing real reset from .assert isn't necessary/useful here. So we pass > + * 'hsdk_reset_dummy' to .assert callback to prevent -ENOTSUPP returning by > + * reset_control_assert() to make happy drivers which check > + * reset_control_{assert | deassert} return status. > + */ > static const struct reset_control_ops hsdk_reset_ops = { > .reset = hsdk_reset_reset, > + .assert = hsdk_reset_dummy, Is this part really necessary though? reset_control_assert already returns 0 in shared mode, so the only thing this does is make reset_control_assert return 0 instead of -ENOTSUPP in exclusive mode. The documentation states that calling reset_control_assert "on an exclusive reset controller guarantees that the reset will be asserted." Since this is clearly not the case with this driver, it is appropriate to keep returning an error in this case. If there is a driver that requests an exclusive reset control, calls reset_control_assert, and then checks the error value to see whether asserting the reset succeeded, it should be made aware that we couldn't actually assert the reset line as requested. If the driver can continue operation even though the reset line was not asserted, it should ignore the error. So if you need to hide this error, I'd like to know the actual case that is fixed by this, to see if we can't fix it in a better way. > + .deassert = hsdk_reset_reset, This part is fine. > }; > > static int hsdk_reset_probe(struct platform_device *pdev) regards Philipp