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 0A062C4321E for ; Mon, 28 Nov 2022 05:54:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6F8FA8516C; Mon, 28 Nov 2022 06:54:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="kQKOrx2j"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="EUdC8sup"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0A48784D45; Mon, 28 Nov 2022 06:54:06 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9FE3C85175 for ; Mon, 28 Nov 2022 06:54:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id D1C1C5C0062; Mon, 28 Nov 2022 00:54:01 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 28 Nov 2022 00:54:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1669614841; x=1669701241; bh=XA fvFFkKQ4FcDDgpdI3CR6NaPSNuqYE9dSKwgRa4weM=; b=kQKOrx2jrEGW6LObuL SMdNV8f+Trt11MCPoHHdEfRAb6UhoQkapMVhWt7XsAlev3nTAreu76ScOK1m221i WdCbSiXuzonJE+XrIvRyCiHpf+Q9EFx4kX1rfwbbG9KOWpKUkoXTNvNlD6aJjpSM GPqctIpPKNalEwTvH8lFLJ3HXZWOcKHsDRD+xNSIbfFd3Nm6vnygC2Xab/YMsxMx F3ATg8Sh/ont3KCMZ73MtqYGlw8jIrL+P2D4ZZnaOFi99i1mz3oz/QKg3jnLGO+y X3XDotij1oEUQj7XrSv5idLZaj0T66dvVBmRqaDG+2YchTUIxkL9sLNVttE9eqbb Gu7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1669614841; x=1669701241; bh=XAfvFFkKQ4FcD DgpdI3CR6NaPSNuqYE9dSKwgRa4weM=; b=EUdC8supOdU4OhHkqpXC5/jbCaxym iO2bpkyn5svgy/jDobntMFHuqJ6vTBNDtem61jIt+UMgsQjWWvAZAC7OdE5DMkrn HxqLkKoQ85NXtF2nevl7JkjH7GQsVHCMDdcHeP1fu4tzb2eG88Lpu/N/uMvBHhih jjwTgkOWVSIfnp9kCqSIYLybd0G2IY2Lp3TSzWc6Rr5cYncYkdWMJkBKD2D00Wyt PolyP0UnGGrgTh8rzYwbn43V1r8XFzzYMd5i0QVknFdA3IiO6vG0F/UErNK97Z8b fO8C/U/xiiH2s2joTaj66gD0bQshOrYzLfyk/vNMlClm7l+qWewZqO4IA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrjedugdeltdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpedukeetueduhedtleetvefguddvvdejhfefudelgfduveeggeehgfdu feeitdevteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Nov 2022 00:54:01 -0500 (EST) From: Samuel Holland To: Lukasz Majewski , Sean Anderson Cc: Samuel Holland , u-boot@lists.denx.de, Alexander Dahl , Marek Vasut , Simon Glass Subject: [PATCH 2/2] reset: Allow reset_get_by_name() with NULL name Date: Sun, 27 Nov 2022 23:53:59 -0600 Message-Id: <20221128055359.35762-2-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221128055359.35762-1-samuel@sholland.org> References: <20221128055359.35762-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 This allows devm_reset_control_get(dev, NULL) to work and get the first reset control, which is common in code ported from Linux. Signed-off-by: Samuel Holland --- drivers/reset/reset-uclass.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c index bcef46039c2..a26c623a77e 100644 --- a/drivers/reset/reset-uclass.c +++ b/drivers/reset/reset-uclass.c @@ -147,13 +147,14 @@ int reset_get_bulk(struct udevice *dev, struct reset_ctl_bulk *bulk) int reset_get_by_name(struct udevice *dev, const char *name, struct reset_ctl *reset_ctl) { - int index; + int index = 0; debug("%s(dev=%p, name=%s, reset_ctl=%p)\n", __func__, dev, name, reset_ctl); reset_ctl->dev = NULL; - index = dev_read_stringlist_search(dev, "reset-names", name); + if (name) + index = dev_read_stringlist_search(dev, "reset-names", name); if (index < 0) { debug("fdt_stringlist_search() failed: %d\n", index); return index; -- 2.37.4