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 EA3AFC4332F for ; Wed, 4 Jan 2023 17:23:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 92D938551E; Wed, 4 Jan 2023 18:23:29 +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="WamvShOj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9051A85574; Wed, 4 Jan 2023 18:23:28 +0100 (CET) Received: from mail-vs1-xe33.google.com (mail-vs1-xe33.google.com [IPv6:2607:f8b0:4864:20::e33]) (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 CA70C8551E for ; Wed, 4 Jan 2023 18:23:25 +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-vs1-xe33.google.com with SMTP id m129so29745560vsc.11 for ; Wed, 04 Jan 2023 09:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=RFJYLFlCJlDGyuYEUvt53EtShy7z+i3Is83rKtsP2Zo=; b=WamvShOjHYt0OY/RrHnHKIBNwzUPyUjBPwdvmu2eQdVogh1Jth5MNxe5TRVuxPo4hM uyDodxVi5mYxiHITJDenEX9ff3GQwcqWOZtGHtSdzrEX4ujxXQdxCelzoAFByHcWEMG4 H/e0E7/4nki3N/lenOvapzsY1vC4hD9m0Ncv2LMQXkj3jFfYoFBtYiZxkaHn4oaLK6bw VEJt/aBxWrou38YM1ozE4ANd0d8IR6gXaYBU++w/bLz0mvFs8hmU9rTxeh+p3f6+ryo8 OUMNv2v/q9Lw8fFl3yg+C2BUZJsmx8WhGZ3iiFL9fmitDett232Xh6IDfK8+26PQmfd3 /p3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RFJYLFlCJlDGyuYEUvt53EtShy7z+i3Is83rKtsP2Zo=; b=vFL613WN+1ekzmfJh8Z49TQL6S5QaHO+erVf/VR1+WCCiGA0R+oZvTz+nFiQuSXOMw tP/4PFY0sKZDdFfd7c0xYb2WkMKZaLHyB5onnBg/pOQprVcOZOMpVc88tvHmrV+bMjQB qaJbkJCE4cEG69Ka5rUJNyz9CbMPELIcfA/9T8Wp/HIvswbFmct2pq5clVGFzU06KgDj Fyc8FgGIYs7JtT9oAu3Jwn1TfcYJBYuW1p8p7haaiKC7luxppwrH6LPbNaJ6OtB19bIt toc+FRGClvqL7KFYjpepf+bCOq3TuGFCEFldMGXV7sAJ6dDrvWM4Au5F4nUyf7exctvK f0dQ== X-Gm-Message-State: AFqh2krXxoMgJtII7JniCtrR5sxaNC/ddI/YvZ56qhOhVya8jN7sP9nw L9Fb8vynYV5LG9p+o84mWec= X-Google-Smtp-Source: AMrXdXt01zUR3rZmNwNbdGtSCGfi0tht1ZmkjIFSmKbRt0Y968OwFjST2sHqNUFPeHw9+OXLeIS/qQ== X-Received: by 2002:a05:6102:212e:b0:3aa:3766:7a1d with SMTP id f14-20020a056102212e00b003aa37667a1dmr27561649vsg.14.1672853004373; Wed, 04 Jan 2023 09:23:24 -0800 (PST) Received: from [192.168.1.201] (pool-173-73-95-180.washdc.fios.verizon.net. [173.73.95.180]) by smtp.gmail.com with ESMTPSA id r18-20020a05620a299200b006f9f714cb6asm24361577qkp.50.2023.01.04.09.23.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Jan 2023 09:23:24 -0800 (PST) Message-ID: <7f579953-1dc7-1a87-e995-c9295a048f47@gmail.com> Date: Wed, 4 Jan 2023 12:23:23 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 1/2] clk: Allow clk_get_by_name() with NULL name Content-Language: en-US To: Samuel Holland , Lukasz Majewski Cc: u-boot@lists.denx.de References: <20221128055359.35762-1-samuel@sholland.org> From: Sean Anderson In-Reply-To: <20221128055359.35762-1-samuel@sholland.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean On 11/28/22 00:53, Samuel Holland wrote: > This allows devm_clock_get(dev, NULL) to work and get the first clock, nit: devm_clk_get > which is common in code ported from Linux. > > Signed-off-by: Samuel Holland > --- > > drivers/clk/clk-uclass.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c > index 2f9635524cf..bfacafb2eef 100644 > --- a/drivers/clk/clk-uclass.c > +++ b/drivers/clk/clk-uclass.c > @@ -399,13 +399,14 @@ 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) > { > - int index; > + int index = 0; > > debug("%s(node=%p, name=%s, clk=%p)\n", __func__, > ofnode_get_name(node), name, clk); > clk->dev = NULL; > > - index = ofnode_stringlist_search(node, "clock-names", name); > + if (name) > + index = ofnode_stringlist_search(node, "clock-names", name); > if (index < 0) { > debug("fdt_stringlist_search() failed: %d\n", index); > return index; Reviewed-by: Sean Anderson