Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2766381pxy; Tue, 3 Aug 2021 14:48:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK/GlwFDgaKxaTK0anDM6aT/mpT9ARb6syy5yBudWeJIZLS6uM7pBRRRLKyT3DmrS1EJR7 X-Received: by 2002:a5d:93d1:: with SMTP id j17mr749063ioo.123.1628027320803; Tue, 03 Aug 2021 14:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628027320; cv=none; d=google.com; s=arc-20160816; b=fpt9RZSAO5kqwNwmQybASfo5kEbAD+3etZ0w4Hx3jJZDdWAqQORGlrWgpwSaCWruvV NdlOb60UvJTaQA+3DA5+2Nmg3sqmYenrAuz2z+rD/+1pWaiWDY1fxIXW6ycLmG4E3q0C B2bHnrV9DvCQIr3TB3mLQeKt95Ny3IoXG3JJXyPnVolC1rC519sKa1prWBgESagbo4Le 05yBMkOlqqGTa2HBHKxCcJEF6ZR3vZI8jCqaU4gEVX7RGmiFDQ+mmBtlLIr94TxOxABg oyv5uoe25IWmpX5c68teIJRHQTiYoCahOl9ba4C/wFS4dbrdxLq63WtuWbS4FNBvRKN+ Nl3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=4jl1mqXd3g0CQlBjuAjxKRWVbTVOqzlgUpt3TlDRhLQ=; b=udl7nLHXA8H2yTjRlFCIRvn3756AOWE3LvAuICThwtcn5dEIFWJnYvfJRbPbpLt5rR Hffw3a4LkGsd9X842OyZ4ll69yqXEsZfR0JStG+EzowHzfth1F41w2aF1AuyMECfgm22 DJb9FqDl70gebzXj+1EZFbdu+qVxiIFg/1CEu5bz+I1CvorZ45B9O+dUagviJZJbUiC3 e0HQFvfV2lfgCq4QoC5NNs8oFqSmHZ1MNlSPwagEWTdsqgq0PrQOfI9I6AyXzwACeyei I4USJTHOZ5HorZhE6se4K+o+nw0MPlu8etbryQbDSlm8YFeT5oZ3vZ9LOWO/MP88Kb6h EUjg== 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 g2si136466jat.88.2021.08.03.14.48.28; Tue, 03 Aug 2021 14:48:40 -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 S232607AbhHCVjK (ORCPT + 99 others); Tue, 3 Aug 2021 17:39:10 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:38634 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232384AbhHCVjJ (ORCPT ); Tue, 3 Aug 2021 17:39:09 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id DB5BF1C0B7A; Tue, 3 Aug 2021 23:38:56 +0200 (CEST) Date: Tue, 3 Aug 2021 23:38:56 +0200 From: Pavel Machek To: Geert Uytterhoeven Cc: Amy Parker , linux-leds , Linux Kernel Mailing List , Dan Carpenter Subject: Re: [PATCH 1/2] swap led_brightness from enum to typedef Message-ID: <20210803213855.GA30387@amd> References: <9b5902665dcc4c0fca7546987303e348d8657f59.1626383424.git.apark0006@student.cerritos.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Dxnq1zWXvFF0Q93v" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > > The TODO located at drivers/leds/TODO requests: > > > > > > * Get rid of led_brightness > > > > > > It is really an integer, as maximum is configurable. Get rid of it, or > > > make it into typedef or something. > > > > > > This patch changes the declaration of led_brightness from an enum to a > > > typedef. In order to hold the currently existing enum values, macro > > > definitions are provided. Files which use led_brightness are updated = to > > > conform to the new types. > > > > > > Signed-off-by: Amy Parker > > > > Thanks for your patch! > > > > > 207 files changed, 437 insertions(+), 438 deletions(-) > > > > This touches a lot of files, so we better get it right. > > > > > --- a/include/linux/leds.h > > > +++ b/include/linux/leds.h > > > @@ -26,12 +26,11 @@ struct device_node; > > > */ > > > > > > /* This is obsolete/useless. We now support variable maximum brightne= ss. */ > > > -enum led_brightness { > > > - LED_OFF =3D 0, > > > - LED_ON =3D 1, > > > - LED_HALF =3D 127, > > > - LED_FULL =3D 255, > > > -}; > > > +typedef u8 led_brightness; > > > > In general, typedefs are frowned upon in the kernel, but there can be a > > good reason to use one. > > What if the maximum brightness is larger than 255? > > Using "unsigned int" sounds better to me, but let's wait for Pavel... >=20 > And as Dan just pointed out, "signed int" would be even better, as it > would allow a function to return an error code. We can not apply huge patch all at once, and changing from enum to int directly will result in warnings in some configurations, no? Agreed that int would be good. Best regards, Pavel --=20 http://www.livejournal.com/~pavelmachek --Dxnq1zWXvFF0Q93v Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmEJt28ACgkQMOfwapXb+vLrDACeLYg44ClynSPwfyzZhQonro29 ypwAnRkiArkpjCD+lk/lAFDe0o4lnu0A =CCEG -----END PGP SIGNATURE----- --Dxnq1zWXvFF0Q93v--