From patchwork Fri Oct 6 22:45:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 149446 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp635182vqo; Fri, 6 Oct 2023 15:45:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVgDS886k3MSVYjXXoWkJ3L2F1sEM7uBfhuSpp+mRAJWocBFKi97DNurQBr0pI1KY2l7wC X-Received: by 2002:a05:6a00:21cc:b0:68f:f6dd:e78b with SMTP id t12-20020a056a0021cc00b0068ff6dde78bmr10648635pfj.17.1696632350752; Fri, 06 Oct 2023 15:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696632350; cv=none; d=google.com; s=arc-20160816; b=L4ccqi78wV0fqsevry0UNh+f+cVmGS48WsClGoaQL+OTE9/hadVsh0XrYICZYrfVnA LxaohgjZBvb1fo16wqghoUOgdiyJY4Jx7TuQJSXEokNhGqfYZwyBcON+09a5HHGifsH/ ndjta/jbKFry3q0zmEnyNtkZlENGb29UHAMr+MLtvW7oWOE4aiDqXlkmqKPefec8pwDJ v/3p64xoG/eWfG/BeiWx1IJ3kA0ir3sVb3CGkaV29s9iVHsF26d6fkiDGVGwe/dYYm6C LIBQ5j0jYWgY+kWfB9ygv/UnmKjwjdSfhoh2XGKKyd7Kn+1V1VdGTJrD4Z1MfcxmVDvW xpeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=fzBSZh757GE5UQSZvhc1+xJqHAdmOys+BhkOnNUYd2g=; fh=QQOTr/g25CZcBmOjNUf4BpGBojcJG2RgzpuHBiIjyFc=; b=rOdbtW6NC/IUbvP0RyB7k6jxZaEUvGobB/wgxbAtQM6INH5kkwFnGjdRaApywKavxn n8wpeCVfWp0C+4xckAzln47QtCY8CdlfCpmljnBbOsO1WSWgXRsze1XVY6gC4d9yiGN2 MdSsFb0juCyojl5snzD+D/hgM571/QcWNHXcMmGjk4RUSifxeAayXYwVrMHf9SsZtWxB qebP63swE/Kw0fH8aA9LsUmL7TAfRsTrULJQPzePIzw/Zy/tzS8dfzd4OSTyGQ8EgZiU EKK2ptq0qJEBC5fQsrqt6j7+JDK8sCx6KLNxuUQeWlZO8lAGys0v8R/5Tey9JJ3LvEsH ygcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TkUiToD4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id fc6-20020a056a002e0600b0068fcca7b3f7si2394514pfb.2.2023.10.06.15.45.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 15:45:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TkUiToD4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id CA0CE809C41D; Fri, 6 Oct 2023 15:45:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233815AbjJFWpi (ORCPT + 18 others); Fri, 6 Oct 2023 18:45:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233796AbjJFWph (ORCPT ); Fri, 6 Oct 2023 18:45:37 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A3F5A2; Fri, 6 Oct 2023 15:45:36 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0796DC433C7; Fri, 6 Oct 2023 22:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696632335; bh=r0hgPd26vNJNNKdbRDndzXFBSLd85QxGGtazkx8k9RA=; h=From:To:Cc:Subject:Date:From; b=TkUiToD41EoSHzdGDHb1BVUYjz2DR57gQ89EBfGdiSV7XyLH003ZIKt983ICbgLtz t+JCHOx8JtpAZ4RXIbc40AgxuVm9wB5xNNe9pHE6uLlwaGiArTZiDXc/6SJPYP65GX sFz803xKiozrR8cnXyva4Gf9I8CEwgye0w+Bjuf5PfvkYSJmwn5uLERDLmkzrqILBW KiEJHJSVsyl0GD8SeMHoaq68xllDN2H57S/hf8APFZrlkAU4gW3jANmKpdbuySY4je v+0UDNjMSPWq6LOsMz6sB2gDoczswQ0wXPAzfhiGyO6UHjO8HzewgP9JDyLto/1VVC k5HX676k/3vIA== Received: (nullmailer pid 443988 invoked by uid 1000); Fri, 06 Oct 2023 22:45:34 -0000 From: Rob Herring To: Keerthy , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org Subject: [PATCH] gpio: Use device_get_match_data() Date: Fri, 6 Oct 2023 17:45:07 -0500 Message-Id: <20231006224507.443486-1-robh@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 06 Oct 2023 15:45:48 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779047963892657733 X-GMAIL-MSGID: 1779047963892657733 Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring --- drivers/gpio/gpio-davinci.c | 9 +++------ drivers/gpio/gpio-mmio.c | 4 ++-- drivers/gpio/gpio-mvebu.c | 10 +++------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index 8db5717bdabe..bb499e362912 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c @@ -16,10 +16,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -486,7 +486,6 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) struct davinci_gpio_platform_data *pdata = dev->platform_data; struct davinci_gpio_regs __iomem *g; struct irq_domain *irq_domain = NULL; - const struct of_device_id *match; struct irq_chip *irq_chip; struct davinci_gpio_irq_data *irqdata; gpio_get_irq_chip_cb_t gpio_get_irq_chip; @@ -495,10 +494,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) * Use davinci_gpio_get_irq_chip by default to handle non DT cases */ gpio_get_irq_chip = davinci_gpio_get_irq_chip; - match = of_match_device(of_match_ptr(davinci_gpio_ids), - dev); - if (match) - gpio_get_irq_chip = (gpio_get_irq_chip_cb_t)match->data; + if (dev->of_node) + gpio_get_irq_chip = (gpio_get_irq_chip_cb_t)device_get_match_data(dev); ngpio = pdata->ngpio; diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c index 74fdf0d87b2c..3ff0ea1e351c 100644 --- a/drivers/gpio/gpio-mmio.c +++ b/drivers/gpio/gpio-mmio.c @@ -56,9 +56,9 @@ o ` ~~~~\___/~~~~ ` controller in FPGA is ,.` #include #include #include +#include #include #include -#include #include "gpiolib.h" @@ -702,7 +702,7 @@ static struct bgpio_pdata *bgpio_parse_dt(struct platform_device *pdev, { struct bgpio_pdata *pdata; - if (!of_match_device(bgpio_of_match, &pdev->dev)) + if (!pdev->dev.of_node) return NULL; pdata = devm_kzalloc(&pdev->dev, sizeof(struct bgpio_pdata), diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 67497116ce27..8f80ca8ec1ed 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -42,9 +42,10 @@ #include #include #include -#include +#include #include #include +#include #include #include #include @@ -1122,7 +1123,6 @@ static void mvebu_gpio_remove_irq_domain(void *data) static int mvebu_gpio_probe(struct platform_device *pdev) { struct mvebu_gpio_chip *mvchip; - const struct of_device_id *match; struct device_node *np = pdev->dev.of_node; struct irq_chip_generic *gc; struct irq_chip_type *ct; @@ -1132,11 +1132,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) int i, cpu, id; int err; - match = of_match_device(mvebu_gpio_of_match, &pdev->dev); - if (match) - soc_variant = (unsigned long) match->data; - else - soc_variant = MVEBU_GPIO_SOC_VARIANT_ORION; + soc_variant = (unsigned long)device_get_match_data(&pdev->dev); /* Some gpio controllers do not provide irq support */ err = platform_irq_count(pdev);