Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp677429rdb; Fri, 6 Oct 2023 15:45:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZzIxDwnRn4uZFw7yWZaq2a4YKCV7lP7Wzn8XvmfPR9or3enYUaZO7mC1tEz6g61e6BrJd X-Received: by 2002:a05:6a21:1f16:b0:152:1ce8:ce3a with SMTP id ry22-20020a056a211f1600b001521ce8ce3amr8089181pzb.18.1696632346517; Fri, 06 Oct 2023 15:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696632346; cv=none; d=google.com; s=arc-20160816; b=t1/tz08Kdxse3h2SbVxneYBKV7v0j8WiOLn7Ny5+WGpPbBmTRm9bu3hzkbcGq1k9Bp Cvn1Lzd3d2fvDDj6k8GfX8Zcz7S3voWEBAxMsR0QiBYIti32bUVibZpdZCDPWGnRiw8p CgnFkhhC7NwshpBTSmb6lblpvFVp937T5mrnzX9QB9V5DD5XDHPcVvg3EZkuRJJsdyh7 Sj4BBsPR+skLmVr1VSIfxsMRJC0XPTLMIxmiKcOcXlVXZrH2sS5EGBsLXYT2Ts54YNSX +jwlu9eEdrJQtzBf0zsuP6y7aA1eO5u/y2Nw/7w2ojjk8BZr0vMXxvEGi3Xi1xuZeE54 o8Ug== 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=AaVz6Uu29O7OfyNcMNCyeHfSQN9W18UO2QfBPT4QNEI=; fh=4jmO/O9huSpZcx+KogkhF2muLIEtCXtV8fFTdI0PG40=; b=fD67IAmgGhblbOrHUPXUQptQZ+0wusJNW91m3rWzBZ6PTxL7V07Cj4yZqYeq/NfZ4Y oHdnZX5+/+/u8It6ZW1LyRf8yFzCTJDCM7b/fs3xskI55rxJ2j8JA9kbED49xSnpxLdH vJ+MuFA4wpf0JQ0VrIb59RSvCEUwJGwUXU56tfNrS3dgbb8LIYv2pbt9yh27GL3OuroO XLlAA+XYRguV3vm5sQNJqlhNSG45du0VCxzvnjLWn99q4gZ7RJLYT5IjClSa02ThQ5va iZ7Ff7919V5N/Ip3BDM8vMwAJSyu2SE1AQgLuLj0LXcbVQiBeB7O0kVn//XX0TCPEVrv PCxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qRFo1vXa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id cb7-20020a056a00430700b0068ff659af62si2355177pfb.106.2023.10.06.15.45.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 15:45:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qRFo1vXa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id A93B6809565F; Fri, 6 Oct 2023 15:45:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233820AbjJFWoz (ORCPT + 99 others); Fri, 6 Oct 2023 18:44:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbjJFWoy (ORCPT ); Fri, 6 Oct 2023 18:44:54 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9BDDFA; Fri, 6 Oct 2023 15:44:52 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C84B6C433C8; Fri, 6 Oct 2023 22:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696632292; bh=jjDB+XxqgQWiiig+d8iWQegK4BdmQYMDUpf29huX4GI=; h=From:To:Cc:Subject:Date:From; b=qRFo1vXaPt7JYkc9Fi7mtlDFJuRpCFy55IvyjZQpGXESsPOsd+YQ3JSRd7t3HgLeS W8PuO7BybiipeveeFgjvfdUpSoPPBcddhnxmUpcihSFvF9Dm/KM5vPB1oVChEBKBJo u55YV7ofvjX5BvssgjflrAv3RBCB1NJlhSpks6Jf5NdgGEdWxKdAJyEnGvC/cyl9UN afG1yhSfmKFrUOO4K7S/fvXVOssjQWDPTobqXWjaMuu0h1009LR7WhoFiYK6kt+wpa NijyGdrzRyBk/FRsGch46lbZqJYy1P+CCnZglL2JTu2Du4arskXzgsN5DvlrhAL2ys 2IkVbogDb35tQ== Received: (nullmailer pid 443100 invoked by uid 1000); Fri, 06 Oct 2023 22:44:49 -0000 From: Rob Herring To: Gregory CLEMENT , Andi Shyti , Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Vignesh R Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH] i2c: Use device_get_match_data() Date: Fri, 6 Oct 2023 17:44:46 -0500 Message-Id: <20231006224446.443015-1-robh@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 06 Oct 2023 15:45:15 -0700 (PDT) X-Spam-Level: ** 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/i2c/busses/i2c-mv64xxx.c | 11 +++++------ drivers/i2c/busses/i2c-omap.c | 8 +++----- drivers/i2c/busses/i2c-pxa.c | 7 +++---- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index fd8403b07fa6..dc160cbc3155 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -19,11 +19,10 @@ #include #include #include +#include #include #include #include -#include -#include #include #include #include @@ -859,7 +858,7 @@ static int mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, struct device *dev) { - const struct of_device_id *device; + const struct mv64xxx_i2c_regs *data; struct device_node *np = dev->of_node; u32 bus_freq, tclk; int rc = 0; @@ -897,11 +896,11 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, */ drv_data->adapter.timeout = HZ; - device = of_match_device(mv64xxx_i2c_of_match_table, dev); - if (!device) + data = device_get_match_data(dev); + if (!data) return -ENODEV; - memcpy(&drv_data->reg_offsets, device->data, sizeof(drv_data->reg_offsets)); + memcpy(&drv_data->reg_offsets, data, sizeof(drv_data->reg_offsets)); /* * For controllers embedded in new SoCs activate the diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 58fd6fa3edf1..42165ef57946 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -25,11 +25,11 @@ #include #include #include -#include #include #include #include #include +#include /* I2C controller revisions */ #define OMAP_I2C_OMAP1_REV_2 0x20 @@ -1358,7 +1358,6 @@ omap_i2c_probe(struct platform_device *pdev) const struct omap_i2c_bus_platform_data *pdata = dev_get_platdata(&pdev->dev); struct device_node *node = pdev->dev.of_node; - const struct of_device_id *match; int irq; int r; u32 rev; @@ -1376,11 +1375,10 @@ omap_i2c_probe(struct platform_device *pdev) if (IS_ERR(omap->base)) return PTR_ERR(omap->base); - match = of_match_device(of_match_ptr(omap_i2c_of_match), &pdev->dev); - if (match) { + if (pdev->dev.of_node) { u32 freq = I2C_MAX_STANDARD_MODE_FREQ; - pdata = match->data; + pdata = device_get_match_data(&pdev->dev); omap->flags = pdata->flags; of_property_read_u32(node, "clock-frequency", &freq); diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 29be05af826b..1d7648242749 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -32,6 +32,7 @@ #include #include #include +#include #include /* I2C register field definitions */ @@ -1252,10 +1253,8 @@ static int i2c_pxa_probe_dt(struct platform_device *pdev, struct pxa_i2c *i2c, enum pxa_i2c_types *i2c_types) { struct device_node *np = pdev->dev.of_node; - const struct of_device_id *of_id = - of_match_device(i2c_pxa_dt_ids, &pdev->dev); - if (!of_id) + if (!pdev->dev.of_node) return 1; /* For device tree we always use the dynamic or alias-assigned ID */ @@ -1264,7 +1263,7 @@ static int i2c_pxa_probe_dt(struct platform_device *pdev, struct pxa_i2c *i2c, i2c->use_pio = of_property_read_bool(np, "mrvl,i2c-polling"); i2c->fast_mode = of_property_read_bool(np, "mrvl,i2c-fast-mode"); - *i2c_types = (enum pxa_i2c_types)(of_id->data); + *i2c_types = (enum pxa_i2c_types)device_get_match_data(&pdev->dev); return 0; } -- 2.40.1