Linux SPI subsystem development
 help / color / mirror / Atom feed
* [PATCH] spi: offload: check for match callback when a trigger is being registered
@ 2025-04-18 17:55 Andres Urian Florez
  2025-04-18 19:49 ` David Lechner
  0 siblings, 1 reply; 5+ messages in thread
From: Andres Urian Florez @ 2025-04-18 17:55 UTC (permalink / raw)
  To: dlechner, broonie; +Cc: Andres Urian Florez, skhan, linux-spi

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] spi: offload: check for match callback when a trigger is being registered
@ 2025-04-18 22:39 Andres Urian Florez
  2025-04-18 22:42 ` Andres Urian
  0 siblings, 1 reply; 5+ messages in thread
From: Andres Urian Florez @ 2025-04-18 22:39 UTC (permalink / raw)
  To: dlechner, broonie; +Cc: Andres Urian Florez, skhan, linux-spi

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

In v2:
- improve readability of the condition

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..21a0f3a3a176 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-04-18 22:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-18 17:55 [PATCH] spi: offload: check for match callback when a trigger is being registered Andres Urian Florez
2025-04-18 19:49 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox