Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp548917ybl; Wed, 28 Aug 2019 01:45:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLBBtd4+jzVQ1ooM4p7/claGLNan2b38iDK7D4VEk39Z4QscteYM1TEaTBezjd7pTRrjlV X-Received: by 2002:a65:6102:: with SMTP id z2mr2422930pgu.391.1566981906438; Wed, 28 Aug 2019 01:45:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566981906; cv=none; d=google.com; s=arc-20160816; b=cVK5ud8q6PGDNH6T3o0z/BRhgmh8sLJx+d0zFSHqW7aBPntM/dMrYMQN3315mBwF1M 6Cc04AOzSH4FjFMaFmPdDyl53EvkmQBDm5jrPGu0CNqv5oeYmoEbrVAuDJEauDRJVccL ZRkuPiD84V509nXlDlAQMzYDvHmdRcplh1fOtCzg3GdsoFTPLIdQd7tzOF/W+39+L97o oapK8XHi0Dii51W9e8/4DA2cMU8W4SZ1ZQnoJpwK20mQEZtivANVUTvcg2fLUGNnKTxH N3UNVNjhNRrMrGneNQ3SPH1Pm5CWk8M4rhXilYpllej6h3q4mxBhHXXhDuisoqj827ht ektA== 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=rgewPqH5TBKBPT2FFmq+FRoGKoR2/bK/SaOKh6ftj34=; b=eCcz6Azdq0Bvgt1QNmOD7kX5r6SjZWzO23sgwfkmj4MZsa7do5irgNE4kOHnTZTg0/ 4h2XT/eGylXijSYruM+MbvPUGG7LwKdKaTvh/pg1CglNp286sk2LgoIEmnMY5aHJjjPw MACqj594v0a7hzC4Km7gRDerer1Ai4pNeWGgN6p5Zx4F0fG4OoMcwuG7fztUkp0DscFG OdVAdRwmYIBSD8mClvNrs1EBgO3Nu+bNeIyW4FMLAgpO92u0Z/EFZ7KN2doCcC8u1nTD SizvvukDDuY0TNuwOM+M+14ADeo5mhDuImEbQjCCLD3LHTu5ZJHoSjpfxit5/VdxfYW6 3Onw== 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 d9si1370017pll.320.2019.08.28.01.44.50; Wed, 28 Aug 2019 01:45:06 -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 S1726368AbfH1Imi (ORCPT + 99 others); Wed, 28 Aug 2019 04:42:38 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:51253 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbfH1Imi (ORCPT ); Wed, 28 Aug 2019 04:42:38 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 02B8782362; Wed, 28 Aug 2019 10:42:22 +0200 (CEST) Date: Wed, 28 Aug 2019 10:42:36 +0200 From: Pavel Machek To: Tony Lindgren Cc: Jacek Anaszewski , Dan Murphy , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] leds: lm3532: Avoid potentially unpaired regulator calls Message-ID: <20190828084235.GA2923@amd> References: <20190827215205.59677-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qMm9M+Fa2AknHoGS" Content-Disposition: inline In-Reply-To: <20190827215205.59677-1-tony@atomide.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 --qMm9M+Fa2AknHoGS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > We may currently get unpaired regulator calls when configuring the LED > brightness via sysfs in case of regulator calls producing errors. Let's > fix this by maintaining local state for enabled. >=20 > Signed-off-by: Tony Lindgren Acked-by: Pavel Machek > +++ b/drivers/leds/leds-lm3532.c > @@ -127,6 +127,7 @@ struct lm3532_als_data { > * @num_leds - Number of LED strings are supported in this array > * @full_scale_current - The full-scale current setting for the current = sink. > * @led_strings - The LED strings supported in this array > + * @enabled - Enabled status > * @label - LED label > */ > struct lm3532_led { > @@ -138,6 +139,7 @@ struct lm3532_led { > int ctrl_brt_pointer; > int num_leds; > int full_scale_current; > + int enabled:1; > u32 led_strings[LM3532_MAX_CONTROL_BANKS]; > char label[LED_MAX_NAME_SIZE]; > }; I'd do bool enabled, but this version is good, too. Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --qMm9M+Fa2AknHoGS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl1mPnsACgkQMOfwapXb+vISdACcD9PUur9GQedFWTo1hoxyghuV f+YAnRELhy1q8FoKORsTbYCHO6jj8GI1 =1P7e -----END PGP SIGNATURE----- --qMm9M+Fa2AknHoGS--