Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1020872imm; Fri, 27 Jul 2018 09:52:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeJ9U8Z2z8NAQq5+iPXnxzqmC8YRUb19sxipf3ILfheeRigsveH6TBuyA600uk5eEuQIFYy X-Received: by 2002:a65:5784:: with SMTP id b4-v6mr6951854pgr.315.1532710345196; Fri, 27 Jul 2018 09:52:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532710345; cv=none; d=google.com; s=arc-20160816; b=bAza4CyEpJJ6xI69tzhSPrHbFCXxWcA5n4+6NqIond02ioYSDXYjTFcbt3DpbrizS5 uBbFIhDTbWg4wpEnr8zCU0YiPR2VQjqH9aKxF9EsE+0p18WZ3SDUbDWNR4h4gB7Ilfgj L+WtfUwsqjPsLecAwsVpR2ME3i0LtFq61olc22jn24wyLfVqXDmPp8CHpYPacU6XUtGN vtD38wVLLjfSuqltfPLpN4FL4pHt2QlfUG5AXLCpQpY5nNIPOFyrKxDIAvQdf+sam8JB fxfUBkDxO+jGQsOjtQ3kxcq/JldGUKyTJGcM+f4dZwjxYl0jB2D51IwYs885pJfdKJjB UfCA== 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=/03E+cSJ8WXEBJVEIbMhnZVjKRh4Mxokk9U7gKrLv1g=; b=t4equ78cv24/elUE0T2EYgaYl9zVI9my6NG7KF3S22Dhhw8tIbSFA9VdOvSeTSzoby Fr9YcMikmq/ntemy3M1WfNO9GewngIloPYyhQSrK3Z5D9lDYPiCcSETelP611/8sMk3k j0DGTkw369EhBfc3MIPGj9b7ge2kmkOjGNySxnZyd2wvf93RZPEOkSBtwRYzXZeGfZc7 EeCLvxLldomJ5IVza4zCMDYDmGNSU1DWO5Vkx5Dubamoh78ig4cv5GrvwxGB3iM789NC +OG/tRJ9jKsjMiFe8IPFNeS+KfXPCbcwYLCqd98uPKR4G6swcI9mEbDwtd25qze8Bzv0 cpvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OwcYYkvH; 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 j124-v6si4668228pfb.191.2018.07.27.09.52.10; Fri, 27 Jul 2018 09:52:25 -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=OwcYYkvH; 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 S2388874AbeG0SNB (ORCPT + 99 others); Fri, 27 Jul 2018 14:13:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:51286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732122AbeG0SNB (ORCPT ); Fri, 27 Jul 2018 14:13:01 -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 4E9C9208B0; Fri, 27 Jul 2018 16:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1532710218; bh=oMYkbw1zBmsk4vP901i/XTt5S8CDCkAgwdFs7/OG4dA=; h=To:From:In-Reply-To:Cc:References:Subject:Date:From; b=OwcYYkvHRukhrkDl9m+/ZwTZwvfvk3pW7rP2NKtUHSZX9tUWrs5UWDfIigOCuQM3y B2s4tZpa0CFPTB9vxOe6+KlB5KTbdrk+PWxEsKepnkIDiW3bY9OCsKsuTa3t4BEJoR BLUccupS0VWib26iBYyRW0oiOUanGrDEtqbOMC/E= 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> <153255822286.48062.3193076486782567960@swboyd.mtv.corp.google.com> Message-ID: <153271021758.48062.12757198387330928176@swboyd.mtv.corp.google.com> User-Agent: alot/0.7 Subject: RE: [PATCH] clk: Add functions to get optional clocks Date: Fri, 27 Jul 2018 09:50:17 -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-27 08:38:12) > On 25 July 2018 23:37, Stephen Boyd wrote: > > 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 w= ired > > up properly in DT, but that isn't the norm. > Do you mean something like this: > = [...] > diff --git a/include/linux/clk.h b/include/linux/clk.h > index 907202b..830209a 100644 > --- a/include/linux/clk.h > +++ b/include/linux/clk.h > @@ -771,6 +771,7 @@ static inline void clk_bulk_disable_unprepare(int num= _clks, > #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) > struct clk *of_clk_get(struct device_node *np, int index); > struct clk *of_clk_get_by_name(struct device_node *np, const char *name); > +struct clk *of_clk_get_by_name_optional(struct device_node *np, const ch= ar *name); > struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec); > #else > static inline struct clk *of_clk_get(struct device_node *np, int index) > = > --- > A lot of drivers use devm_clk_get() so I think a devm_clk_get_optional() > version would be useful. That would probably need an additional > clk_get_optional() function. > = Yes, this would be the first patch, and then the second patch would add clk_get_optional() and devm_clk_get_optional(). We shouldn't encourage consumers to move from device based to DT node based clk_get() for the optional clk API.