From: Nam Tran <trannamatk@gmail.com>
To: lee@kernel.org
Cc: gregkh@linuxfoundation.org, pavel@kernel.org,
rdunlap@infradead.org, christophe.jaillet@wanadoo.fr,
krzk+dt@kernel.org, robh@kernel.org, conor+dt@kernel.org,
corbet@lwn.net, linux-leds@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: Re: [PATCH v18 2/3] leds: add basic support for TI/National Semiconductor LP5812 LED Driver
Date: Wed, 26 Nov 2025 23:00:24 +0700 [thread overview]
Message-ID: <20251126160024.141129-1-trannamatk@gmail.com> (raw)
In-Reply-To: <20251125134836.GC1127788@google.com>
On Tue, 25 Nov 2025, Lee Jones wrote:
> > +static ssize_t parse_drive_mode(struct lp5812_chip *chip, const char *str)
> > +{
> > + int i;
> > +
> > + chip->u_drive_mode.s_drive_mode.mix_sel_led_0 = false;
> > + chip->u_drive_mode.s_drive_mode.mix_sel_led_1 = false;
> > + chip->u_drive_mode.s_drive_mode.mix_sel_led_2 = false;
> > + chip->u_drive_mode.s_drive_mode.mix_sel_led_3 = false;
> > +
> > + if (sysfs_streq(str, LP5812_MODE_DIRECT_NAME)) {
> > + chip->u_drive_mode.s_drive_mode.led_mode = LP5812_MODE_DIRECT_VALUE;
> > + return 0;
> > + }
> > +
> > + for (i = 0; i < ARRAY_SIZE(chip_mode_map); i++) {
> > + if (!sysfs_streq(str, chip_mode_map[i].mode_name))
> > + continue;
> > +
> > + chip->u_drive_mode.s_drive_mode.led_mode = chip_mode_map[i].mode;
> > + chip->u_scan_order.s_scan_order.scan_order_0 = chip_mode_map[i].scan_order_0;
> > + chip->u_scan_order.s_scan_order.scan_order_1 = chip_mode_map[i].scan_order_1;
> > + chip->u_scan_order.s_scan_order.scan_order_2 = chip_mode_map[i].scan_order_2;
> > + chip->u_scan_order.s_scan_order.scan_order_3 = chip_mode_map[i].scan_order_3;
>
> Where are all of these used?
These fields are part of unions (u_drive_mode and u_scan_order).
The bitfields are packed into drive_mode_val and scan_order_val, which are
written to DEV_CONFIG1 and DEV_CONFIG2 in lp5812_set_drive_mode_scan_order().
> [...]
>
> > +union u_scan_order {
>
> What is 'u'?
The u_* and s_* prefixes were originally meant to indicate union/struct, but they are not idiomatic.
I will rename it to
union lp5812_scan_order {
struct {
u8 order0:2;
u8 order1:2;
u8 order2:2;
u8 order3:2;
} bits;
u8 val;
};
and do the same for u_drive_mode.
Thanks for reviewing.
Best regards,
Nam Tran
next prev parent reply other threads:[~2025-11-26 16:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-23 19:10 [PATCH v18 0/3] leds: add new LED driver for TI LP5812 Nam Tran
2025-11-23 19:10 ` [PATCH v18 1/3] dt-bindings: leds: add TI/National Semiconductor LP5812 LED Driver Nam Tran
2025-11-24 7:30 ` Krzysztof Kozlowski
2025-11-24 7:55 ` Krzysztof Kozlowski
2025-11-24 7:57 ` Krzysztof Kozlowski
2025-11-24 8:02 ` Krzysztof Kozlowski
2025-11-26 16:55 ` Nam Tran
2025-11-23 19:10 ` [PATCH v18 2/3] leds: add basic support for " Nam Tran
2025-11-25 13:48 ` Lee Jones
2025-11-26 16:00 ` Nam Tran [this message]
2025-11-27 11:32 ` Lee Jones
2025-11-27 14:58 ` Nam Tran
2025-11-23 19:10 ` [PATCH v18 3/3] docs: leds: Document TI LP5812 LED driver Nam Tran
2025-11-23 19:20 ` Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251126160024.141129-1-trannamatk@gmail.com \
--to=trannamatk@gmail.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=rdunlap@infradead.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).