From: Rosen Penev <rosenp@gmail.com>
To: linux-spi@vger.kernel.org
Cc: Mark Brown <broonie@kernel.org>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] spi: omap2-mcspi: Use of_device_get_match_data()
Date: Mon, 18 May 2026 17:43:52 -0700 [thread overview]
Message-ID: <20260519004352.627148-1-rosenp@gmail.com> (raw)
Use of_device_get_match_data() to fetch platform match data directly
instead of open-coding an of_match_device() lookup.
This also lets the driver drop the of_device.h include.
Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/spi/spi-omap2-mcspi.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index d53f98aa0aac..9cc078acc13c 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -22,7 +22,6 @@
#include <linux/slab.h>
#include <linux/pm_runtime.h>
#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/gcd.h>
#include <linux/spi/spi.h>
@@ -1481,7 +1480,6 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
int status = 0, i;
u32 regs_offset = 0;
struct device_node *node = pdev->dev.of_node;
- const struct of_device_id *match;
if (of_property_read_bool(node, "spi-slave"))
ctlr = devm_spi_alloc_target(&pdev->dev, sizeof(*mcspi));
@@ -1509,10 +1507,9 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
mcspi = spi_controller_get_devdata(ctlr);
mcspi->ctlr = ctlr;
- match = of_match_device(omap_mcspi_of_match, &pdev->dev);
- if (match) {
+ pdata = of_device_get_match_data(&pdev->dev);
+ if (pdata) {
u32 num_cs = 1; /* default number of chipselect */
- pdata = match->data;
of_property_read_u32(node, "ti,spi-num-cs", &num_cs);
ctlr->num_chipselect = num_cs;
--
2.54.0
next reply other threads:[~2026-05-19 0:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 0:43 Rosen Penev [this message]
2026-05-25 12:34 ` [PATCH] spi: omap2-mcspi: Use of_device_get_match_data() Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260519004352.627148-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox