Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp398479ybz; Fri, 24 Apr 2020 02:20:01 -0700 (PDT) X-Google-Smtp-Source: APiQypIn6+uPcZ87+qFVxecNerKLO6ApvVi2Wv6H23Em5G5PKSll15eZhij6MSKcyiWFtLtUY83Q X-Received: by 2002:a17:906:31da:: with SMTP id f26mr6120161ejf.308.1587720001661; Fri, 24 Apr 2020 02:20:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587720001; cv=none; d=google.com; s=arc-20160816; b=Z+LpbGP1Z5v3e6eW+0Wl2pGPBY99xWOsV5wYfKzVBXmNSVRijNoAeK9xz6LzGGec+L Y3o3UHzL2g49OJKB9ksQJQkMs1XG7GwOIym2tLRi06rtPTG39Yb8+FPcobmvN/0mgwRo 1k4SWk/W0GLYj3kwbcvhAZxo1unHfqUt28qZjDRgkvUn8c5oVJcZhGS52Un4ydh5wFmj 44Jc7+bCwXN0UdvCMNDjEIxb9z1vmrnsvl2I6JsgcD3/b9jAMsxk/lo2SjZ4TEtDokip zsc5KElkPLcUZSPiytzZo0KwoKRU/zeymxL7VeNc/98pFa0q8eDO9pinxTEQ9p2j5jZn sZpg== 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=xuH1VwlmrEC6JkVmb/wHcTNpwdZ+IOkCVbNbJr3NV4w=; b=Hzgd11cbnp/3HBYnOVYitvan5G4BKRh385zJayfKFDXA/QAR+FRtvqLygAMRRbUZo5 MrjTPBOodHtuRBnmPBcd7d/v3kk0sB02aUigM6bhTW2TZBtyvLlmEjaTztiVw/Du6IdC 6T4MeRk/mHcSJ0wu5SGWC0i/oCr0IyvgKbmX+P5uobjgQUfVhi52IkDVBoNMaTpH941F 9OB3bPsS0XJuZvUeO+BzIFbhegZUSGCxrQoov79BzlhkEDXShjlm6/vPpTbn2xaJOzyu yTcvZ6EcQLIh9jE/Uk8GVAwyjtbiMaTwmlXXwI2u9m3qOnQRF9dNOONsstaDXL1u8R9l Y46g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si2825867ejq.460.2020.04.24.02.19.37; Fri, 24 Apr 2020 02:20:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726667AbgDXJSJ (ORCPT + 99 others); Fri, 24 Apr 2020 05:18:09 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:47618 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726298AbgDXJSJ (ORCPT ); Fri, 24 Apr 2020 05:18:09 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 538E31C021D; Fri, 24 Apr 2020 11:18:07 +0200 (CEST) Date: Fri, 24 Apr 2020 11:18:06 +0200 From: Pavel Machek To: Lubomir Rintel Cc: Dan Murphy , Jacek Anaszewski , linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org Subject: Re: [PATCH v3] leds: ariel: Add driver for status LEDs on Dell Wyse 3020 Message-ID: <20200424091806.GA2647@amd> References: <20200322074134.79237-1-lkundrak@v3.sk> <20200417095041.GA448088@furthur.local> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pWyiEgJYm5f9v55/" Content-Disposition: inline In-Reply-To: <20200417095041.GA448088@furthur.local> 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 --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > > +enum ec_index { > > > + EC_BLUE_LED =3D 0x01, > > > + EC_AMBER_LED =3D 0x02, > >=20 > > Defining the value after the 0x0 is unnecessary as enums are incremental > > only the first value needs to be defined if the following values are in > > numerical order >=20 > I believe this improves readability, especially in case such as this > where the actual numeric values matter. >=20 > > Can these also be #defined instead of an enum?=A0 Not requesting them t= o be > > just wondering about the design decision here. >=20 > It seems to be that this is what enums are for and theres is no need to > get the preprocessor involved? >=20 > I guess this might be a personal preference, but it seems to me that > both enums and preprocessor defines are used across the code base. enums are okay. > > > + if (regmap_read(led->ec_ram, led->ec_index, &led_status)) > > > + return LED_OFF; > > > + > > > + if (led_status =3D=3D EC_LED_STILL) > > > + return LED_FULL; > > > + else > > else is not needed here > > > + return LED_OFF; > > > +} >=20 > Yes, but should it be dropped? To me it seems like explicit else is > better than implicit fallthrough. It is better when it's obvious that > the LED_OFF is returned precisely only when the status is not > EC_LED_STILL and that nothing ever happens afterwards -- and the > compiler/linter will warn when anything unreachable is added afterwards. >=20 > Not that it matters too much here. It's just that I've done this > deliberately because it seems more readable to be and would prefer to > leave it that way unless you really really care about that. Both versions are okay. I may have tiny bit of preference for deleting the else, but... Thank you, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --pWyiEgJYm5f9v55/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl6irs4ACgkQMOfwapXb+vK8kwCcCDKtiMSJ18qVzInjas7lgLgy yIoAoIz4gszqMa7jJj2MT69quZ/KKDOB =rDXr -----END PGP SIGNATURE----- --pWyiEgJYm5f9v55/--