Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755105AbbBJLCu (ORCPT ); Tue, 10 Feb 2015 06:02:50 -0500 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:60070 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754771AbbBJLCs (ORCPT ); Tue, 10 Feb 2015 06:02:48 -0500 Date: Tue, 10 Feb 2015 11:02:42 +0000 From: Russell King - ARM Linux To: Wolfram Sang Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] clk: return proper ERR_PTR for clk_get when !HAVE_CLK Message-ID: <20150210110242.GI8656@n2100.arm.linux.org.uk> References: <1423163365-15267-1-git-send-email-wsa@the-dreams.de> <20150205234040.GV8656@n2100.arm.linux.org.uk> <20150207164209.GA6263@katana> <20150207172949.GE8656@n2100.arm.linux.org.uk> <20150209142954.GA8024@katana> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150209142954.GA8024@katana> 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: 1547 Lines: 30 On Mon, Feb 09, 2015 at 03:29:54PM +0100, Wolfram Sang wrote: > ... which has to do with this. Historically, "clock-frequency" in DT > means the i2c bus speed. This driver used the binding wrong to specify > the IP core clock speed instead and also used a fixed I2C bus speed > then. Now, when wanting to support a) flexible I2C bus speeds and b) > clock information from standard DT clock bindings, we also need to > ensure that we support the now deprecated and wrong binding as a > fallback. And even after having learnt something about the clk API now, > I still think the best fix is to replace all instances of 'if > (!IS_ERR(dev->clk))' with (!IS_ERR_OR_NULL()). Because in our case, NULL > is not success. We should skip any clk API interaction then and use the > fallback mechanisms. I disagree; I also utterly _hate_ IS_ERR_OR_NULL - this macro has been responsible for a /lot/ of error handling bugs, and I wish the macro would die. The "test-for-zero-clock-rate" method I showed in my previous email will work for you - and will avoid using this hateful macro while still giving the behaviour you desire, and you won't be caring about the detail of the clk API implementation either. -- 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/