Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966342AbbBCRRy (ORCPT ); Tue, 3 Feb 2015 12:17:54 -0500 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:45752 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965829AbbBCRRw (ORCPT ); Tue, 3 Feb 2015 12:17:52 -0500 Date: Tue, 3 Feb 2015 17:17:33 +0000 From: Russell King - ARM Linux To: Lars-Peter Clausen Cc: Mark Brown , Manuel Lauss , alsa-devel , Richard Purdie , patches@opensource.wolfsonmicro.com, LKML , linux-sound@vger.kernel.org, Manuel Lauss , Bo Shen , linux-arm-kernel@lists.infradead.org, Liam Girdwood Subject: Re: [alsa-devel] [RFC PATCH] ASoC: wm8731: let codec to manage clock by itself Message-ID: <20150203171733.GY8656@n2100.arm.linux.org.uk> References: <1422934415-24957-1-git-send-email-voice.shen@atmel.com> <20150203124441.GK21293@sirena.org.uk> <54D0FD1C.9020305@metafoo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54D0FD1C.9020305@metafoo.de> 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: 1521 Lines: 33 On Tue, Feb 03, 2015 at 05:53:48PM +0100, Lars-Peter Clausen wrote: > On 02/03/2015 01:44 PM, Mark Brown wrote: > >On Tue, Feb 03, 2015 at 08:54:57AM +0100, Manuel Lauss wrote: > > > >>+ wm8731->mclk = devm_clk_get(&spi->dev, "mclk"); > >>+ if (IS_ERR(wm8731->mclk)) { > >>+ wm8731->mclk = NULL; > >>+ dev_warn(&spi->dev, "assuming static MCLK\n"); > >>+ } > > > >This is broken for both deferred probe and in the case where the clock > >API genuinely returns a NULL clock. Other than that it's the kind of > >thing that we've done for some other drivers, though it's not good to > >have to do this. Check them for correct behaviour. > > Ideally we'd introduce a {devm_}clk_get_optional(), with the same semantics > as gpiod_get_optional(), which handles the finer details of differentiating > between clock specified, but not yet probed, clock specified, but > incorrectly and no clock specified, so this doesn't have to be done over and > over by each driver. No, we don't need to. It clk_get() already knows this distinction, and it appropriately returns -ENOENT vs -EPROBE_DEFER according to whether there's a clock specified in DT or not. -- 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/