From patchwork Wed Jul 28 14:42:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 488091 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22EACC4338F for ; Wed, 28 Jul 2021 14:42:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 08D5661051 for ; Wed, 28 Jul 2021 14:42:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236830AbhG1Omm (ORCPT ); Wed, 28 Jul 2021 10:42:42 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:56716 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236731AbhG1Oml (ORCPT ); Wed, 28 Jul 2021 10:42:41 -0400 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPS id 15FD9402C2 for ; Wed, 28 Jul 2021 14:42:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627483359; bh=HAie+4ObP5wDsqMY5KGCgt4d7K8iKvd4Bvw66slM+7o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EJ1ngy8+YbC3nMzKPdN+X4aZs1bkJNRgVeiOtwtBOTZX/dT5w8ohRuwbvzx1gjlWB jQPgBPlXwcoToE0jonF1ALcfZciu30YV7thA36215FgV9bi2BZBEc+zXKutKyBA1sE 8up1q21O3eof05/vuseQLgITXtnYt6c1ghS6wUlIPt3CHi/ZpVE6B+GDk0HEQLGyyr Kgw525b8mXFR7AQqxhzSU04woY92ZIwBMS5Y7qJ5cJmx8jDJgaBKrSC1UEsRhzQKba AIOzOenw9FCKzBwP9s31U+aoetzBCx+PZTqC/skv/oq8A097EaowOzNczNUEA7gVsR zWWaIF6QZPScw== Received: by mail-ej1-f72.google.com with SMTP id c18-20020a1709067632b02905478dfedcafso888956ejn.21 for ; Wed, 28 Jul 2021 07:42:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HAie+4ObP5wDsqMY5KGCgt4d7K8iKvd4Bvw66slM+7o=; b=n5jBmYw/tbW42omeMntMDQDr97b7Em5DrA9o7vM4f9eSQmGRyNrtDUOUt9g2LUQDHD 2Bpx0EuWCJfdwlkPufTqtd3MZJcSOoi8ldiIllBTs1Mhyq6A8lOmPgGlS4Zb9s/B6sy3 1oA/Ni5MRg71AEPl9c/PKWuQgiy+rh1KDuCaw+bdn28yjpD2EkBj1PgBGLKB4lFS1a79 qxMDwcm4XaIDi3KPqEeRtu9bocDJXi4ma/dOoaruyHA6IJ3IvGK2xtdmaiXvjF/xRixw 5vwvIEdGLs1lE0dQY5GKrwSNK+OROOgnC9+8KvfXRYHfbaBoNk0pb6YP2rcYaa5N5sXQ vUdg== X-Gm-Message-State: AOAM533EKs9P5Vdq5MZJzszp31k8ktUcL0T+NOfNCzAywHWi2y924kfq Ryzfl0lia0jkC1Ke0HAzrG7YKp7ppyNL57MGcV6rAC3JNpCo2w4X3hNdiZJX3GZjtVKDlLpK5Sk JwrNyuS1Lr7l/Xc0SucMxupKN2Vt9omL39byKgpI= X-Received: by 2002:a17:906:c836:: with SMTP id dd22mr16340503ejb.3.1627483358786; Wed, 28 Jul 2021 07:42:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxteeSA3oSAeRNij5f1M2M78dulmjLVEORBllzGQQO9MQOzz6cXVa/fw6iRYfYcKNgfnOcF3g== X-Received: by 2002:a17:906:c836:: with SMTP id dd22mr16340483ejb.3.1627483358609; Wed, 28 Jul 2021 07:42:38 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id d19sm2683676eds.54.2021.07.28.07.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 07:42:38 -0700 (PDT) From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Frank Rowand , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 1/3] of: unify of_count_phandle_with_args() arguments with !CONFIG_OF Date: Wed, 28 Jul 2021 16:42:27 +0200 Message-Id: <20210728144229.323611-2-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210728144229.323611-1-krzysztof.kozlowski@canonical.com> References: <20210728144229.323611-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Unify the declaration of of_count_phandle_with_args() between enabled and disabled OF by making constifying pointed device_node. Signed-off-by: Krzysztof Kozlowski --- include/linux/of.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/of.h b/include/linux/of.h index 0e786b60bd5d..6f1c41f109bb 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -896,7 +896,7 @@ static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, return -ENOSYS; } -static inline int of_count_phandle_with_args(struct device_node *np, +static inline int of_count_phandle_with_args(const struct device_node *np, const char *list_name, const char *cells_name) { From patchwork Wed Jul 28 14:42:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 488963 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D766C432BE for ; Wed, 28 Jul 2021 14:42:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F373F6101B for ; Wed, 28 Jul 2021 14:42:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236891AbhG1Omn (ORCPT ); Wed, 28 Jul 2021 10:42:43 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:56738 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236797AbhG1Omm (ORCPT ); Wed, 28 Jul 2021 10:42:42 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPS id 6420240303 for ; Wed, 28 Jul 2021 14:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627483360; bh=iVAoF/iZyFmC3s0sRlT9GVhMSwyFNtFGp8i7c+DzusI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Pgdefb9fDSn2ROiqtM8crZqLzaZBgaf8xtRG1coa11GLZCZ2O5AxsrpPUfVY2LKc8 80Utgd+Wts1yH3aRIQf6DuQEU6zbcxRpLEvuXL1w4t6hkRyqDB29WWO7dc5SAl8COg /hBPu4yQiVTyJURyYdVT/7q7xrBUZMYPl164aZ7ZjPj5RnMFNyCSDJWpTMCxINIAaU IVllUxp3CqX9K4fFnqhtBuTX1LYOSUCxMcCXNri4uGim+YIcsLSfbrty4Deq/XVYU0 wkOvHwYEC2iWl/9nyvhBMhsZcT9IKvARXVHXoeRwRmt+y7/IecJp2kjj2J93HE61OI bXJ7QavUJhOzw== Received: by mail-ed1-f69.google.com with SMTP id b4-20020a05640202c4b02903948bc39fd5so1354304edx.13 for ; Wed, 28 Jul 2021 07:42:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iVAoF/iZyFmC3s0sRlT9GVhMSwyFNtFGp8i7c+DzusI=; b=YiE8cjt0TmwBgnjvqMV9ZbswTbIo5nixmKiRILsQ9EvoJbfberY1TG7WtF+g9mJlNK vtFud/7W6mij/kWbUufAvCXeyRSCmMi52F4Bc2+OMdohirkrsoABxOi7oHdsijmcrxbx JWhysy7HcvTu25P6WpSp8aq5Hjy03zpwxJISUkb6fWnKwCNWmbjdsZI6hrI4ndJcirV+ loCZaHTp4FJlU73//PSXdsPQLKxAF20axhZeIFhZaMNw8X1w90M9ZWrO+IcKlmP3uROO acyE+UJKTXlubQPjhMTjsXGi7N8Nb5kttv3b0JfVNQzKJVPKPAP2K1EYlpxZU6QYCpew +lJQ== X-Gm-Message-State: AOAM530xPBw4wsvX8rGDUrRjx928dJG7Wnv5JkU7hVBOttV5WAwdC+vj hPWLQHEKiRyDBkDANSojICINSSSwpyBVRZa7Qjt9CDn1P4B330xQ2dv8XHQ39lnQkKO//HyZFXs HXevF75h3Dglx05BNot2EkGWKSe0hMLqmxgzo7+Y= X-Received: by 2002:a05:6402:2317:: with SMTP id l23mr144104eda.265.1627483360132; Wed, 28 Jul 2021 07:42:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzwue7zaRLweLShaJFr+TW/TFKDimu9t8u+oOJiuyP9dh7vLQM3TY9ToaPYJy+honvYq0Igg== X-Received: by 2002:a05:6402:2317:: with SMTP id l23mr144078eda.265.1627483359898; Wed, 28 Jul 2021 07:42:39 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id d19sm2683676eds.54.2021.07.28.07.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 07:42:39 -0700 (PDT) From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Frank Rowand , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 2/3] gpiolib: constify passed device_node pointer Date: Wed, 28 Jul 2021 16:42:28 +0200 Message-Id: <20210728144229.323611-3-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210728144229.323611-1-krzysztof.kozlowski@canonical.com> References: <20210728144229.323611-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Several gpiolib functions receive pointer to struct device_node which is later passed to OF functions. These OF functions accept already pointer to const, so gpiolib can follow similar approach to indicate they are not modifying the struct device_node. Signed-off-by: Krzysztof Kozlowski --- drivers/gpio/gpiolib-devres.c | 2 +- drivers/gpio/gpiolib-of.c | 8 ++++---- include/linux/gpio/consumer.h | 8 ++++---- include/linux/of_gpio.h | 15 ++++++++------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/gpio/gpiolib-devres.c b/drivers/gpio/gpiolib-devres.c index 4a517e5dedf0..79da85d17b71 100644 --- a/drivers/gpio/gpiolib-devres.c +++ b/drivers/gpio/gpiolib-devres.c @@ -145,7 +145,7 @@ EXPORT_SYMBOL_GPL(devm_gpiod_get_index); * In case of error an ERR_PTR() is returned. */ struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, - struct device_node *node, + const struct device_node *node, const char *propname, int index, enum gpiod_flags dflags, const char *label) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index bbcc7c073f63..1e5a6f63b2fe 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -130,7 +130,7 @@ bool of_gpio_need_valid_mask(const struct gpio_chip *gc) return false; } -static void of_gpio_flags_quirks(struct device_node *np, +static void of_gpio_flags_quirks(const struct device_node *np, const char *propname, enum of_gpio_flags *flags, int index) @@ -236,7 +236,7 @@ static void of_gpio_flags_quirks(struct device_node *np, * value on the error condition. If @flags is not NULL the function also fills * in flags for the GPIO. */ -static struct gpio_desc *of_get_named_gpiod_flags(struct device_node *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 of_phandle_args gpiospec; @@ -275,7 +275,7 @@ static struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, return desc; } -int of_get_named_gpio_flags(struct device_node *np, const char *list_name, +int of_get_named_gpio_flags(const struct device_node *np, const char *list_name, int index, enum of_gpio_flags *flags) { struct gpio_desc *desc; @@ -303,7 +303,7 @@ EXPORT_SYMBOL_GPL(of_get_named_gpio_flags); * * In case of error an ERR_PTR() is returned. */ -struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, +struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node, const char *propname, int index, enum gpiod_flags dflags, const char *label) diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 566feb56601f..bf945b776555 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -609,7 +609,7 @@ struct gpio_desc *devm_fwnode_get_gpiod_from_child(struct device *dev, #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_OF_GPIO) struct device_node; -struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, +struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node, const char *propname, int index, enum gpiod_flags dflags, const char *label); @@ -619,7 +619,7 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, struct device_node; static inline -struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, +struct gpio_desc *gpiod_get_from_of_node(const struct device_node *node, const char *propname, int index, enum gpiod_flags dflags, const char *label) @@ -633,7 +633,7 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, struct device_node; struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, - struct device_node *node, + const struct device_node *node, const char *propname, int index, enum gpiod_flags dflags, const char *label); @@ -644,7 +644,7 @@ struct device_node; static inline struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, - struct device_node *node, + const struct device_node *node, const char *propname, int index, enum gpiod_flags dflags, const char *label) diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index f821095218b0..8bf2ea859653 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h @@ -49,7 +49,7 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc) return container_of(gc, struct of_mm_gpio_chip, gc); } -extern int of_get_named_gpio_flags(struct device_node *np, +extern int of_get_named_gpio_flags(const struct device_node *np, const char *list_name, int index, enum of_gpio_flags *flags); extern int of_mm_gpiochip_add_data(struct device_node *np, @@ -67,7 +67,7 @@ extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc); #include /* Drivers may not strictly depend on the GPIO support, so let them link. */ -static inline int of_get_named_gpio_flags(struct device_node *np, +static inline int of_get_named_gpio_flags(const struct device_node *np, const char *list_name, int index, enum of_gpio_flags *flags) { if (flags) @@ -98,7 +98,8 @@ static inline int of_get_named_gpio_flags(struct device_node *np, * The above example defines four GPIOs, two of which are not specified. * This function will return '4' */ -static inline int of_gpio_named_count(struct device_node *np, const char* propname) +static inline int of_gpio_named_count(const struct device_node *np, + const char *propname) { return of_count_phandle_with_args(np, propname, "#gpio-cells"); } @@ -109,12 +110,12 @@ static inline int of_gpio_named_count(struct device_node *np, const char* propna * * Same as of_gpio_named_count, but hard coded to use the 'gpios' property */ -static inline int of_gpio_count(struct device_node *np) +static inline int of_gpio_count(const struct device_node *np) { return of_gpio_named_count(np, "gpios"); } -static inline int of_get_gpio_flags(struct device_node *np, int index, +static inline int of_get_gpio_flags(const struct device_node *np, int index, enum of_gpio_flags *flags) { return of_get_named_gpio_flags(np, "gpios", index, flags); @@ -129,7 +130,7 @@ static inline int of_get_gpio_flags(struct device_node *np, int index, * Returns GPIO number to use with Linux generic GPIO API, or one of the errno * value on the error condition. */ -static inline int of_get_named_gpio(struct device_node *np, +static inline int of_get_named_gpio(const struct device_node *np, const char *propname, int index) { return of_get_named_gpio_flags(np, propname, index, NULL); @@ -143,7 +144,7 @@ static inline int of_get_named_gpio(struct device_node *np, * Returns GPIO number to use with Linux generic GPIO API, or one of the errno * value on the error condition. */ -static inline int of_get_gpio(struct device_node *np, int index) +static inline int of_get_gpio(const struct device_node *np, int index) { return of_get_gpio_flags(np, index, NULL); } From patchwork Wed Jul 28 14:42:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 488090 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24640C4320A for ; Wed, 28 Jul 2021 14:42:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 111A661042 for ; Wed, 28 Jul 2021 14:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236916AbhG1Omp (ORCPT ); Wed, 28 Jul 2021 10:42:45 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:56768 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236869AbhG1Omo (ORCPT ); Wed, 28 Jul 2021 10:42:44 -0400 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPS id EBD0A40303 for ; Wed, 28 Jul 2021 14:42:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627483361; bh=vhKtDpijEwzqypmCoxqNYUO22vvDYc0oFhewweVeSvo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MZKNYvyV4od7dbbEgXk0uBoxcjX8ydOebtLfZMZkSTClUkzk3UZDEWPISWSAUBdl0 JKQGfK/4vHtw6TMvZt22YK4yVLLRTkiHTKNwehQv3mZjtTRuwOPkSzsUmb2PTpEryd q/xkejQMpiAE0tSVZiEjJuwYrnEE3XMxsNfpq6lAWfe/znOTbuWaZBcGr59fs3WsP1 WdOOrg5P+AGwBFmmgamFUZMElbbANgskPtIdmS1ld2oX0wH+OfPeZ5T6qPVfWaVYHy BPg90mm01zGZHaESko1+CZ69vCrpjnUH/H6wZCFbbpNIINd7Z80YcFUbz02IvPZ92p s5zyu0AQcaj7w== Received: by mail-ed1-f71.google.com with SMTP id j22-20020a50ed160000b02903ab03a06e86so1352513eds.14 for ; Wed, 28 Jul 2021 07:42:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vhKtDpijEwzqypmCoxqNYUO22vvDYc0oFhewweVeSvo=; b=mY7WBb+BMwyYiHlEw9PIcWGGEDM8fDnQiZuIN4QhudpJPz2PIuMA7NARIzshkYMU7v qMEa2taQNWwzLH8iHeBt45BMm6Ess5fk3VwBSTrXXwPBeS3wMzZ4OoyDPsnODRGUIJas HpMOtqgcWJA1SUluwYzCSDvnNCqdVaEZ8Fij5pkXSGsM9SuFmWg1m8IGje3x111+QBI4 MkqQzZr4OIcu6ZFbPala7n6sEtBOEzBFJRY7YxJhk1oQh3/4DH+F5V4uKvTuEuBwK5Yt fkLXtv1i5CkNkEoeHrxrmpG/vi8DEEotcADWQoNrVQiLuoPV+CW0FUW/ecGT/5UcHcqe KCxQ== X-Gm-Message-State: AOAM530wPbsLaKVFGvGvL10VbAdZnB+8ZZ1GpGtETWfEfGqMPjt/wCwX hgUuB8RyPKgj6Uoxc3/w1TCUwcghf77xGiTNgjHTTfxrgg5kDV81xEKGVDptaZEiQ/hTyH/1x4F 4kt+720G9cCb3IKH1gnMONjm2XxGS85FVAbU3F2g= X-Received: by 2002:aa7:c858:: with SMTP id g24mr202665edt.250.1627483361437; Wed, 28 Jul 2021 07:42:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2XZQvwY+SVOhT/EErnGZDZWwl1CML/Duf2XYwD3kIwYQ2UEYLx6GZZ48zkIz7I3zJp+0/bA== X-Received: by 2002:aa7:c858:: with SMTP id g24mr202655edt.250.1627483361337; Wed, 28 Jul 2021 07:42:41 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id d19sm2683676eds.54.2021.07.28.07.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 07:42:40 -0700 (PDT) From: Krzysztof Kozlowski To: Linus Walleij , Bartosz Golaszewski , Rob Herring , Frank Rowand , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 3/3] gpiolib: of: constify few local device_node variables Date: Wed, 28 Jul 2021 16:42:29 +0200 Message-Id: <20210728144229.323611-4-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210728144229.323611-1-krzysztof.kozlowski@canonical.com> References: <20210728144229.323611-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org gpiolib does not modify struct device_node, so few local pointers can point to a const data. Signed-off-by: Krzysztof Kozlowski --- drivers/gpio/gpiolib-of.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 1e5a6f63b2fe..0ad288ab6262 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -122,7 +122,7 @@ static struct gpio_desc *of_xlate_and_get_gpiod_flags(struct gpio_chip *chip, bool of_gpio_need_valid_mask(const struct gpio_chip *gc) { int size; - struct device_node *np = gc->of_node; + const struct device_node *np = gc->of_node; size = of_property_count_u32_elems(np, "gpio-reserved-ranges"); if (size > 0 && size % 2 == 0) @@ -373,7 +373,7 @@ static struct gpio_desc *of_find_spi_gpio(struct device *dev, const char *con_id enum of_gpio_flags *of_flags) { char prop_name[32]; /* 32 is max size of property name */ - struct device_node *np = dev->of_node; + const struct device_node *np = dev->of_node; struct gpio_desc *desc; /* @@ -404,7 +404,7 @@ static struct gpio_desc *of_find_spi_cs_gpio(struct device *dev, unsigned int idx, unsigned long *flags) { - struct device_node *np = dev->of_node; + const struct device_node *np = dev->of_node; if (!IS_ENABLED(CONFIG_SPI_MASTER)) return ERR_PTR(-ENOENT); @@ -440,7 +440,7 @@ static struct gpio_desc *of_find_regulator_gpio(struct device *dev, const char * "wlf,ldo1ena", /* WM8994 */ "wlf,ldo2ena", /* WM8994 */ }; - struct device_node *np = dev->of_node; + const struct device_node *np = dev->of_node; struct gpio_desc *desc; int i;