From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA89EC433F5 for ; Wed, 1 Dec 2021 18:44:16 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BA823830C1; Wed, 1 Dec 2021 19:43:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="oEzn9IZd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3886C830D5; Wed, 1 Dec 2021 19:43:52 +0100 (CET) Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E360F830C5 for ; Wed, 1 Dec 2021 19:43:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qt1-x834.google.com with SMTP id m25so24991171qtq.13 for ; Wed, 01 Dec 2021 10:43:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TzFkQlVKApKh+uc6MfbS9NSuuY9nHqGvX1wz0lsNJNM=; b=oEzn9IZdlwsTcFaDOoNJH36uA1d8hYR6olSPm1nOSikXiAFqCSgphyfD+Kn8xxHQdY XEXnwaDR9XGro87pE6jLSFrByJR7oKK4Hzkv1gQLr9KBaSmVkA3piLYZi8lm3dj//Yj1 f5yzq3ctDCiLoKhwcGs4eg/RqwJq1BiJSviAXNfV1rXu5B6qtu/uvoPKHC4W75u6aWKz 2jc6CsFdfFkJnckS44huqp3RIJH7o2SYz1UnarCm6xUchtHBBvRExRYZoE3enhe/CPCF +dQn7F3gYnzFjypvMflili0LPMMt5Nf5yhQPZN/DfEOnEo5J7tsm8DOigDbAn/r85eX0 C7ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TzFkQlVKApKh+uc6MfbS9NSuuY9nHqGvX1wz0lsNJNM=; b=aiiRHHAt5pg8Hlt/C0FIVJSdPYu+YcyXNxZfW6PUkN8sDypsCWeY5JTtAyK/ux7Pe9 cPTnH4V/wSYiaRVw8dquwdRf+utRe3tkjpToOCc7XQU8Vt64nGWGTWb13UBYJobNH3L2 2SaAqq2HgvrtLgutTQ1g/UTpVKJNDhKHzmqwpSVPqT1fBObG3IDk7nxd+rpDqd/SNHF+ Ie/nLYbY4rOnvMR52pN6QrDeBfeDpsKHzL1+iqrx2FuUJGRorIJhodJBGvX9LZO0xjEC wa8HOiA2QUJwwbQ8ROgMT2hM+4SFoNbyJW+kqHtOczbP6RzebJNvrbdgKeW/dwF0r2bT VcNA== X-Gm-Message-State: AOAM533Jy7rTAuRfCCNsDglnUPtzunMKulq5Gb0FfQ/6DPyg/3tf7578 BPJNeTZ/ISfogo40MjQZp1O+3Do0gVg= X-Google-Smtp-Source: ABdhPJwntLJvUUcAeFgWGwXFDcgwrU3AAPvS6jeIk4Q3aqypwEU6FdRScGglSqarfpYYAC+KeThnGg== X-Received: by 2002:ac8:7fd6:: with SMTP id b22mr9013254qtk.26.1638384224530; Wed, 01 Dec 2021 10:43:44 -0800 (PST) Received: from godwin.fios-router.home (pool-108-18-207-184.washdc.fios.verizon.net. [108.18.207.184]) by smtp.gmail.com with ESMTPSA id u10sm310138qkp.104.2021.12.01.10.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Dec 2021 10:43:44 -0800 (PST) From: Sean Anderson To: u-boot@lists.denx.de Cc: Dario Binacchi , Simon Glass , Lukasz Majewski , Sean Anderson Subject: [PATCH 2/5] clk: Inline clk_get_*_optional Date: Wed, 1 Dec 2021 13:43:29 -0500 Message-Id: <20211201184332.2166897-3-seanga2@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211201184332.2166897-1-seanga2@gmail.com> References: <20211201184332.2166897-1-seanga2@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean The optional varients of clk_get_* functions are just simple wrappers. Reduce code size a bit by inlining them. On platforms where it is not used (most of them), it will not be compiled in any more. On platforms where they are used, the inlined branch should not cause any significant growth. Signed-off-by: Sean Anderson --- drivers/clk/clk-uclass.c | 22 --------------- include/clk.h | 58 ++++++++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 45 deletions(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 18699d69e3..168fb67019 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -432,18 +432,6 @@ int clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk) return clk_get_by_index_nodev(node, index, clk); } -int clk_get_by_name_nodev_optional(ofnode node, const char *name, - struct clk *clk) -{ - int ret; - - ret = clk_get_by_name_nodev(node, name, clk); - if (ret == -ENODATA) - return 0; - - return ret; -} - int clk_release_all(struct clk *clk, int count) { int i, ret; @@ -824,16 +812,6 @@ struct clk *devm_clk_get(struct udevice *dev, const char *id) return clk; } -struct clk *devm_clk_get_optional(struct udevice *dev, const char *id) -{ - struct clk *clk = devm_clk_get(dev, id); - - if (PTR_ERR(clk) == -ENODATA) - return NULL; - - return clk; -} - void devm_clk_put(struct udevice *dev, struct clk *clk) { int rc; diff --git a/include/clk.h b/include/clk.h index 943c87f3c3..c3d4cc0ecf 100644 --- a/include/clk.h +++ b/include/clk.h @@ -193,22 +193,6 @@ int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk); */ int clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk); -/** - * clk_get_by_name_nodev_optional - Get/request an optinonal clock by name - * without a device. - * @node: The client ofnode. - * @name: The name of the clock to request. - * @name: The name of the clock to request, within the client's list of - * clocks. - * @clock: A pointer to a clock struct to initialize. - * - * Behaves the same as clk_get_by_name_nodev() except where there is - * no clock producer, in this case, skip the error number -ENODATA, and - * the function returns 0. - */ -int clk_get_by_name_nodev_optional(ofnode node, const char *name, - struct clk *clk); - /** * devm_clk_get - lookup and obtain a managed reference to a clock producer. * @dev: device for clock "consumer" @@ -238,7 +222,16 @@ struct clk *devm_clk_get(struct udevice *dev, const char *id); * 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. */ -struct clk *devm_clk_get_optional(struct udevice *dev, const char *id); +static inline struct clk *devm_clk_get_optional(struct udevice *dev, + const char *id) +{ + struct clk *clk = devm_clk_get(dev, id); + + if (PTR_ERR(clk) == -ENODATA) + return NULL; + + return clk; +} /** * clk_release_all() - Disable (turn off)/Free an array of previously @@ -291,18 +284,37 @@ clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk) return -ENOSYS; } -static inline int -clk_get_by_name_nodev_optional(ofnode node, const char *name, struct clk *clk) -{ - return -ENOSYS; -} - static inline int clk_release_all(struct clk *clk, int count) { return -ENOSYS; } #endif +/** + * clk_get_by_name_nodev_optional - Get/request an optinonal clock by name + * without a device. + * @node: The client ofnode. + * @name: The name of the clock to request. + * @name: The name of the clock to request, within the client's list of + * clocks. + * @clock: A pointer to a clock struct to initialize. + * + * Behaves the same as clk_get_by_name_nodev() except where there is + * no clock producer, in this case, skip the error number -ENODATA, and + * the function returns 0. + */ +static inline int clk_get_by_name_nodev_optional(ofnode node, const char *name, + struct clk *clk) +{ + int ret; + + ret = clk_get_by_name_nodev(node, name, clk); + if (ret == -ENODATA) + return 0; + + return ret; +} + /** * enum clk_defaults_stage - What stage clk_set_defaults() is called at * @CLK_DEFAULTS_PRE: Called before probe. Setting of defaults for clocks owned -- 2.33.0