* [PATCH RESEND] fpga: bridge: Use str_enabled_disabled helper in state_show
@ 2025-12-19 21:27 Thorsten Blum
0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2025-12-19 21:27 UTC (permalink / raw)
To: Moritz Fischer, Xu Yilun, Tom Rix; +Cc: Thorsten Blum, linux-fpga, linux-kernel
Replace hard-coded strings with the str_enabled_disabled() helper. This
unifies the output and helps the linker with deduplication, which can
result in a smaller binary.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/fpga/fpga-bridge.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
index 8ef395b49bf8..0c54e415fa5a 100644
--- a/drivers/fpga/fpga-bridge.c
+++ b/drivers/fpga/fpga-bridge.c
@@ -12,6 +12,7 @@
#include <linux/of_platform.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <linux/string_choices.h>
static DEFINE_IDA(fpga_bridge_ida);
static const struct class fpga_bridge_class;
@@ -305,7 +306,7 @@ static ssize_t state_show(struct device *dev,
return state;
}
- return sysfs_emit(buf, "%s\n", state ? "enabled" : "disabled");
+ return sysfs_emit(buf, "%s\n", str_enabled_disabled(state));
}
static DEVICE_ATTR_RO(name);
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH RESEND] fpga: bridge: Use str_enabled_disabled helper in state_show
@ 2026-01-26 0:47 Thorsten Blum
0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2026-01-26 0:47 UTC (permalink / raw)
To: Moritz Fischer, Xu Yilun, Tom Rix; +Cc: Thorsten Blum, linux-fpga, linux-kernel
Replace hard-coded strings with the str_enabled_disabled() helper. This
unifies the output and helps the linker with deduplication, which can
result in a smaller binary.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/fpga/fpga-bridge.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
index 8ef395b49bf8..0c54e415fa5a 100644
--- a/drivers/fpga/fpga-bridge.c
+++ b/drivers/fpga/fpga-bridge.c
@@ -12,6 +12,7 @@
#include <linux/of_platform.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <linux/string_choices.h>
static DEFINE_IDA(fpga_bridge_ida);
static const struct class fpga_bridge_class;
@@ -305,7 +306,7 @@ static ssize_t state_show(struct device *dev,
return state;
}
- return sysfs_emit(buf, "%s\n", state ? "enabled" : "disabled");
+ return sysfs_emit(buf, "%s\n", str_enabled_disabled(state));
}
static DEVICE_ATTR_RO(name);
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH RESEND] fpga: bridge: Use str_enabled_disabled helper in state_show
@ 2026-02-24 16:15 Thorsten Blum
2026-03-01 13:06 ` Dinh Nguyen
0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2026-02-24 16:15 UTC (permalink / raw)
To: Moritz Fischer, Xu Yilun, Tom Rix; +Cc: Thorsten Blum, linux-fpga, linux-kernel
Replace hard-coded strings with the str_enabled_disabled() helper. This
unifies the output and helps the linker with deduplication, which can
result in a smaller binary.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/fpga/fpga-bridge.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
index ca68c38aa4a1..e8ff3e3bf2fc 100644
--- a/drivers/fpga/fpga-bridge.c
+++ b/drivers/fpga/fpga-bridge.c
@@ -12,6 +12,7 @@
#include <linux/of_platform.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <linux/string_choices.h>
static DEFINE_IDA(fpga_bridge_ida);
static const struct class fpga_bridge_class;
@@ -305,7 +306,7 @@ static ssize_t state_show(struct device *dev,
return state;
}
- return sysfs_emit(buf, "%s\n", state ? "enabled" : "disabled");
+ return sysfs_emit(buf, "%s\n", str_enabled_disabled(state));
}
static DEVICE_ATTR_RO(name);
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] fpga: bridge: Use str_enabled_disabled helper in state_show
2026-02-24 16:15 Thorsten Blum
@ 2026-03-01 13:06 ` Dinh Nguyen
2026-03-02 3:34 ` Xu Yilun
0 siblings, 1 reply; 5+ messages in thread
From: Dinh Nguyen @ 2026-03-01 13:06 UTC (permalink / raw)
To: Thorsten Blum, Moritz Fischer, Xu Yilun, Tom Rix; +Cc: linux-fpga, linux-kernel
Hi Thorsten,
On 2/24/26 10:15, Thorsten Blum wrote:
> Replace hard-coded strings with the str_enabled_disabled() helper. This
> unifies the output and helps the linker with deduplication, which can
> result in a smaller binary.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/fpga/fpga-bridge.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
> index ca68c38aa4a1..e8ff3e3bf2fc 100644
> --- a/drivers/fpga/fpga-bridge.c
> +++ b/drivers/fpga/fpga-bridge.c
> @@ -12,6 +12,7 @@
> #include <linux/of_platform.h>
> #include <linux/slab.h>
> #include <linux/spinlock.h>
> +#include <linux/string_choices.h>
>
> static DEFINE_IDA(fpga_bridge_ida);
> static const struct class fpga_bridge_class;
> @@ -305,7 +306,7 @@ static ssize_t state_show(struct device *dev,
> return state;
> }
>
> - return sysfs_emit(buf, "%s\n", state ? "enabled" : "disabled");
> + return sysfs_emit(buf, "%s\n", str_enabled_disabled(state));
> }
>
> static DEVICE_ATTR_RO(name);
Would you consider including this patch[1] to this?
Dinh
[1]
https://lore.kernel.org/linux-fpga/aXH2D06eZ5DRTVi0@yilunxu-OptiPlex-7050/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] fpga: bridge: Use str_enabled_disabled helper in state_show
2026-03-01 13:06 ` Dinh Nguyen
@ 2026-03-02 3:34 ` Xu Yilun
0 siblings, 0 replies; 5+ messages in thread
From: Xu Yilun @ 2026-03-02 3:34 UTC (permalink / raw)
To: Dinh Nguyen
Cc: Thorsten Blum, Moritz Fischer, Xu Yilun, Tom Rix, linux-fpga,
linux-kernel
On Sun, Mar 01, 2026 at 07:06:57AM -0600, Dinh Nguyen wrote:
> Hi Thorsten,
>
> On 2/24/26 10:15, Thorsten Blum wrote:
> > Replace hard-coded strings with the str_enabled_disabled() helper. This
> > unifies the output and helps the linker with deduplication, which can
> > result in a smaller binary.
> >
> > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> > ---
> > drivers/fpga/fpga-bridge.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
> > index ca68c38aa4a1..e8ff3e3bf2fc 100644
> > --- a/drivers/fpga/fpga-bridge.c
> > +++ b/drivers/fpga/fpga-bridge.c
> > @@ -12,6 +12,7 @@
> > #include <linux/of_platform.h>
> > #include <linux/slab.h>
> > #include <linux/spinlock.h>
> > +#include <linux/string_choices.h>
> > static DEFINE_IDA(fpga_bridge_ida);
> > static const struct class fpga_bridge_class;
> > @@ -305,7 +306,7 @@ static ssize_t state_show(struct device *dev,
> > return state;
> > }
> > - return sysfs_emit(buf, "%s\n", state ? "enabled" : "disabled");
> > + return sysfs_emit(buf, "%s\n", str_enabled_disabled(state));
> > }
> > static DEVICE_ATTR_RO(name);
>
> Would you consider including this patch[1] to this?
Oh... This str_enabled_disabled() is exactly the same trivial changes I
was thinking of when I wrote that comment.
>
> Dinh
> [1]
> https://lore.kernel.org/linux-fpga/aXH2D06eZ5DRTVi0@yilunxu-OptiPlex-7050/
But hi Dinh, took another look, the state_show() in the same file is
already switched to sysfs_emit() by previous valid change. So to keep the
file consistency, it's good to change to sysfs_emit() for name_show().
Sorry for my neglection.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-02 3:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-19 21:27 [PATCH RESEND] fpga: bridge: Use str_enabled_disabled helper in state_show Thorsten Blum
-- strict thread matches above, loose matches on Subject: below --
2026-01-26 0:47 Thorsten Blum
2026-02-24 16:15 Thorsten Blum
2026-03-01 13:06 ` Dinh Nguyen
2026-03-02 3:34 ` Xu Yilun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox