From nobody Thu Feb 12 09:29:16 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90DCCEED600 for ; Fri, 15 Sep 2023 15:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235999AbjIOPEL (ORCPT ); Fri, 15 Sep 2023 11:04:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235869AbjIOPDq (ORCPT ); Fri, 15 Sep 2023 11:03:46 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BD7D268A for ; Fri, 15 Sep 2023 08:03:40 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-403004a96a4so25119345e9.3 for ; Fri, 15 Sep 2023 08:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1694790219; x=1695395019; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=edxEV8lZNyeIe2fc1/ECdrZnvrBbNnxqjxV4vEQlZ6k=; b=unxbODZv3/+gtWrSmauo07/beObjoMjXb5TxV71xYoUxGuCX1r8D2dTjXGFOmai2/Y DOnutSJkiccs2oWUcwtSnECWrNglBuV825scuvj8Dy0Qz/fd2woRrsCTXgUxhxKwui/J F/uxsbtzS39+xFRONRemEwYPLBajBym1iKAtshzTm4myf7dgcr85WT62tearrfM3VseN k1N2vxSOha7c4S5GL2/cbHhzklKMI3NUvEsWQ7MKN4IJ4HJeSzSQUvNL5RE74eSMu6vg m6ehkAPo3//DVlZRqJORrI3X39IiTo8aIGrbmsYLOSE4SZfj4fKlzx+pq5cCqlUU4K+D x/jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694790219; x=1695395019; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=edxEV8lZNyeIe2fc1/ECdrZnvrBbNnxqjxV4vEQlZ6k=; b=E65JGgVl6tXWQGFmEPkfLLPmu27rSPnABUG/hdPRZiquUpiCTSsVRExzOrpL87TArd VsXIZguIzpNmxXd4qdXiTFFztdqZAAjQzq5vnaJKdLS5JDk8JnMY0rtmGpiP1rHx3Haf vqd/yVxYIgohbVT91QMRWQ2kynBdmKzakG0I4DVzsBNInVVBEngD0aH3AnBIy2pum4gM 49e0Tlae1EmbarrxoVo9eOIWm9UgqOmA1e++jkzl7WhMTQlW9b0h1mtmn1lZSqtsPped 37TaRbVmwHza6CA4mjAI5FwaEZyWbpFEUS8iw3Ac4WZhkmyC/pdAzYFLd2goosl7cjZ6 38vw== X-Gm-Message-State: AOJu0Yy6IQwTC8CrYjTNkYSSoh2xq+yzK3Plgf0XxQg76RZubu3pSIbv JFLd+NlY0pvpEU9KharIJNMujA== X-Google-Smtp-Source: AGHT+IFfx4Vw8sI1KX54ZioumUficY0QqHvfFD61SdTbqEY3pEZjyIrAbN/Jg/gNRG5WmOBJUQ8CHg== X-Received: by 2002:a7b:cc9a:0:b0:404:2dbb:8943 with SMTP id p26-20020a7bcc9a000000b004042dbb8943mr1889146wma.2.1694790218883; Fri, 15 Sep 2023 08:03:38 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:aa19:4569:aeeb:c0d3]) by smtp.gmail.com with ESMTPSA id hn40-20020a05600ca3a800b003fef19bb55csm4853369wmb.34.2023.09.15.08.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 08:03:38 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko , Mika Westerberg Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 08/11] gpio: of: replace gpiochip_find_* with gpio_device_find_* Date: Fri, 15 Sep 2023 17:03:23 +0200 Message-Id: <20230915150327.81918-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230915150327.81918-1-brgl@bgdev.pl> References: <20230915150327.81918-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bartosz Golaszewski We're porting all users of gpiochip_find() to using gpio_device_find(). Update the OF GPIO code. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij --- drivers/gpio/gpiolib-of.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 5515f32cf19b..4987c86010c1 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -127,10 +127,10 @@ static int of_gpiochip_match_node_and_xlate(struct gp= io_chip *chip, void *data) chip->of_xlate(chip, gpiospec, NULL) >=3D 0; } =20 -static struct gpio_chip *of_find_gpiochip_by_xlate( - struct of_phandle_args *gpiospec) +static struct gpio_device * +of_find_gpio_device_by_xlate(struct of_phandle_args *gpiospec) { - return gpiochip_find(gpiospec, of_gpiochip_match_node_and_xlate); + return gpio_device_find(gpiospec, of_gpiochip_match_node_and_xlate); } =20 static struct gpio_desc *of_xlate_and_get_gpiod_flags(struct gpio_chip *ch= ip, @@ -362,8 +362,8 @@ static void of_gpio_flags_quirks(const struct device_no= de *np, static struct gpio_desc *of_get_named_gpiod_flags(const struct device_node= *np, const char *propname, int index, enum of_gpio_flags *flags) { + struct gpio_device *gdev __free(gpio_device_put) =3D NULL; struct of_phandle_args gpiospec; - struct gpio_chip *chip; struct gpio_desc *desc; int ret; =20 @@ -375,13 +375,14 @@ static struct gpio_desc *of_get_named_gpiod_flags(con= st struct device_node *np, return ERR_PTR(ret); } =20 - chip =3D of_find_gpiochip_by_xlate(&gpiospec); - if (!chip) { + gdev =3D of_find_gpio_device_by_xlate(&gpiospec); + if (!gdev) { desc =3D ERR_PTR(-EPROBE_DEFER); goto out; } =20 - desc =3D of_xlate_and_get_gpiod_flags(chip, &gpiospec, flags); + desc =3D of_xlate_and_get_gpiod_flags(gpio_device_get_chip(gdev), + &gpiospec, flags); if (IS_ERR(desc)) goto out; =20 @@ -813,16 +814,16 @@ static int of_gpiochip_match_node(struct gpio_chip *c= hip, void *data) return device_match_of_node(&chip->gpiodev->dev, data); } =20 -static struct gpio_chip *of_find_gpiochip_by_node(struct device_node *np) +static struct gpio_device *of_find_gpio_device_by_node(struct device_node = *np) { - return gpiochip_find(np, of_gpiochip_match_node); + return gpio_device_find(np, of_gpiochip_match_node); } =20 static int of_gpio_notify(struct notifier_block *nb, unsigned long action, void *arg) { + struct gpio_device *gdev __free(gpio_device_put) =3D NULL; struct of_reconfig_data *rd =3D arg; - struct gpio_chip *chip; int ret; =20 /* @@ -839,11 +840,11 @@ static int of_gpio_notify(struct notifier_block *nb, = unsigned long action, if (of_node_test_and_set_flag(rd->dn, OF_POPULATED)) return NOTIFY_DONE; =20 - chip =3D of_find_gpiochip_by_node(rd->dn->parent); - if (chip =3D=3D NULL) + gdev =3D of_find_gpio_device_by_node(rd->dn->parent); + if (!gdev) return NOTIFY_DONE; /* not for us */ =20 - ret =3D of_gpiochip_add_hog(chip, rd->dn); + ret =3D of_gpiochip_add_hog(gpio_device_get_chip(gdev), rd->dn); if (ret < 0) { pr_err("%s: failed to add hogs for %pOF\n", __func__, rd->dn); @@ -856,11 +857,11 @@ static int of_gpio_notify(struct notifier_block *nb, = unsigned long action, if (!of_node_check_flag(rd->dn, OF_POPULATED)) return NOTIFY_DONE; /* already depopulated */ =20 - chip =3D of_find_gpiochip_by_node(rd->dn->parent); - if (chip =3D=3D NULL) + gdev =3D of_find_gpio_device_by_node(rd->dn->parent); + if (!gdev) return NOTIFY_DONE; /* not for us */ =20 - of_gpiochip_remove_hog(chip, rd->dn); + of_gpiochip_remove_hog(gpio_device_get_chip(gdev), rd->dn); of_node_clear_flag(rd->dn, OF_POPULATED); return NOTIFY_OK; } --=20 2.39.2