Thread (52 messages) 52 messages, 4 authors, 2024-01-19

Re: [PATCH 17/18] tty: serial: samsung: shrink port feature flags to u8

From: Tudor Ambarus <tudor.ambarus@linaro.org>
Date: 2024-01-19 08:56:06
Also in: linux-samsung-soc, linux-serial, lkml


On 1/16/24 19:03, Sam Protsenko wrote:
On Wed, Jan 10, 2024 at 4:25 AM Tudor Ambarus [off-list ref] wrote:
quoted
There's a single flag defined as of now. Shrink the feature flags to u8
and aim for a better memory footprint for ``struct s3c24xx_uart_info``.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/tty/serial/samsung_tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index 5df2bcebf9fb..598d9fe7a492 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -90,7 +90,7 @@ struct s3c24xx_uart_info {

        /* uart port features */

-       unsigned int            has_divslot:1;
+       u8                      has_divslot:1;
But that's already a bit field. Why does it matter which type it is?
If using unsigned int the bitfied is combined with the previous u8
fields, whereas if using u8 the bitfield will be independently defined.
So no benefit in terms of memory footprint, it's just a cosmetic change
to align the bitfield with the previous u8 fields. Allowing u32 for just
a bit can be misleading as one would ask itself where are the other
bits. Between a u32 bitfield and a bool a u8 bitfield seems like a good
compromise.

I'll update the commit message with this explanation in v2 because I'd
keep the patch, it makes the struct look cleaner. At the same time I
don't have a strong opinion, so if you'd like to see the patch dropped,
tell there, I'll be fine with it.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help