Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752554AbbBKMHk (ORCPT ); Wed, 11 Feb 2015 07:07:40 -0500 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:34121 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752423AbbBKMHi (ORCPT ); Wed, 11 Feb 2015 07:07:38 -0500 Date: Wed, 11 Feb 2015 12:07:27 +0000 From: Russell King - ARM Linux To: Andy Shevchenko Cc: Viresh Kumar , Heikki Krogerus , Vinod Koul , "linux-kernel@vger.kernel.org" , dmaengine@vger.kernel.org Subject: Re: [PATCH] dmaengine: dw: support for clockless platforms Message-ID: <20150211120727.GQ8656@n2100.arm.linux.org.uk> References: <1421758677-183443-1-git-send-email-heikki.krogerus@linux.intel.com> <1423656159.31903.502.camel@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423656159.31903.502.camel@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1404 Lines: 33 On Wed, Feb 11, 2015 at 02:02:39PM +0200, Andy Shevchenko wrote: > On Wed, 2015-02-11 at 10:10 +0800, Viresh Kumar wrote: > > > chip->clk = devm_clk_get(chip->dev, "hclk"); > > > - if (IS_ERR(chip->clk)) > > > - return PTR_ERR(chip->clk); > > > + if (IS_ERR(chip->clk)) { > > > + if (PTR_ERR(chip->clk) == -ENOENT) > > > + chip->clk = NULL; > > > > You don't need to set it to NULL, if CONFIG_HAVE_CLK isn't set > > the dummy routines would take care of it. > > Yeah, but in our case we have CONFIG_HAVE_CLK=y and no clk is provided > since IP is clockless. What could you suggest to do in such case? chip->clk = devm_clk_get(chip->dev, "hclk"); if (IS_ERR(chip->clk) && PTR_ERR(chip->clk) != -ENOENT) return PTR_ERR(chip->clk); You can then test for the presence of a clk via IS_ERR(chip->clk). I'm just debating whether we should add a clk_is_valid() inline function to linux/clk.h to avoid these shouting tests, and make it easier for people test this in a generic manner. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/