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 8B7EFEB64DD for ; Tue, 25 Jul 2023 23:13:58 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7469386768; Wed, 26 Jul 2023 01:13:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (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=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HXEim5Jw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 295408683A; Wed, 26 Jul 2023 01:13:38 +0200 (CEST) Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) (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 D455786852 for ; Wed, 26 Jul 2023 01:13:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=judge.packham@gmail.com Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1bbc64f9a91so5901345ad.0 for ; Tue, 25 Jul 2023 16:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690326812; x=1690931612; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HgG98WJ06KKG/JgHkA2sbNiS779z0Zf4DGy5paKilyg=; b=HXEim5Jw6zttLRQ/kcGqKgER8cWIupU33WBrhNGPpPSJllBUdJrBYK+sNDXulMD3UF T0S6QH+CwX7Czb5cNM9Q8oCMaCXxsmhl5PIpxyfvKbRl+AI5lhnkAoDlAYJSyAEdteY+ g6TGiiUBxWyx+3tZExvnbPGmlvcW/QKaaOTRhvcwhQoC2tBx/ijd7BS/voMLVRxGoHt4 6uPsi7k9bfQ5ONF/r5jhErn+gy7FDI/PMO1IVO8NCNwmuZyvhaiS9guN5vwIZ6ESHkvv Kq2RJrE65StZpFhyMI6VtTUArOrhDnPE3Eful7Yhrkak97InFO3KOiuQBDwBG/4m2bNX Nucw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690326812; x=1690931612; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HgG98WJ06KKG/JgHkA2sbNiS779z0Zf4DGy5paKilyg=; b=SGYIN3M5Gk3eAp3GNQXFJCZDYf7u+hiCFf5KX3bWVS9faAiC1NqathM41R+7wiohls mZyfFnilSX9k0JmzgFaEL8blBWcJJGgqApRMApRgUBKivSodkjRh8htuU4rsyMERquLh 3gcJ5av+RMdCOmcPWVTQYuSAipm0TDrI1paq0klhE0nDYNwH4KF+DCyAToZfCf50Rbgp m/shXvIQzAoLJ30GsAwpzAK49NzbQYosbNWKMTAYxAkb9SLuWHEY9uOpgbsU/5yQcDDk gI2m228ztHX4SauPGbwxz259StY8JXZK0BinphxTL2c4jV8Z5Yuy25bAhjHdCq2+pQBW 6+/A== X-Gm-Message-State: ABy/qLaOVOsxrLP1zC0nTbMlkY2FOc+c1f3FZcSELL7YrOX4SW0Aq3D6 WtFaRtbYNYXI9ylQaF9pHG201p+QoD6+4A== X-Google-Smtp-Source: APBJJlFnUFpLe0VzFNpq3TLrAd5VrLgTU14q/5xMqAkrhikZWyEaWzHIuecOEabqR2VbzPLW9GvRRQ== X-Received: by 2002:a17:902:ea06:b0:1b8:4e00:96b with SMTP id s6-20020a170902ea0600b001b84e00096bmr777193plg.9.1690326812299; Tue, 25 Jul 2023 16:13:32 -0700 (PDT) Received: from chrisp-dl.atlnz.lc ([2001:df5:b000:22:505b:9968:7c0f:8cf6]) by smtp.gmail.com with ESMTPSA id a2-20020a170902ee8200b001b7f40a8959sm2529593pld.76.2023.07.25.16.13.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 16:13:31 -0700 (PDT) From: Chris Packham To: u-boot@lists.denx.de Cc: Chris Packham , Heiko Schocher Subject: [PATCH v2 1/2] i2c: i2c-gpio: Correctly handle new {sda, scl}-gpios bindings Date: Wed, 26 Jul 2023 11:13:08 +1200 Message-ID: <20230725231322.1375303-1-judge.packham@gmail.com> X-Mailer: git-send-email 2.41.0 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.8 at phobos.denx.de X-Virus-Status: Clean gpio_request_list_by_name() returns the number of gpios requested. Notably it swallows the underlying -ENOENT when the "gpios" property does not exist. Update the i2c-gpio driver to check for ret == 0 before trying the new sda-gpios/scl-gpios properties. Signed-off-by: Chris Packham --- This was originally sent as a single patch[1]. I've rolled it into this series as the board change is dependent on it. [1] - https://lore.kernel.org/u-boot/20230720023107.1184147-1-judge.packham@gmail.com/ (no changes since v1) drivers/i2c/i2c-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c index 4ed9e9e7cddd..c1fc290bd253 100644 --- a/drivers/i2c/i2c-gpio.c +++ b/drivers/i2c/i2c-gpio.c @@ -339,7 +339,7 @@ static int i2c_gpio_of_to_plat(struct udevice *dev) /* "gpios" is deprecated and replaced by "sda-gpios" + "scl-gpios". */ ret = gpio_request_list_by_name(dev, "gpios", bus->gpios, ARRAY_SIZE(bus->gpios), 0); - if (ret == -ENOENT) { + if (ret == 0) { ret = gpio_request_by_name(dev, "sda-gpios", 0, &bus->gpios[PIN_SDA], 0); if (ret < 0) -- 2.41.0