Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753618AbdCONV2 convert rfc822-to-8bit (ORCPT ); Wed, 15 Mar 2017 09:21:28 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:49824 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751125AbdCONU3 (ORCPT ); Wed, 15 Mar 2017 09:20:29 -0400 From: Patrice CHOTARD To: Philipp Zabel , "linux-mmc@vger.kernel.org" CC: Adrian Hunter , Ulf Hansson , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 07/14] mmc: sdhci-st: simplify optional reset handling Thread-Topic: [PATCH v2 07/14] mmc: sdhci-st: simplify optional reset handling Thread-Index: AQHSnX+80+7TNW3uIUOOx9759Fuow6GV0gQA Date: Wed, 15 Mar 2017 13:20:19 +0000 Message-ID: References: <20170315113141.20238-1-p.zabel@pengutronix.de> In-Reply-To: <20170315113141.20238-1-p.zabel@pengutronix.de> Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.51] Content-Type: text/plain; charset="Windows-1252" Content-ID: Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-15_03:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2314 Lines: 79 Hi Philipp On 03/15/2017 12:31 PM, Philipp Zabel wrote: > As of commit bb475230b8e5 ("reset: make optional functions really > optional"), the reset framework API calls use NULL pointers to describe > optional, non-present reset controls. > > This allows to return errors from devm_reset_control_get_optional and to > call reset_control_(de)assert unconditionally. > > Signed-off-by: Philipp Zabel > --- > drivers/mmc/host/sdhci-st.c | 19 +++++++------------ > 1 file changed, 7 insertions(+), 12 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c > index ed92ce729dde1..5a782b9bae381 100644 > --- a/drivers/mmc/host/sdhci-st.c > +++ b/drivers/mmc/host/sdhci-st.c > @@ -371,11 +371,10 @@ static int sdhci_st_probe(struct platform_device *pdev) > if (IS_ERR(icnclk)) > icnclk = NULL; > > - rstc = devm_reset_control_get(&pdev->dev, NULL); > + rstc = devm_reset_control_get_optional(&pdev->dev, NULL); > if (IS_ERR(rstc)) > - rstc = NULL; > - else > - reset_control_deassert(rstc); > + return PTR_ERR(rstc); > + reset_control_deassert(rstc); > > host = sdhci_pltfm_init(pdev, &sdhci_st_pdata, sizeof(*pdata)); > if (IS_ERR(host)) { > @@ -435,8 +434,7 @@ static int sdhci_st_probe(struct platform_device *pdev) > err_of: > sdhci_pltfm_free(pdev); > err_pltfm_init: > - if (rstc) > - reset_control_assert(rstc); > + reset_control_assert(rstc); > > return ret; > } > @@ -453,8 +451,7 @@ static int sdhci_st_remove(struct platform_device *pdev) > > clk_disable_unprepare(pdata->icnclk); > > - if (rstc) > - reset_control_assert(rstc); > + reset_control_assert(rstc); > > return ret; > } > @@ -470,8 +467,7 @@ static int sdhci_st_suspend(struct device *dev) > if (ret) > goto out; > > - if (pdata->rstc) > - reset_control_assert(pdata->rstc); > + reset_control_assert(pdata->rstc); > > clk_disable_unprepare(pdata->icnclk); > clk_disable_unprepare(pltfm_host->clk); > @@ -489,8 +485,7 @@ static int sdhci_st_resume(struct device *dev) > clk_prepare_enable(pltfm_host->clk); > clk_prepare_enable(pdata->icnclk); > > - if (pdata->rstc) > - reset_control_deassert(pdata->rstc); > + reset_control_deassert(pdata->rstc); > > st_mmcss_cconfig(np, host); > > Acked-by: Patrice Chotard Thanks