From nobody Fri Jan 2 17:12:29 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 3109ACD6137 for ; Mon, 9 Oct 2023 21:14:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378621AbjJIVOy (ORCPT ); Mon, 9 Oct 2023 17:14:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378722AbjJIVOb (ORCPT ); Mon, 9 Oct 2023 17:14:31 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A45B8112 for ; Mon, 9 Oct 2023 14:14:24 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74AEBC433C7; Mon, 9 Oct 2023 21:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696886063; bh=mT7mKFR44RqR0uyHV49wMoQ+fmYk1j+hJEVKfvKQEWE=; h=From:To:Cc:Subject:Date:From; b=dWjgR3m89a5GHLTtUB4ZgPDA8QLOHqzj4qg7dpFhejovWibdhZzYi0Q0lmytbjMbD z2PG+90zOMb5z6sfD+ALFq4sKvjUhVOCDZXmnjEvIl09Fw7nF+R7s1pxD040Ep+c8z eARDSMc6ei/UxkddAHbuwaBpjyIr25QXU2Yl2VDoRVEAiJzqQD00MQG7ZCuHzP9VBM DQmy4L+wFHbXw4gTn5KnlJ1h0Z0DXENsvn7qDnXkP0czi6f1r4/wUv5rE3wH90n9Gn zOsR2QHKnZ3+HD8wRTWTobU4mZFqHkIukBkefBcDrkuratnexLakypvqi3VajOIep6 NVMaKCPtdTM3Q== Received: (nullmailer pid 3245536 invoked by uid 1000); Mon, 09 Oct 2023 21:14:09 -0000 From: Rob Herring To: Lee Jones Cc: linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Subject: [PATCH] mfd: Use spi_get_device_match_data() Date: Mon, 9 Oct 2023 16:13:35 -0500 Message-ID: <20231009211356.3242037-5-robh@kernel.org> X-Mailer: git-send-email 2.42.0 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" Use preferred spi_get_device_match_data() instead of of_match_device() and spi_get_device_id() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring --- drivers/mfd/mc13xxx-spi.c | 14 ++------------ drivers/mfd/wm831x-spi.c | 16 ++++------------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c index f70d79aa5a83..c973e2579bdf 100644 --- a/drivers/mfd/mc13xxx-spi.c +++ b/drivers/mfd/mc13xxx-spi.c @@ -8,13 +8,12 @@ */ =20 #include +#include #include #include #include #include #include -#include -#include #include #include =20 @@ -151,16 +150,7 @@ static int mc13xxx_spi_probe(struct spi_device *spi) return ret; } =20 - if (spi->dev.of_node) { - const struct of_device_id *of_id =3D - of_match_device(mc13xxx_dt_ids, &spi->dev); - - mc13xxx->variant =3D of_id->data; - } else { - const struct spi_device_id *id_entry =3D spi_get_device_id(spi); - - mc13xxx->variant =3D (void *)id_entry->driver_data; - } + mc13xxx->variant =3D spi_get_device_match_data(spi); =20 return mc13xxx_common_init(&spi->dev); } diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c index 76be7ef5c970..54c87267917b 100644 --- a/drivers/mfd/wm831x-spi.c +++ b/drivers/mfd/wm831x-spi.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -21,21 +20,14 @@ static int wm831x_spi_probe(struct spi_device *spi) { struct wm831x_pdata *pdata =3D dev_get_platdata(&spi->dev); - const struct spi_device_id *id =3D spi_get_device_id(spi); - const struct of_device_id *of_id; struct wm831x *wm831x; enum wm831x_parent type; int ret; =20 - if (spi->dev.of_node) { - of_id =3D of_match_device(wm831x_of_match, &spi->dev); - if (!of_id) { - dev_err(&spi->dev, "Failed to match device\n"); - return -ENODEV; - } - type =3D (uintptr_t)of_id->data; - } else { - type =3D (enum wm831x_parent)id->driver_data; + type =3D (uintptr_t)spi_get_device_match_data(spi); + if (!type) { + dev_err(&spi->dev, "Failed to match device\n"); + return -ENODEV; } =20 wm831x =3D devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL); --=20 2.42.0