From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758058AbcHYUxS (ORCPT ); Thu, 25 Aug 2016 16:53:18 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:16728 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753912AbcHYUxP (ORCPT ); Thu, 25 Aug 2016 16:53:15 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Thu, 25 Aug 2016 13:49:03 -0700 Subject: Re: [PATCH 5/6] i2c: tegra: Add runtime power-management support To: Wolfram Sang References: <1470910620-9898-1-git-send-email-jonathanh@nvidia.com> <1470910620-9898-6-git-send-email-jonathanh@nvidia.com> <20160825192631.GA1614@katana> CC: Laxman Dewangan , Stephen Warren , Thierry Reding , Alexandre Courbot , , , From: Jon Hunter Message-ID: Date: Thu, 25 Aug 2016 21:53:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160825192631.GA1614@katana> X-Originating-IP: [10.26.11.206] X-ClientProxiedBy: UKMAIL101.nvidia.com (10.26.138.13) To UKMAIL101.nvidia.com (10.26.138.13) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/08/16 20:26, Wolfram Sang wrote: > * PGP Signed by an unknown key > > >> @@ -407,32 +410,39 @@ static inline int tegra_i2c_clock_enable(struct tegra_i2c_dev *i2c_dev) >> return ret; >> } >> } >> + >> ret = clk_enable(i2c_dev->div_clk); >> if (ret < 0) { >> dev_err(i2c_dev->dev, >> "Enabling div clk failed, err %d\n", ret); >> clk_disable(i2c_dev->fast_clk); >> + return ret; >> } >> - return ret; >> + >> + return 0; > > You could have left the original 'return' instead of the 2 new ones, but > you decide. Yes I know, but I wanted to ensure for runtime-pm we only return 0 on success. Yes clk_enable should only return 0 on success and a negative error code otherwise, but I prefer this. So will leave as-is. >> - if (tegra_i2c_flush_fifos(i2c_dev)) >> - err = -ETIMEDOUT; >> + err = tegra_i2c_flush_fifos(i2c_dev); > > 'err' is assigned but where is it checked? It will be returned by the function. This is no different to how it works today if you look at the code. I did think about checking it right after this call and returning but then I am changing the behaviour and that should be another patch. I am not sure why it is like this in the first place, but I did not wish to introduce any different behaviour here. Cheers Jon -- nvpublic