Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp3864130ima; Tue, 23 Oct 2018 12:31:30 -0700 (PDT) X-Google-Smtp-Source: ACcGV63drrs5XEES25iAju51EZWxs9bv+TKl6omH3e4R5Odi3SfbqS0rTjibwPr7S7JFt76+TRD3 X-Received: by 2002:a62:db46:: with SMTP id f67-v6mr50667153pfg.1.1540323090515; Tue, 23 Oct 2018 12:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540323090; cv=none; d=google.com; s=arc-20160816; b=djLxhE42wqBAB2BLHoEztxfPzw2TEwqUlbqOG8NdLl9efyp4bfmIIrCSxTtly8lyRI 5ko9RALMCxRG7OIHz4K60iYsELST3ZfyOEXZhao/sDOuBNkfaZRjH5EejPrwcTxMjBfo zZVaal7LD55v3+cFDO8Wns7hv5PURqqzZXjYKgmJqH6CJLBZuyQLTA/eyNmFdM316EyG qLar4b1W5AUMUlQuKXelKm5+3vlk2IES2OLTXink9RXSZYXrkEaUHC2ThhWLObyWtN1d mfgs5PjS3oHZxgzKi6JL9gL6+8lKfwhlZuVgpkpReDWJsF5O8TnrJ0vn3rdttwNksOod o18Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xF66coTRSYmbK1l/9V5IQYeun2MGn1ncLMQRgln+OxU=; b=gyMIVXO3cUjFscBHMnqvbNIRG3brWAB+VYb/A/sT/q5FJmrOgOEWd4qs6LFtRl+A9Z 2vsEZ0uqU/mq5N92oqvfET1r2Ty3X2rH4ZeEBzYHmQIVb3l5G+rQ1DZyEdmbCFloNXhp aqkpqGXxitA4Yjxtn/6lRsGHxEicrHPbC5a222HUh7B23w4Db3DQiV4cJfZFKOhjgYeD PNJ3rDK3VrX8fwmZbzI6Y0oQKhVFQq+zioxLvhLzJMrCxj752VmCpkzR2659Y3OBANcI EdCvKL8NNegyVT5tOMhKwkhT7eiN/V0EpnIxhHSepBeMGnklqiZpku6uUdfP+ZtY1Z1A fZzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w14-v6si1931215plq.327.2018.10.23.12.31.15; Tue, 23 Oct 2018 12:31:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729032AbeJXDzD (ORCPT + 99 others); Tue, 23 Oct 2018 23:55:03 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:58557 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727758AbeJXDzD (ORCPT ); Tue, 23 Oct 2018 23:55:03 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 07153806F5; Tue, 23 Oct 2018 21:30:13 +0200 (CEST) Date: Tue, 23 Oct 2018 21:30:14 +0200 From: Pavel Machek To: Jacek Anaszewski Cc: Dan O'Donovan , linux-kernel@vger.kernel.org, Andy Shevchenko , Mika Westerberg , Heikki Krogerus , Lee Jones , Linus Walleij , linux-gpio@vger.kernel.org, linux-leds@vger.kernel.org, Carlos Iglesias , Javier Arteaga Subject: Re: [PATCH v2 2/3] leds: upboard: Add LED support Message-ID: <20181023193014.GA32003@amd> References: <20180421085009.28773-1-javier@emutex.com> <1539969334-24577-1-git-send-email-dan@emutex.com> <1539969334-24577-3-git-send-email-dan@emutex.com> <20181023185453.GA27397@amd> <226e0df2-83f9-bee5-f359-a3e040d12311@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+QahgC5+KEYLbs62" Content-Disposition: inline In-Reply-To: <226e0df2-83f9-bee5-f359-a3e040d12311@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --+QahgC5+KEYLbs62 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue 2018-10-23 21:09:54, Jacek Anaszewski wrote: > On 10/23/2018 08:54 PM, Pavel Machek wrote: > > Hi! > >=20 > >>> + led->field =3D devm_regmap_field_alloc(dev, regmap, conf); > >>> + if (IS_ERR(led->field)) > >>> + return PTR_ERR(led->field); > >>> + > >>> + led->cdev.max_brightness =3D 1; > >> > >> s/1/LED_ON/ > >=20 > > Actually, I prefer constant 1 here, as it makes it immediately obvious > > this supports just 0/1. > >=20 > > Yes, LED_ON is also 1, but I had to grep the header files for > > that... (I thought it was 255). >=20 > If we have the enum for that, let's use it. > Here's the commit message of the patch adding LED_ON - it should > be somehow familiar to you - see the ack. Well .. brightness =3D LED_ON; is good usage. max_brightness =3D LED_ON is IMO less readable than max_brightness =3D 1. Looking at situation again... Having LED_ON and LED_FULL, with some leds having max brightness of 1023, so LED_FULL is not really full brightness any more... Maybe it is time to get rid of the enum, and make it plain int. It does not really enumarate anything, and it does not help readability, either. Pavel > commit 4e552c8cb5bc9137e67e035bab8df6dddbca7384 > Author: Andi Shyti > Date: Thu Jan 5 11:34:12 2017 +0900 >=20 > leds: add LED_ON brightness as boolean value >=20 > Some devices do not handle the led brightness or simply don't > care about it. Conceptually said devices want to just switch on > or off the led. It is useless in this case to have a 255 range > of brightness, while just having an LED_ON and LED_OFF improves > the boolean meaning of the led status. >=20 > Signed-off-by: Andi Shyti > Acked-by: Pavel Machek > Signed-off-by: Jacek Anaszewski >=20 >=20 --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --+QahgC5+KEYLbs62 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlvPdsYACgkQMOfwapXb+vImMACeKoO4h32MomIbcsmGThXHjn0m JpMAoIRistLuJPRkZMrx48Yq29zep+xm =MitW -----END PGP SIGNATURE----- --+QahgC5+KEYLbs62--