[PATCH v30 05/16] leds: multicolor: Introduce a multicolor class definition

Pavel Machek pavel at ucw.cz
Thu Jul 16 04:31:04 EDT 2020


Hi!

First, let's substitute multi.color -> multicolor globally,
LEDS_CLASS_MULTI_COLOR is most visible example of this. Please also
decide whether it is MultiColor or multicolor, and make it consistent.

> Introduce a multicolor class that groups colored LEDs
> within a LED node.
> 
> The multi color class groups monochrome LEDs and allows controlling two

For example here. Plus, the LEDs are not neccessarily monochrome, we
support white LEDs, too. Let's use "simple LEDs"?

> aspects of the final combined color: hue and lightness. The former is
> controlled via the intensity file and the latter is controlled
> via brightness file.

> +	depends on LEDS_CLASS
> +	help
> +	  This option enables the multicolor LED sysfs class in /sys/class/leds.
> +	  It wraps LED class and adds multicolor LED specific sysfs attributes
> +	  and kernel internal API to it. You'll need this to provide support
> +	  for multicolor LEDs that are grouped together. This class is not
> +	  intended for single color LEDs. It can be built as a module.

"single color" -> "simple"?

> +	/* account for the new line at the end of the buffer */
> +	offset++;
> +	if (offset < size) {
> +		ret = -EINVAL;
> +		goto err_out;
> +	}

"new line" -> "newline", and actually check that character you are
skipping is newline. Someone could put '%' in there...

> +		if (i < mcled_cdev->num_colors - 1)
> +			len += sprintf(buf + len, " ");
> +	len += sprintf(buf + len, "\n");

Using sprintf for single character has... quite a lot of
overhead. Something like buf[len++] = '\n' would be
simpler/shorter/better. Please fix all relevant places.

Note I already applied patches 1-4.

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20200716/51cddd96/attachment.sig>


More information about the linux-arm-kernel mailing list