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 B6AE2C001B0 for ; Thu, 20 Jul 2023 02:31:32 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 84EC586332; Thu, 20 Jul 2023 04:31:30 +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=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="k0HxBdG4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 12D23856A7; Thu, 20 Jul 2023 04:31:29 +0200 (CEST) Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) (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 A1D6C8677B for ; Thu, 20 Jul 2023 04:31:26 +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-qk1-x733.google.com with SMTP id af79cd13be357-768138c59c1so30636085a.0 for ; Wed, 19 Jul 2023 19:31:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689820285; x=1692412285; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=RGe3OTRnS701BJT/4gLvmW46k0XvN/ulT402eSPQ/0Q=; b=k0HxBdG4DrE9Fj3UEUufjw8mR5auOVdkpsmFuLZ+s/6DTyzuw2eLYBIKym3jMRlMhO XXBj5srpkp65nvhf2wtwEZXNBF2Bh0btyqiKSa1AREIZ5DeokCBCsdp9eaZzVQ3DFRCZ dcrBtKZ9ZDfDTwZPGKiDhPb+kjE1FLWQb9QNjvRhd+qZSvI2RhzJ3Qno6hAL4bq2DNI1 CWCGwSY2m9lEdCCMBiuwGxund+YwzLJDFuWx5Sld5eSZWfoxRYguffjbpaTTvxVEmpn0 clLJNvgD7rl5CeNvwOoLygQXVZzMoTH/QXGAbEKuRFH7VEb8mKxdzWh/1KCfJUl5HwA1 PhMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689820285; x=1692412285; 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=RGe3OTRnS701BJT/4gLvmW46k0XvN/ulT402eSPQ/0Q=; b=M6R/h5h//HnJnFJ1ohPrvEH6nhhMDIlodGqmdfk6Vssnb1pVmqA9L0poDLnofB0V0r 1LhzrGMF69vevN81xa4rm2KIeV9l3OXjxRtSzpVu0ilWE04NdO4p1+gAAjIRQEBdrdS9 LTdfqe6v/qDsNdoxtQaMoq42rtQBtd2SyB6n5cGub+LuiGLQJb3YeUsu92xVVmWg8Pb3 FiaqPAp2PsUXyoTBYHDhxkYWk96NIqB+qxKyaAxxBMed+kkTIJ4uQ4wLKWmEBR/QApyS DZgFleF+3FwxSNWfK0unGtY2YnkKn91I1ppl9g01m2wc12+lWoVOgZsP4/gUCbXo/E5S CuGQ== X-Gm-Message-State: ABy/qLbZgIJvNdabHhORjdECn1cMwCsZmvuf+1mzbjVKzx5Xy+/3IUzi qJ4EwXCjGfsiYSGHWa0up4PZzqQAnelbQg== X-Google-Smtp-Source: APBJJlGlk0mQ7/0EJx69oWrdoV2Hbbu+S4XkpXuqNRSSf+QtwZw2k9ZOGMLKVWWb48w1I+bWcfslGA== X-Received: by 2002:a05:620a:2910:b0:767:dc5a:3bf8 with SMTP id m16-20020a05620a291000b00767dc5a3bf8mr9611377qkp.60.1689820284748; Wed, 19 Jul 2023 19:31:24 -0700 (PDT) Received: from chrisp-dl.atlnz.lc ([2001:df5:b000:22:3db4:2b01:2131:de21]) by smtp.gmail.com with ESMTPSA id c7-20020a170902d48700b001b89b1b99fasm4666251plg.243.2023.07.19.19.31.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 19:31:23 -0700 (PDT) From: Chris Packham To: u-boot@lists.denx.de Cc: Chris Packham , Heiko Schocher Subject: [PATCH] i2c: i2c-gpio: Correctly handle new {sda,scl}-gpios bindings Date: Thu, 20 Jul 2023 14:30:54 +1200 Message-ID: <20230720023107.1184147-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 --- 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