Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1431732

Re: [PATCH 2/2] leds: Add driver for NCP5623 3-channel I2C LED driver

From Florian Vaussard <florian.vaussard@heig-vd.ch>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] leds: Add driver for NCP5623 3-channel I2C LED driver
Date 2016-06-27 08:00 +0200
Message-ID <rOxKq-4Aw-21@gated-at.bofh.it> (permalink)
References <rMoif-2I5-59@gated-at.bofh.it> <rMorU-2Ll-9@gated-at.bofh.it> <rMw66-7Hw-29@gated-at.bofh.it> <rOq6d-8bL-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Pavel,

Le 26. 06. 16 à 23:49, Pavel Machek a écrit :
> Hi!
> 
>>> +struct ncp5623_led {
>>> +	bool active;
>>> +	unsigned int led_no;
>>> +	struct led_classdev ldev;
>>> +	struct work_struct work;
>>> +	struct ncp5623_priv *priv;
>>> +};
>>> +
>>> +struct ncp5623_priv {
>>> +	struct ncp5623_led leds[NCP5623_MAX_LEDS];
>>
>> Please allocate memory dynamically, depending on the number
>> of LEDs defined in a Device Tree.
> 
> MAX_LEDs is three. Are you sure overhead of dynamic allocation is
> worth it?
> 
> And if this is for RGB leds... very probably device will want to use
> all 3 channels.
> 

I was about to raise the same question during the v2 of this patch. In addition
to your arguments, this also changes the way this array is indexed.

Currently the LED number is used as index, but with dynamic allocation I have to
use an abstract index. This makes some logic a bit harder, especially to check
if the same LED is declared twice in the device tree (duplicated 'reg' property).

Best,
Florian

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/2] leds: Add driver for NCP5623 3-channel I2C LED driver Pavel Machek <pavel@ucw.cz> - 2016-06-26 23:50 +0200
  Re: [PATCH 2/2] leds: Add driver for NCP5623 3-channel I2C LED driver Florian Vaussard <florian.vaussard@heig-vd.ch> - 2016-06-27 08:00 +0200
    Re: [PATCH 2/2] leds: Add driver for NCP5623 3-channel I2C LED driver Jacek Anaszewski <j.anaszewski@samsung.com> - 2016-06-27 09:10 +0200

csiph-web