Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Andres Urian Florez <andres.emb.sys@gmail.com>
To: dlechner@baylibre.com, broonie@kernel.org
Cc: Andres Urian Florez <andres.emb.sys@gmail.com>,
	skhan@linuxfoundation.org, linux-spi@vger.kernel.org
Subject: [PATCH] spi: offload: check for match callback when a trigger is being registered
Date: Fri, 18 Apr 2025 12:55:29 -0500	[thread overview]
Message-ID: <20250418175542.13820-1-andres.emb.sys@gmail.com> (raw)

Make match a required callback when a new trigger is being registered,
this allows that other functions like spi_offload_trigger_get() could
safelly invoke the callback when it is required

Signed-off-by: Andres Urian Florez <andres.emb.sys@gmail.com>
---
 drivers/spi/spi-offload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-offload.c b/drivers/spi/spi-offload.c
index 6bad042fe437..6f4c5188e6ad 100644
--- a/drivers/spi/spi-offload.c
+++ b/drivers/spi/spi-offload.c
@@ -434,7 +434,7 @@ int devm_spi_offload_trigger_register(struct device *dev,
 {
 	struct spi_offload_trigger *trigger;
 
-	if (!info->fwnode || !info->ops)
+	if (!info->fwnode || !(info->ops && info->ops->match))
 		return -EINVAL;
 
 	trigger = kzalloc(sizeof(*trigger), GFP_KERNEL);
-- 
2.43.0


             reply	other threads:[~2025-04-18 17:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-18 17:55 Andres Urian Florez [this message]
2025-04-18 19:49 ` [PATCH] spi: offload: check for match callback when a trigger is being registered David Lechner
2025-04-18 21:52   ` Andres Urian
  -- strict thread matches above, loose matches on Subject: below --
2025-04-18 22:39 Andres Urian Florez
2025-04-18 22:42 ` Andres Urian

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=20250418175542.13820-1-andres.emb.sys@gmail.com \
    --to=andres.emb.sys@gmail.com \
    --cc=broonie@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=linux-spi@vger.kernel.org \
    --cc=skhan@linuxfoundation.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