Skip to contentSkip to conversation

spi: offload: remove unnecessary check on trigger->ops

PATCH In review Andres Urian Florez 3 participants 3 messages Apr 18, 2025 – Apr 22, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: offload: remove unnecessary check on trigger->ops

Considering that trigger->ops = NULL happens only when the trigger is being removed from the list, and at that point the operation is protected with the spi_offload_triggers_lock, it is possible to remove the !trigger->ops check because it will never be true in spi_offload_trigger_get()

---
 drivers/spi/spi-offload.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/spi/spi-offload.c +0 -3
index 6bad042fe437..c43264dc3900 100644
@@ -183,9 +183,6 @@ static struct spi_offload_trigger
 
 	guard(mutex)(&trigger->lock);
 
-	if (!trigger->ops)
-		return ERR_PTR(-ENODEV);
-
 	if (trigger->ops->request) {
 		ret = trigger->ops->request(trigger, type, args->args, args->nargs);
 		if (ret)
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Andres Urian Florez

Considering that trigger->ops = NULL happens only when the trigger is being removed from the list, and at that point the operation is protected with the spi_offload_triggers_lock, it is possible to remove the !trigger->ops check because it will never be true in spi_offload_trigger_get()

---

Thanks for the cleanup!

maintainer
#2 lore raw
In reply to Andres Urian Florez
Quoted 8 lines · Andres Urian Florez

Considering that trigger->ops = NULL happens only when the trigger is being removed from the list, and at that point the operation is protected with the spi_offload_triggers_lock, it is possible to remove the !trigger->ops check because it will never be true in spi_offload_trigger_get()

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: offload: remove unnecessary check on trigger->ops

      commit: 296e8d289bdd7eb0d832683ebd3e847fbb4c1b12

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark