* [PATCH] btrfs: sysfs: Drop unnecessary double logical negation in acl_show()
@ 2024-02-12 1:34 Neal Gompa
2024-02-13 13:28 ` Anand Jain
2024-02-13 19:47 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Neal Gompa @ 2024-02-12 1:34 UTC (permalink / raw)
To: linux-btrfs; +Cc: Josef Bacik, Sweet Tea Dorminy, Davide Cavalca, Neal Gompa
The IS_ENABLED() macro already guarantees the result will be a
suitable boolean return value ("1" for enabled, and "0" for disabled).
Thus, it seems that the "!!" used right before is unnecessary, since
it is a double negation.
Dropping it should not result in any functional changes.
Signed-off-by: Neal Gompa <neal@gompa.dev>
---
fs/btrfs/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index e6b51fb..c07a9f7 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -421,7 +421,7 @@ BTRFS_ATTR(static_feature, supported_sectorsizes,
static ssize_t acl_show(struct kobject *kobj, struct kobj_attribute *a, char *buf)
{
- return sysfs_emit(buf, "%d\n", !!IS_ENABLED(CONFIG_BTRFS_FS_POSIX_ACL));
+ return sysfs_emit(buf, "%d\n", IS_ENABLED(CONFIG_BTRFS_FS_POSIX_ACL));
}
BTRFS_ATTR(static_feature, acl, acl_show);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: sysfs: Drop unnecessary double logical negation in acl_show()
2024-02-12 1:34 [PATCH] btrfs: sysfs: Drop unnecessary double logical negation in acl_show() Neal Gompa
@ 2024-02-13 13:28 ` Anand Jain
2024-02-13 19:47 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Anand Jain @ 2024-02-13 13:28 UTC (permalink / raw)
To: Neal Gompa, linux-btrfs; +Cc: Josef Bacik, Sweet Tea Dorminy, Davide Cavalca
On 2/12/24 07:04, Neal Gompa wrote:
> The IS_ENABLED() macro already guarantees the result will be a
> suitable boolean return value ("1" for enabled, and "0" for disabled).
>
> Thus, it seems that the "!!" used right before is unnecessary, since
> it is a double negation.
>
> Dropping it should not result in any functional changes.
>
> Signed-off-by: Neal Gompa <neal@gompa.dev>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: sysfs: Drop unnecessary double logical negation in acl_show()
2024-02-12 1:34 [PATCH] btrfs: sysfs: Drop unnecessary double logical negation in acl_show() Neal Gompa
2024-02-13 13:28 ` Anand Jain
@ 2024-02-13 19:47 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2024-02-13 19:47 UTC (permalink / raw)
To: Neal Gompa; +Cc: linux-btrfs, Josef Bacik, Sweet Tea Dorminy, Davide Cavalca
On Sun, Feb 11, 2024 at 08:34:44PM -0500, Neal Gompa wrote:
> The IS_ENABLED() macro already guarantees the result will be a
> suitable boolean return value ("1" for enabled, and "0" for disabled).
>
> Thus, it seems that the "!!" used right before is unnecessary, since
> it is a double negation.
Double negation is used to force 0/1 boolean values if it's from an
unknown source or value range but IS_ENABLED says it's returning 0/1 so
yeah it's not needed.
> Dropping it should not result in any functional changes.
>
> Signed-off-by: Neal Gompa <neal@gompa.dev>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-13 19:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 1:34 [PATCH] btrfs: sysfs: Drop unnecessary double logical negation in acl_show() Neal Gompa
2024-02-13 13:28 ` Anand Jain
2024-02-13 19:47 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.