Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754877AbcDTIyB (ORCPT ); Wed, 20 Apr 2016 04:54:01 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.163]:9744 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754841AbcDTIxz (ORCPT ); Wed, 20 Apr 2016 04:53:55 -0400 X-RZG-AUTH: :JGIXVUS7cutRB/49FwqZ7WcecEarQROEYabkiUo6mSAGQ+qKIDwxPMcfpiY= X-RZG-CLASS-ID: mo00 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: [Letux-kernel] [PATCH] drivers: led: is31fl319x: 6/9-channel light effect led driver From: "H. Nikolaus Schaller" In-Reply-To: Date: Wed, 20 Apr 2016 10:53:24 +0200 Cc: Mark Rutland , devicetree@vger.kernel.org, Pawel Moll , Ian Campbell , kernel@pyra-handheld.com, LKML , Rob Herring , Richard Purdie , Kumar Gala , linux-leds@vger.kernel.org, Discussions about the Letux Kernel Content-Transfer-Encoding: 7bit Message-Id: <0F30E42A-9B27-4DFF-B8BD-BC226214A9BE@goldelico.com> References: <75127f4bf2bb11343bdff5bfb1129a092e668c61.1461004995.git.hns@goldelico.com> <5715F6EF.9090909@samsung.com> To: Jacek Anaszewski X-Mailer: Apple Mail (2.3124) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1262 Lines: 39 Hi Jacek, >>> +static void is31fl319x_brightness_set(struct led_classdev *led_cdev, >>> + enum led_brightness brightness) >>> +{ >>> + struct is31fl319x_led *led = container_of(led_cdev, >>> + struct is31fl319x_led, >>> + led_cdev); >>> + struct is31fl319x_chip *is31 = led->chip; >>> + unsigned long flags; >>> + >>> + spin_lock_irqsave(&is31->lock, flags); >>> + >>> + if (brightness != is31fl319x_brightness_get(led_cdev)) { >> >> Current brightness is cached in led_cdev->brightness. > > Hm. I could not find the code line where it is cached. > > And if I remember correctly (it is a while ago that we did develop > this driver) experiments didn't show that it is cached there. Or the > old value is not available inside the brightness setter but already > the new one. Something like that was the reason why we cache > it inside the driver. > I have added a printk inside is31fl319x_brightness_set but never got a difference between brightness and led_cdev->brightness. This seems to confirm that it is already set to the new value. Thus we can't detect changes in brightness by comparing to the previous value. Can you please confirm? Otherwise the driver works well so that I am almost ready for posting V2. Thanks, Nikolaus