Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp504187imu; Tue, 20 Nov 2018 02:40:18 -0800 (PST) X-Google-Smtp-Source: AJdET5e6CpEjxZpdnSmjhTCoPirIY09csoPNaI0D0QtPdAv9U7NAnbugb4c/lSTwHuLzRmM9/TeZ X-Received: by 2002:a62:6547:: with SMTP id z68-v6mr1559718pfb.169.1542710418426; Tue, 20 Nov 2018 02:40:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542710418; cv=none; d=google.com; s=arc-20160816; b=1EAybJKn/kZNb/JfXHVjlqbtldYcEXRnC/mhen9OqlvBN0kKSqT72TicD5JacBb/m7 ls6H5GgEOf8RSBPPUIHhnIgzkDSvtHbyTchX0JKcaq5WWacSQN9SP0UJGZlY0VgvHF+u Vv1nQXjCBEgmxECwpuCXgxDCmXQbxbNwYGnao9M40NC1gws+jUCrSULP+hffovkfR4G7 6xisOJE5MSIlrGsmGhzGiK4i9YU9jC3U2CMx0Hg0O0WcajSx2IlZETMN9F0vcAtKYCsT NgM5VG0Txy8WwpykeKQO4fCV2NMJgfp0LCY9JQuKE0+BDtFlQjMB0YrASrYKM4Tt6MCy wIsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ZJDFGUqzoG8Dqo2Na63aANsfncG6qehwZ5MPe2mxDyk=; b=ZGeJ/+v/4MjdmRc9dZmI9CvyLOwyZ6Z8oLvPgzSf3wb7EVkQP8DS4mGFzyLUq1S7nr U5hVu4jKd1HFSRVzbtX3HH2uQmagYVcGfwECnR8tyqIKLHTSUhA8SosxNfN3cTP1x6qG x/8egnAxlhG3sEQ5JJX1pWnucMgoxeQLPQ+HfCntV9NBaMXJZlJgC13TlwsPysjw+RQA 7yd4XqUNMhn9GcYZ+OLk5w3RbkE0RMMn7I7F6TrhMHe71OgTG4DIvZyvBJRd7Wckt/aG +dnvJ9YM8ymk841cX8VOHsqPUHy9JTPDG+9u7TfWimc4i+p54flyxPPalYsi2YExr9FU ZyAg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24si37360647pgd.248.2018.11.20.02.40.02; Tue, 20 Nov 2018 02:40:18 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728692AbeKTVHH (ORCPT + 99 others); Tue, 20 Nov 2018 16:07:07 -0500 Received: from mga14.intel.com ([192.55.52.115]:24164 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbeKTVHH (ORCPT ); Tue, 20 Nov 2018 16:07:07 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2018 02:38:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,256,1539673200"; d="scan'208";a="107784282" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga004.fm.intel.com with ESMTP; 20 Nov 2018 02:38:34 -0800 Received: from andy by smile with local (Exim 4.91) (envelope-from ) id 1gP3QP-0000wj-0q; Tue, 20 Nov 2018 12:38:33 +0200 Date: Tue, 20 Nov 2018 12:38:33 +0200 From: Andy Shevchenko To: Phil Edworthy Cc: Stephen Boyd , Michael Turquette , Russell King , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Greg Ungerer , Geert Uytterhoeven , Ralf Baechle , Paul Burton , James Hogan , Jiaxun Yang , Huacai Chen , Guan Xuetao , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , linux-m68k@lists.linux-m68k.org, linux-mips@linux-mips.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] clk: Add (devm_)clk_get_optional() functions Message-ID: <20181120103832.GV10650@smile.fi.intel.com> References: <20181119141259.11992-1-phil.edworthy@renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181119141259.11992-1-phil.edworthy@renesas.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 19, 2018 at 02:12:59PM +0000, Phil Edworthy wrote: > This adds clk_get_optional() and devm_clk_get_optional() functions to get > optional clocks. > They behave 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. > - Instead of messing with the core functions, simply wrap them for the > _optional() versions. By putting clk_get_optional() inline in the header > file, we can get rid of the arch specific patches as well. Fine if it would have no surprises with error handling. > + if (ERR_PTR(-ENOENT)) > + return NULL; > + else > + return clk; return clk == ERR_PTR(-ENOENT) ? NULL : clk; ? > + if (clk == ERR_PTR(-ENOENT)) > + return NULL; > + else > + return clk; Ditto. -- With Best Regards, Andy Shevchenko