From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751740AbcF0HJO (ORCPT ); Mon, 27 Jun 2016 03:09:14 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:57109 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750870AbcF0HJM (ORCPT ); Mon, 27 Jun 2016 03:09:12 -0400 MIME-version: 1.0 Content-type: text/plain; charset=windows-1252; format=flowed X-AuditID: cbfec7f5-f792a6d000001302-0c-5770d115ecea Content-transfer-encoding: 8BIT Message-id: <5770D114.70909@samsung.com> Date: Mon, 27 Jun 2016 09:09:08 +0200 From: Jacek Anaszewski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 To: Florian Vaussard Cc: Pavel Machek , Florian Vaussard , devicetree@vger.kernel.org, Richard Purdie , Rob Herring , Mark Rutland , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] leds: Add driver for NCP5623 3-channel I2C LED driver References: <1466494154-3786-1-git-send-email-florian.vaussard@heig-vd.ch> <1466494154-3786-3-git-send-email-florian.vaussard@heig-vd.ch> <57695D45.60107@samsung.com> <20160626214902.GB21026@amd> <51f6c4d4-e5af-97b6-e7d9-61f0093de134@heig-vd.ch> In-reply-to: <51f6c4d4-e5af-97b6-e7d9-61f0093de134@heig-vd.ch> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsVy+t/xK7qiFwvCDRqvc1rMP3KO1WLyocXs Fq+2W1tc3jWHzWLrm3WMFkuvX2SyuHvqKJtF694j7Ba7dz1ldeD0WDNvDaPHzll32T2erutn 8di0qpPNY8/8H6weK1Z/Z/f4vEkugD2KyyYlNSezLLVI3y6BK+Ptl9fMBSc4K/Y+XsTWwHiY vYuRk0NCwESi5+5MRghbTOLCvfVsXYxcHEICSxklNrZMYgZJ8AoISvyYfI+li5GDg1lAXuLI pWyQMLOArcSC9+tYIOqfMUr8mN7LBlGvIdG/6S/YAhYBVYnpxzaygNhsAoYSP1+8ZgKxRQUi JP6c3scKYosIGElMnLiYGWLoVCaJk/8NQGxhAT+JSQufM0Is+M0osWT7XLChnAJ2Euu2/WWd wCgwC8l9sxDum4XkvgWMzKsYRVNLkwuKk9JzjfSKE3OLS/PS9ZLzczcxQmLh6w7GpcesDjEK cDAq8fBekCkIF2JNLCuuzD3EKMHBrCTCy3MWKMSbklhZlVqUH19UmpNafIhRmoNFSZx35q73 IUIC6YklqdmpqQWpRTBZJg5OqQbGi30d9kkW3Z2bnj9+K2fx5ty5fxWXzu+dZ6mRKLzct+RS tqnp/Lm//2RMF4yRW+NvENLy/AhndUTPRebXvjZX65fv3RH6L48x5HK38yoNz5nKJxnXa6d5 pWXraEYtKHWYMlddy3LHC3l7lXzNR3/r89rdtFOv9TtHq9Zm/Zc6lvBP6FkY82clluKMREMt 5qLiRAAjmgkQgQIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Florian and Pavel, On 06/27/2016 07:46 AM, Florian Vaussard wrote: > 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). Fair enough. Please ignore my remark then. -- Best regards, Jacek Anaszewski