netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] s390/qeth: Make hw_trap sysfs attribute idempotent
@ 2025-07-18 14:17 Alexandra Winter
  2025-07-18 20:26 ` Simon Horman
  2025-07-22  0:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Alexandra Winter @ 2025-07-18 14:17 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	Andrew Lunn
  Cc: netdev, linux-s390, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Thorsten Winkler, Simon Horman, Aswin Karuvally

From: Aswin Karuvally <aswin@linux.ibm.com>

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
    $

Suggested-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Aswin Karuvally <aswin@linux.ibm.com>
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
---
 drivers/s390/net/qeth_core_sys.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
index eea93f8f106f..c0e4883be6d0 100644
--- a/drivers/s390/net/qeth_core_sys.c
+++ b/drivers/s390/net/qeth_core_sys.c
@@ -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;
-- 
2.48.1


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

* Re: [PATCH net-next] s390/qeth: Make hw_trap sysfs attribute idempotent
  2025-07-18 14:17 [PATCH net-next] s390/qeth: Make hw_trap sysfs attribute idempotent Alexandra Winter
@ 2025-07-18 20:26 ` Simon Horman
  2025-07-22  0:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-07-18 20:26 UTC (permalink / raw)
  To: Alexandra Winter
  Cc: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	Andrew Lunn, netdev, linux-s390, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Thorsten Winkler, Aswin Karuvally

On Fri, Jul 18, 2025 at 04:17:11PM +0200, Alexandra Winter wrote:
> From: Aswin Karuvally <aswin@linux.ibm.com>
> 
> 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
>     $
> 
> Suggested-by: Alexandra Winter <wintera@linux.ibm.com>
> Signed-off-by: Aswin Karuvally <aswin@linux.ibm.com>
> Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
> Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>

Reviewed-by: Simon Horman <horms@kernel.org>


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

* Re: [PATCH net-next] s390/qeth: Make hw_trap sysfs attribute idempotent
  2025-07-18 14:17 [PATCH net-next] s390/qeth: Make hw_trap sysfs attribute idempotent Alexandra Winter
  2025-07-18 20:26 ` Simon Horman
@ 2025-07-22  0:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-22  0:50 UTC (permalink / raw)
  To: Alexandra Winter
  Cc: davem, kuba, pabeni, edumazet, andrew+netdev, netdev, linux-s390,
	hca, gor, agordeev, borntraeger, svens, twinkler, horms, aswin

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 18 Jul 2025 16:17:11 +0200 you wrote:
> From: Aswin Karuvally <aswin@linux.ibm.com>
> 
> 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
>     $
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-07-22  0:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-18 14:17 [PATCH net-next] s390/qeth: Make hw_trap sysfs attribute idempotent Alexandra Winter
2025-07-18 20:26 ` Simon Horman
2025-07-22  0:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).