Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2575665imu; Mon, 19 Nov 2018 02:48:22 -0800 (PST) X-Google-Smtp-Source: AJdET5dMaNejsBjKs/ySyIZDtUdoOShD5Xbkkxy/HjO6jB+ge/QG7V+7sWf9kvjnzhp5SB9tkBUm X-Received: by 2002:a17:902:6b03:: with SMTP id o3-v6mr21780326plk.208.1542624502856; Mon, 19 Nov 2018 02:48:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542624502; cv=none; d=google.com; s=arc-20160816; b=jfY/HrVOxzoitE+N9DdYl/pJs02fY3ojeEGY9MI4im5XIV5TxM+j/i8JFI/qZDe8v2 nFrtrbWQv6CuQnoxN1NLl1ubscZjpHbFN96EAhLqXNhbUm8+mvtZHvsTT0O/KyvzMS6V lqEMJE4+bFT2ulrQI3cwYkop6iQeNJ47xprRHJ2MK9Y+47nK1Gdk1XdDTWPXNQ6vkAWa hejXORTe++/Au3nnJ+sLCFvZNhpyJEr2ax+pBOyfM3vcQipfWAg7ngjB8XFUYEoQoPpt 6LSX58h6ITTZ2PZuZ7BfyE/woUKNHzlMV3YRn4iVzsvPeI7bki5nantsPoG2YZ4QL9nV g/WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=pSJbe04slKE2BxiL05OhhPfwqzPdldR2KrpLURznNUE=; b=0HuoGjN1tQtLERVMDN2WW8FnIoDJUpvxB7DGVVdLzIejNoUgWjSxh9r/z0pBvuukH/ iUHbppw6pLQsIG4TVqyOiHUeB8XJFLw/Em/4u0u/cnlGr59B/SwVdLb4n8akGAopoYhi h3VKJfm5DxHf26lMayYzcXh6vRJF+lGMhyZkaqN25Z0ujjlfC61avmbuCTE17FtUpsBm x/Y3nueAKECd3F2+uIxqq/n/+//iqc1gzzenBTI5qcIcr3aqMnrJUpTXPtx/CC/aQ56/ xSJvX5xirmCcfcN6q/fYxKfsAvOnx6FK/kiqNvgNXMsLjBftWZ5iRO7UD8dpTS1fC7y3 LzCg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t64si11015424pfd.53.2018.11.19.02.48.07; Mon, 19 Nov 2018 02:48:22 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728072AbeKSVJ1 (ORCPT + 99 others); Mon, 19 Nov 2018 16:09:27 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:39051 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727770AbeKSVJ1 (ORCPT ); Mon, 19 Nov 2018 16:09:27 -0500 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gOh48-0001lt-Hc; Mon, 19 Nov 2018 11:46:04 +0100 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1gOh47-0006cI-D9; Mon, 19 Nov 2018 11:46:03 +0100 Date: Mon, 19 Nov 2018 11:46:03 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Phil Edworthy Cc: Stephen Boyd , Michael Turquette , Andy Shevchenko , Russell King , "linux-clk@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , Geert Uytterhoeven , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v6 1/6] clk: Add of_clk_get_by_name_optional() function Message-ID: <20181119104603.qzuvpoha622l4xvy@pengutronix.de> References: <20181116145937.27660-1-phil.edworthy@renesas.com> <20181116145937.27660-2-phil.edworthy@renesas.com> <20181116160128.pkuya6rwqm4schdn@pengutronix.de> <20181116161122.hhvslbzdujxpk3up@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Phil, On Mon, Nov 19, 2018 at 10:41:42AM +0000, Phil Edworthy wrote: > On 16 November 2018 16:11 Uwe Kleine-K?nig wrote: > > On Fri, Nov 16, 2018 at 05:01:28PM +0100, Uwe Kleine-K?nig wrote: > > > Other than that I think the patch is fine > > > > Thinking again, I wonder why not just do: > > > > static inline struct clk *clk_get_optional(struct device *dev, const char *id) { > > struct clk *c = clk_get(dev, id); > > > > if (c == ERR_PTR(-ENOENT)) > > return NULL; > > else > > return c; > > } > > Unfortunately, underneath this __of_clk_get_by_name() returns -EINVAL > when looking for a named clock, and the "clock-names" OF property can't > be found or the name is not in that prop. This is because the index > returned by of_property_match_string() will be an error code and is then > currently always passed to __of_clk_get(). > > If, as you said, I split the patches into one that fixes the error code, and then > adds clk_get_optional() like above, it will make more sense. Sounds like a good plan. > btw, do we need to add of_clk_get_by_name_optional()? I only added it as a > counterpart to of_clk_get_by_name(), but it may not be needed. I don't need it. Given that it is easy to add when someone has a need, I'd say, skip it for now. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |