From patchwork Mon Oct 9 21:13:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 150335 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp2124601vqo; Mon, 9 Oct 2023 14:15:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFq5x1Q6Gsnlas9fXWJDosyJ3DdrBkm4ZFcCHnow8EKDp3jhezympYvxQCZC2Cl2oWk4PAK X-Received: by 2002:a05:6a00:849:b0:68e:2c2a:5172 with SMTP id q9-20020a056a00084900b0068e2c2a5172mr19489336pfk.6.1696886099960; Mon, 09 Oct 2023 14:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696886099; cv=none; d=google.com; s=arc-20160816; b=VwhlMzCqx16JS+6H6Y7vP+M4EQMx8NpH8vsh2z4MVeL+3BYMLCPa3O0K1wCU4JeIgU etBwk77JZ8wYee6HPZ/vXFvsUbGFWQMgRT7+FHdSqLKuBr5BdYbbn4lwgpkQWnPTZs5G Eth/jakxkahgIuKge4CYH50NGSEWvNb1zWDmvTedPm9mFGOsK5K9IxbKNZ99/eOGnSk1 Yv5/Ipicp1iv1HZESIwNqBlItuZEuwajp1X2tFEtaNmiNRkEX0miDj7KRzHJi5CxpAOP gOU1HgREnAFFzFapG0tKKwNf9sByQpOGOKNk1Zyij6CrrrNNutWtA/BA5a5hvLSKyB+s 9N6A== 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=tlXWKbsf5/gUFLRD8MZ8nhq2WyOrSzkHVURrmbpQ9bU=; fh=Udu9zRpGU/cb9bb/pYbz8fHI1LaOJsHp0GVZO5caJoM=; b=eAvT1efFvgEdP62SWrwrMWuf2G2QEg0uG5YwxuC7vmb3LMzuGJ0idbo6RuswKlgcLj +Oa4d01t8wzIm52tRFn4aAvsHTAVyagalHCWMu3UWtm+37cboBsKGgrgAPN3ebfI/w8i LjSCkUWTF9AtbKfTo8aymA2NwuRbid4vGNeJy9bbrqOZkskZHiwGpM7Xh4oRtxyhxu5m v7Snpv9RHY7AalQiysrKHq6/UhN+A9qltgZWdCp09AIOJ366kgmwlax2k0A7M6xL6yPK zWPfuv560Y31VFwktwV9WtIp1EcXIeJTVI2c+0WpfxS0YrKxXvYuaUKStd5MCNUsCKF2 rZeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dWjgR3m8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bx16-20020a056a00429000b0069338b22c0csi7766712pfb.359.2023.10.09.14.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 14:14:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dWjgR3m8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id CC51680E7102; Mon, 9 Oct 2023 14:14:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378789AbjJIVOw (ORCPT + 19 others); Mon, 9 Oct 2023 17:14:52 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 09 Oct 2023 14:14:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779314038848299142 X-GMAIL-MSGID: 1779314038848299142 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 @@ */ #include +#include #include #include #include #include #include -#include -#include #include #include @@ -151,16 +150,7 @@ static int mc13xxx_spi_probe(struct spi_device *spi) return ret; } - if (spi->dev.of_node) { - const struct of_device_id *of_id = - of_match_device(mc13xxx_dt_ids, &spi->dev); - - mc13xxx->variant = of_id->data; - } else { - const struct spi_device_id *id_entry = spi_get_device_id(spi); - - mc13xxx->variant = (void *)id_entry->driver_data; - } + mc13xxx->variant = spi_get_device_match_data(spi); 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 = dev_get_platdata(&spi->dev); - const struct spi_device_id *id = spi_get_device_id(spi); - const struct of_device_id *of_id; struct wm831x *wm831x; enum wm831x_parent type; int ret; - if (spi->dev.of_node) { - of_id = of_match_device(wm831x_of_match, &spi->dev); - if (!of_id) { - dev_err(&spi->dev, "Failed to match device\n"); - return -ENODEV; - } - type = (uintptr_t)of_id->data; - } else { - type = (enum wm831x_parent)id->driver_data; + type = (uintptr_t)spi_get_device_match_data(spi); + if (!type) { + dev_err(&spi->dev, "Failed to match device\n"); + return -ENODEV; } wm831x = devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL);