]> www.infradead.org Git - users/jedix/linux-maple.git/commit
leds: led-test: Fill out the registration test to cover more test cases
authorLee Jones <lee@kernel.org>
Thu, 1 May 2025 08:19:12 +0000 (09:19 +0100)
committerLee Jones <lee@kernel.org>
Wed, 14 May 2025 08:25:06 +0000 (09:25 +0100)
commiteb58933b78cdad9b879dc2dd248e7284341a1cfc
tree42cf64d8633bbf688ea69417e2cdf59df025291e
parent1d7f25483c8791f395dd857cce8a6a65bcfa295f
leds: led-test: Fill out the registration test to cover more test cases

Upon successful LED class device registration, it is expected that
certain attributes are filled out in pre-defined ways.  For instance, if
provided, the .brightness_get() call-back should be called to populate
the class device 'brightness' attribute, 'max_brightness' should be
initialised as LED_FULL (at least until we can rid these pesky enums)
and the sysfs group should be created with the class device name
supplied by the caller.

If subsequent registrations take place that would result in name
conflicts, various outcomes are expected depending on which flags are
set.  If LED_REJECT_NAME_CONFLICT is disabled, registration should
succeed resulting in an iteration on the provided name.  Conversely, if
it's enabled, then registration is expected to fail outright.

We test for all of these scenarios here.

Link: https://lore.kernel.org/r/20250501081918.3621432-2-lee@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/led-test.c