mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 17:01:25 -05:00
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>
This commit is contained in:
committed by
Jakub Kicinski
parent
14e710d708
commit
1b02c86171
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user