Skip to contentSkip to conversation

s390/qeth: Make hw_trap sysfs attribute idempotent

PATCH Applied Alexandra Winter 3 participants 3 messages Jul 18, 2025 – Jul 22, 2025

Subsystems (4)
lore
Share & tools
lore

Alexandra Winter

author maintainer
#0 lore raw

PATCH 1/1 s390/qeth: Make hw_trap sysfs attribute idempotent

From: Aswin Karuvally <[email protected]>

Update qeth driver to allow writing an existing value to the "hw_trap" sysfs attribute. Attempting such a write earlier resulted in -EINVAL. In other words, make the sysfs attribute idempotent.

After:

    $ cat hw_trap
    disarm
    $ echo disarm > hw_trap
    $
---
 drivers/s390/net/qeth_core_sys.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/s390/net/qeth_core_sys.c +13 -9
index eea93f8f106f..c0e4883be6d0 100644
@@ -518,28 +518,32 @@ static ssize_t qeth_hw_trap_store(struct device *dev,
 	if (qeth_card_hw_is_reachable(card))
 		state = 1;
 
-	if (sysfs_streq(buf, "arm") && !card->info.hwtrap) {
-		if (state) {
+	if (sysfs_streq(buf, "arm")) {
+		if (state && !card->info.hwtrap) {
 			if (qeth_is_diagass_supported(card,
 			    QETH_DIAGS_CMD_TRAP)) {
 				rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_ARM);
 				if (!rc)
 					card->info.hwtrap = 1;
-			} else
+			} else {
 				rc = -EINVAL;
-		} else
+			}
+		} else {
 			card->info.hwtrap = 1;
-	} else if (sysfs_streq(buf, "disarm") && card->info.hwtrap) {
-		if (state) {
+		}
+	} else if (sysfs_streq(buf, "disarm")) {
+		if (state && card->info.hwtrap) {
 			rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM);
 			if (!rc)
 				card->info.hwtrap = 0;
-		} else
+		} else {
 			card->info.hwtrap = 0;
-	} else if (sysfs_streq(buf, "trap") && state && card->info.hwtrap)
+		}
+	} else if (sysfs_streq(buf, "trap") && state && card->info.hwtrap) {
 		rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_CAPTURE);
-	else
+	} else {
 		rc = -EINVAL;
+	}
 
 	mutex_unlock(&card->conf_mutex);
 	return rc ? rc : count;
Signature · 1 line
2.48.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Alexandra Winter

From: Aswin Karuvally <[email protected]>

Update qeth driver to allow writing an existing value to the "hw_trap" sysfs attribute. Attempting such a write earlier resulted in -EINVAL. In other words, make the sysfs attribute idempotent.

After:

    $ cat hw_trap
    disarm
    $ echo disarm > hw_trap
    $
Quoted 4 lines
#2 lore raw
In reply to Alexandra Winter
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 6 lines · On Fri, 18 Jul 2025 16:17:11 +0200 you wrote:

From: Aswin Karuvally <[email protected]>

Update qeth driver to allow writing an existing value to the "hw_trap" sysfs attribute. Attempting such a write earlier resulted in -EINVAL. In other words, make the sysfs attribute idempotent.

Quoted 7 lines

After:

    $ cat hw_trap
    disarm
    $ echo disarm > hw_trap
    $

[...]

Here is the summary with links:
- [net-next] s390/qeth: Make hw_trap sysfs attribute idempotent

    https://git.kernel.org/netdev/net-next/c/1b02c861714b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html