Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1311348imm; Wed, 25 Jul 2018 15:49:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfrL+VGIuREltkS2lRKb0vfvxN8FlTSJX3DQNRMHmgschcLKKO1mW75C2W9LxH29qM/eJ8Z X-Received: by 2002:a17:902:7e06:: with SMTP id b6-v6mr22580040plm.230.1532558971706; Wed, 25 Jul 2018 15:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532558971; cv=none; d=google.com; s=arc-20160816; b=NjqHIv3htqz5e6Y/cfTUWPnE8ZZbytCXRl3UNTDQugjcJlCjhGBWDxxgo1VlpoCl/Q n2lKd/5F1D2/styfH1cM87OvXqqI2bvn5NVhE6HXwKAw7899TqR1Yph2GcvcaEdolsAX JpMLFG0Id9q817x2jh+W8Bm54EZp5O/zvR8oojQHtAfQINRaJbNxPgpPXuwAFq6kfWD/ HhSNN14A9rhcRTgnVRxTlAIEbJ/N+oSmOiDvqPYgFmBelH/vxqbldd/BA6rwRVPrVKNs 1kOajUWoTi1Qqd76eS08n1Bjg0LPPw4IjvUbohoOPL+WRtD4vWi1xVeoE+H/9FKMLM+B UQwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:dkim-signature:arc-authentication-results; bh=maoECTNJQ7JLm/p1B7OFBxDzJUsD6Rjac+VLx/J63TY=; b=BsJWK/EWD6MbcAia+AUcLfVKXd3Av3TPcttJYO2fCYLb7MvL5gkYx0kV2lj3TncgW6 YIWl7WIzIputw7JIPloKe7HCOKW+eMSyT0mb7PpacL7tDWU+w0I5e0IFNVNiOIlAw85x xIGqrz3eC0PLHM1P1pYK4qEZ691936eQxKmxL08iENeB8lbSJFWNtZ2enjk3gAQv52Gi d0Ts3sJr3S8Xuay2yRkaFD+KP5DJ+d621IFe5qQ8KJ4pKkwvWHf057N+/xaLGcLsKVFc tsuf2CfHKxhbxl1zxbAuNPVz0pRHcVXWdE9DNKD9MAPE9cZRVHyAw5DSfmY3H/yFj6iK 3FDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XnBpCXOe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f16-v6si15702119pfd.276.2018.07.25.15.49.16; Wed, 25 Jul 2018 15:49:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XnBpCXOe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731701AbeGYXuv (ORCPT + 99 others); Wed, 25 Jul 2018 19:50:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:50052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729182AbeGYXuv (ORCPT ); Wed, 25 Jul 2018 19:50:51 -0400 Received: from localhost (unknown [104.132.1.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8C6F920833; Wed, 25 Jul 2018 22:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1532558223; bh=bYkMChIkP+dciOzPj+vO2CS7681GWIQFZAONrnnwQ7I=; h=To:From:In-Reply-To:Cc:References:Subject:Date:From; b=XnBpCXOeOpH/shsYv2aiA/TjFtTuz5E4fpvPFUrchh4M4g+eK4qVBFmHaMzPZJqwK SGQCovw5xvHCp2898787L1AsG2v21ZThvvVSHrroP3+jlb+TAatOlHkC8i2VmrPaAZ Y13LYnFR6BpCo13P2vejMMIticxsxtpWwYdzoUNM= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: Geert Uytterhoeven , Phil Edworthy , Russell King From: Stephen Boyd In-Reply-To: Cc: Michael Turquette , Linux Kernel Mailing List , Simon Horman , Andy Shevchenko , linux-clk , Linux ARM References: <1531918658-32278-1-git-send-email-phil.edworthy@renesas.com> <20180718130228.GG17271@n2100.armlinux.org.uk> Message-ID: <153255822286.48062.3193076486782567960@swboyd.mtv.corp.google.com> User-Agent: alot/0.7 Subject: RE: [PATCH] clk: Add functions to get optional clocks Date: Wed, 25 Jul 2018 15:37:02 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Phil Edworthy (2018-07-18 06:56:26) > Hi Russell, > = > On 18 July 2018 14:19, Geert Uytterhoeven wrote: > > On Wed, Jul 18, 2018 at 3:02 PM Russell King - ARM Linux wrote: > > > On Wed, Jul 18, 2018 at 01:57:38PM +0100, Phil Edworthy wrote: > > > > Behaves the same as (devm_)clk_get except where there is no clock > > > > producer. In this case, instead of returning -ENOENT, the function > > > > returns NULL. This makes error checking simpler and allows > > > > clk_prepare_enable, etc to be called on the returned reference > > > > without additional checks. > > > > > > How does this work with non-DT systems, where looking a clock up which > > > isn't yet registered with clkdev returns -ENOENT ? > > > > > > (clkdev doesn't know when all clocks are registered with it.) > > = > > Good question. > > = > > I guess all drivers trying to handle optional clocks this way are alrea= dy broken > > on non-DT systems where clocks may be registered late... > = > So how do non-DT systems that look a clock up which isn't yet > registered with clkdev, determine that an optional clock is there > or not? > = Short answer is they don't. I'd still prefer we have this API though. Can you rework this patch to be a little more invasive into the clk_get() path, perhaps by reworking __of_clk_get_by_name() a little to take an 'optional' argument, so that it only returns NULL when the clk is looked up from DT? The fallback path in clkdev where we have a DT based system looking up a clk through clkdev lookups doesn't seem to be a real scenario that we should worry about here. I think sometimes people use clkdev lookups when they're migrating to DT systems and things aren't wired up properly in DT, but that isn't the norm.