Re: [PATCH v5 RESEND 3/6] leds: core: Add led_mc_set_brightness() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 24, 2024 at 5:02 PM Kate Hsuan <hpa@xxxxxxxxxx> wrote:
>
> From: Hans de Goede <hdegoede@xxxxxxxxxx>
>
> Add a new led_mc_set_brightness() function for in kernel color/brightness
> changing of multi-color LEDs.
>
> led-class-multicolor can be build as a module and led_mc_set_brightness()
> will have builtin callers, so put led_mc_set_brightness() inside led-core

the builtin

> instead, just like how led_set_brightness() is part of the core and not
> of the led-class object.
>
> This also adds a new LED_MULTI_COLOR led_classdev flag to allow
> led_mc_set_brightness() to verify that it is operating on a multi-color
> LED classdev, avoiding casting the passed in LED classdev to a multi-color
> LED classdev, when it actually is not a multi-color LED.

...

> +/*
> + * This is a led-core function because just like led_set_brightness()
> + * it is used in kernel by e.g. triggers.

in the kernel

> + */

...

> +       if (!(led_cdev->flags & LED_MULTI_COLOR)) {
> +               dev_err_once(led_cdev->dev, "%s: error not a multi-color LED\n",  __func__);

Not sure how __func__ helps here.

> +               return;
> +       }
> +
> +       mcled_cdev = lcdev_to_mccdev(led_cdev);
> +       if (num_colors != mcled_cdev->num_colors) {
> +               dev_err_once(led_cdev->dev, "%s: error num_colors mismatch %d != %d\n",

Should be '...%u != %u...'.

> +                            __func__, num_colors, mcled_cdev->num_colors);

Ditto about __func__.

> +               return;
> +       }

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux