Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

s390/qeth: Make hw_trap sysfs attribute idempotent

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>
Link: https://patch.msgid.link/20250718141711.1141049-1-wintera@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Aswin Karuvally and committed by
Jakub Kicinski
1b02c861 14e710d7

+13 -9
+13 -9
drivers/s390/net/qeth_core_sys.c
··· 518 518 if (qeth_card_hw_is_reachable(card)) 519 519 state = 1; 520 520 521 - if (sysfs_streq(buf, "arm") && !card->info.hwtrap) { 522 - if (state) { 521 + if (sysfs_streq(buf, "arm")) { 522 + if (state && !card->info.hwtrap) { 523 523 if (qeth_is_diagass_supported(card, 524 524 QETH_DIAGS_CMD_TRAP)) { 525 525 rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_ARM); 526 526 if (!rc) 527 527 card->info.hwtrap = 1; 528 - } else 528 + } else { 529 529 rc = -EINVAL; 530 - } else 530 + } 531 + } else { 531 532 card->info.hwtrap = 1; 532 - } else if (sysfs_streq(buf, "disarm") && card->info.hwtrap) { 533 - if (state) { 533 + } 534 + } else if (sysfs_streq(buf, "disarm")) { 535 + if (state && card->info.hwtrap) { 534 536 rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); 535 537 if (!rc) 536 538 card->info.hwtrap = 0; 537 - } else 539 + } else { 538 540 card->info.hwtrap = 0; 539 - } else if (sysfs_streq(buf, "trap") && state && card->info.hwtrap) 541 + } 542 + } else if (sysfs_streq(buf, "trap") && state && card->info.hwtrap) { 540 543 rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_CAPTURE); 541 - else 544 + } else { 542 545 rc = -EINVAL; 546 + } 543 547 544 548 mutex_unlock(&card->conf_mutex); 545 549 return rc ? rc : count;