From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755366Ab2DXHm2 (ORCPT ); Tue, 24 Apr 2012 03:42:28 -0400 Received: from caramon.arm.linux.org.uk ([78.32.30.218]:34672 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754861Ab2DXHm1 (ORCPT ); Tue, 24 Apr 2012 03:42:27 -0400 Date: Tue, 24 Apr 2012 08:42:03 +0100 From: Russell King - ARM Linux To: Andrew Lunn Cc: Viresh Kumar , "akpm@linux-foundation.org" , "sshtylyov@mvista.com" , spear-devel , "linux-kernel@vger.kernel.org" , "linux-ide@vger.kernel.org" , "viresh.linux@gmail.com" , "mturquette@linaro.org" , "jgarzik@redhat.com" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH V2 4/9] ata/sata_mv: Remove conditional compilation of clk code Message-ID: <20120424074202.GO24211@n2100.arm.linux.org.uk> References: <20120424070426.GA24089@lunn.ch> <4F9650B3.9030406@st.com> <20120424072653.GB24089@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120424072653.GB24089@lunn.ch> User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 24, 2012 at 09:26:53AM +0200, Andrew Lunn wrote: > On Tue, Apr 24, 2012 at 12:35:23PM +0530, Viresh Kumar wrote: > > On 4/24/2012 12:34 PM, Andrew Lunn wrote: > > > I don't think this change is correct. With the old semantics, it was: > > > > Sorry. :( > > > > > If we have CLK support, we expect there to be a clock for sata_mv, and > > > if there is no such clock, output a notice message, something is > > > probably wrong, i expected there to be a clock. > > > > > > The new semantics are: > > > > > > We expect there to be a clock for sata_mv, and if there is no such > > > clock, output a notice message, something is probably wrong, i > > > expected there to be a clock. > > > > > > We are going to see this notice message much more, when it is not > > > expected. > > > > So, the only problem is this message? > > How do you suggest to tackle this now. Have #ifdef,#endif around this print? > > Well, adding #ifdef defeats the point of adding dummy implementations. > > Maybe, rather than return -ENODEV, return -ENOTSUP. > > IS_ERR() still returns true, so in most cases, no code needs > changing. However, when you need to differentiate between, "clock does > not exists" and "Dummy clock functions being used", you can tell the > difference. mv_sata could look like: > > hpriv->clk = clk_get(&pdev->dev, NULL); > if (IS_ERR(hpriv->clk)) > if (PTR_ERR(hpriv->clk) == -ENODEV) > dev_notice(&pdev->dev, "cannot get clkdev\n"); > else > clk_prepare_enable(hpriv->clk); > > > You would however, need to look at all uses of clk_get and see if any > are looked for ENODEV, and not just IS_ERR(), and fix those.... Why bother? If you don't have the clk API configured, you have no clocks to control. So, why not make clk_get() return NULL, and make the rest of the API calls do nothing? That's what you'll end up codifying in the drivers anyway.