From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756400AbcG1K4x (ORCPT ); Thu, 28 Jul 2016 06:56:53 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:44044 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754543AbcG1K4x (ORCPT ); Thu, 28 Jul 2016 06:56:53 -0400 Message-ID: <1469703408.12835.30.camel@pengutronix.de> Subject: Re: Why do we need reset_control_get_optional() ? From: Philipp Zabel To: Arnd Bergmann Cc: Masahiro Yamada , Hans de Goede , Lee Jones , Linux Kernel Mailing List , linux-arm-kernel , Axel Lin , Maxime Ripard Date: Thu, 28 Jul 2016 12:56:48 +0200 In-Reply-To: <5955443.3UvZHD6laK@wuerfel> References: <1469698980.12835.18.camel@pengutronix.de> <5955443.3UvZHD6laK@wuerfel> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:96de:80ff:fec2:9969 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Donnerstag, den 28.07.2016, 12:09 +0200 schrieb Arnd Bergmann: > On Thursday, July 28, 2016 11:43:00 AM CEST Philipp Zabel wrote: > > > I want to deprecate _optional variants in the following steps: > > > > > > [1] Add "depends on RESET_CONTROLLER" to drivers > > > for which reset_control is mandatory. > > > > > > We can find those driver easily by grepping > > > the reference to non-optional reset_control_get(). > > > > Since we have the stubs, the RESET_CONTROLLER dependency is only at > > runtime, not at build time. > > > > I think Arnd wanted to move this in the opposite direction and remove > > the configurable RESET_CONTROLLER symbol. Maybe we should let all > > drivers that currently request non-optional resets have: > > depends on (ARCH_HAS_)RESET_CONTROLLER || COMPILE_TEST > > ? > > There are various ways to improve the current situation. > > I think it's important that a driver that has an optional > reset line behaves in exactly the same way whether the reset > subsystem is enabled or disabled when no reset line is > provided for a machine. Agreed. > When a driver requires a reset line, we can either have a > build-time failure when the reset subsystem is disabled > (enforcing the Kconfig dependency), That would have been the case before commit 5bcd0b7f3c56 ("reset: Add (devm_)reset_control_get stub functions"). Now that we allow compiling all drivers with the stubs, I suppose option B is the way to go: > or cause a runtime failure if either there is no reset line or > the subsystem is disabled. > In my experimental patch, I make the _optional functions > return NULL if no "resets" property is provided but return > an error if there are reset lines but the subsystem is > disabled, i.e. an optional reset must be used if it's in the > DT, but can be ignored otherwise. I have to admit I don't understand the purpose of that. reset_controller_get_optional returns -ENOENT if there's no reset in the DT, and all drivers act accordingly. regards Philipp