Re: [PATCH v2 18/18] auxdisplay: ht16k33: Add segment display LED support

From: Geert Uytterhoeven
Date: Mon Jun 28 2021 - 05:21:20 EST


Hi Marek,

On Fri, Jun 25, 2021 at 10:39 PM Marek Behun <marek.behun@xxxxxx> wrote:
> On Fri, 25 Jun 2021 14:59:02 +0200
> Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
>
> > Instantiate a single LED for a segment display. This allows the user to
> > control display brightness and blinking through the LED class API and
> > triggers, and exposes the display color.
> > The LED will be named "auxdisplay:<color>:backlight".
>
> What if there are multiple "auxdisplay"s ?

I understand the LED core will just add a suffix on a name collision.

> Doesn't this subsystem have IDs? So that you can use auxdisplayN for
> device name, for example?

Auxdisplay does not have IDs, as there is no subsystem to register
with. It's just a collection of drivers for auxiliary displays with
no common API. Some drivers use fbdev, others use a chardev, or an
attribute file in sysfs.

BTW, I just followed Pavel's advice in naming.

> > + of_property_read_u32(node, "color", &color);
> > + seg->led.name = devm_kasprintf(dev, GFP_KERNEL,
> > + "auxdisplay:%s:" LED_FUNCTION_BACKLIGHT,
> > + color < LED_COLOR_ID_MAX ? led_colors[color] : "");
>
> If you use devm_led_classdev_register_ext and pass struct
> led_init_data, LED core will generate name of the LED itself.

Will that make any difference, except for adding more code?
Looking at the implementation, I still have to use devm_kasprintf()
to combine color and function for led_init_data.default_label?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds