Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1501424rdb; Tue, 30 Jan 2024 23:49:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnSXGiZeQ5r5A8XWMNN3xJufitwMZtHvslqzUB+1NhUHTWI9uoDKT584fWQCxC0P/sNOgJ X-Received: by 2002:a17:906:3409:b0:a36:449b:8f36 with SMTP id c9-20020a170906340900b00a36449b8f36mr503421ejb.67.1706687356766; Tue, 30 Jan 2024 23:49:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706687356; cv=pass; d=google.com; s=arc-20160816; b=qSU+rmxjM+ao7GPFSWgCLCcqaOTGKamYjdTzyd/6K3vefV8BGafMHLFpaAlxaMkr16 1H9kx7NzJNVC9DvkWDvecUbcAbYWiTscaNe+7Bv+QobwdJgVa4NC/Qn93gNErD+sDw+p Al6SWxeVZfBnA0gakE8D4mRYY6jaU1k05IjySE6jhX6q2bqQRJiJZ0Owpsm1gp+Ookz4 0hti/Hf+PR5UX+QdJf8k9+vrMvEVBCt/lcb7inxZjl80FKK6QfH8vzkA7EMKHhIVESJy Uau00cJ2gh3Ci/2feTyj0vjhHOepp1dM9N7djYF0uPfIaIYsUYP7wL63m3gZ7YTa+kdr VG5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=RLdaiwSQLCEYO2yfia41RKGOh7FdkZphixl1QCRTCPQ=; fh=Up8i7WEdkrUi8+gZPy17DLA71CIZZHglDtulOsubQmA=; b=u2XF6MKDlnILdjVZZ5ILTwf0tWg8xEy/UzPO77QwUbnD8TiTMlx4nvLWQTwoAOpbBH FNcItGp4SWGnybh7MdQJi86Ww4sdhffNstEJ/lWc7R9Z2FdqSsCOd+0c0ZxLH8f5Hz8I lCasvVwtdUjQxx4FEsovmm74EyEL2sfKOZkQBmuux4UoQeJ9ElBsRJ4kx0lOXJ26J5wF 3kmX74I5vuw4tNVYrc3uCuGPlkMyDY/uB1pSgSdn+8JsbOu17D2Jr8YL4+2Jy64JMKIH L8Ody/CPweksiUWxrPb5NwqYT0B/AMdESJrB7g7qGcpLh/6sYaYT2KMqZshzPUfolKIO ZW9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=traphandler.com); spf=pass (google.com: domain of linux-kernel+bounces-45946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45946-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXHwRszLel+dPrVmZWmk0IK4TaqDxcPLxxvOECI1wyqhdj2kKAEuxNzPHeFeeXjR/pvx5oW4K/U+7XgBcfXj83s+Wej7/Q0R/zqzWKJgQ== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f5-20020a17090631c500b00a35e59b27e4si2276251ejf.487.2024.01.30.23.49.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 23:49:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=traphandler.com); spf=pass (google.com: domain of linux-kernel+bounces-45946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45946-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8609E1F233A3 for ; Wed, 31 Jan 2024 07:49:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7C1855C04; Wed, 31 Jan 2024 07:49:08 +0000 (UTC) Received: from smtpout6.mo539.mail-out.ovh.net (smtpout6.mo539.mail-out.ovh.net [51.210.91.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 004A050A7C; Wed, 31 Jan 2024 07:49:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.210.91.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706687348; cv=none; b=asuR/yBt8YfDb227eoGzM0I8xkqf30KVIvLy/Q//9i96Ul9aVkLvJX9ysHeOdRk/v2c8a5z6lhAHe3lfjMAUOkA7VBzdzu/9aKx+DiUriVpcw6lZm1ERc0MkQ+1ZgCIqnbJtlr2/2CVCMp1E/LfHcDTJ22xJ6VMedwfGBSxMsSY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706687348; c=relaxed/simple; bh=Hw13MPJ3GhSveA/QB4xi4k5QM0dv0Kf9dUeEqT6svb4=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=uLCHW4JSWnznR5WTP0GHv2xDUjbLiMlV8c5WSR9X6qwwEa+X4uxjXWwny6pWweSUvIGToOKbNRuUxCxq20e67i60osOhJ2ToP2mP58nxp0L6s6evPbiefZtFgkxCXDRy6yHxkwoStvZpp12L2MmatJkIaBbuQFQ0k1kokMIIzzw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=traphandler.com; spf=pass smtp.mailfrom=traphandler.com; arc=none smtp.client-ip=51.210.91.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=traphandler.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=traphandler.com Received: from director3.derp.mail-out.ovh.net (director3.derp.mail-out.ovh.net [152.228.215.222]) by mo539.mail-out.ovh.net (Postfix) with ESMTPS id AD7801FF90; Wed, 31 Jan 2024 07:39:02 +0000 (UTC) Received: from director3.derp.mail-out.ovh.net (director3.derp.mail-out.ovh.net. [127.0.0.1]) by director3.derp.mail-out.ovh.net (inspect_sender_mail_agent) with SMTP for ; Wed, 31 Jan 2024 07:39:02 +0000 (UTC) Received: from pro2.mail.ovh.net (unknown [10.109.140.67]) by director3.derp.mail-out.ovh.net (Postfix) with ESMTPS id 65D30101836; Wed, 31 Jan 2024 07:39:02 +0000 (UTC) Received: from [192.168.1.15] (88.161.25.233) by DAG1EX1.emp2.local (172.16.2.1) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 31 Jan 2024 08:39:01 +0100 Message-ID: <05f9c78d-b398-420e-bc0f-fb642e76efdc@traphandler.com> Date: Wed, 31 Jan 2024 08:39:01 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] leds: rgb: leds-group-multicolor: allow leds to stay on in suspend To: Aren Moynihan , CC: Miles Alan , Ondrej Jirman , Lee Jones , Pavel Machek , References: <20240128204740.2355092-1-aren@peacevolution.org> Content-Language: en-US From: Jean-Jacques Hiblot In-Reply-To: <20240128204740.2355092-1-aren@peacevolution.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DAG2EX1.emp2.local (172.16.2.11) To DAG1EX1.emp2.local (172.16.2.1) X-Ovh-Tracer-Id: 17948533367631264241 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrfedtkedguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfhisehtjeertddtvdejnecuhfhrohhmpeflvggrnhdqlfgrtghquhgvshcujfhisghlohhtuceojhhjhhhisghlohhtsehtrhgrphhhrghnughlvghrrdgtohhmqeenucggtffrrghtthgvrhhnpefhfffgtdffvdelheejhfdtfeeklefhheeghfffueeggfdukedtfeefteelleekgfenucfkphepuddvjedrtddrtddruddpkeekrdduiedurddvhedrvdeffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehjjhhhihgslhhothesthhrrghphhgrnhgulhgvrhdrtghomheqpdhnsggprhgtphhtthhopedupdhrtghpthhtoheplhgvvgeskhgvrhhnvghlrdhorhhgpdhmsehmihhlvghsrghlrghnrdgtohhmpdgrrhgvnhesphgvrggtvghvohhluhhtihhonhdrohhrghdpphgrvhgvlhesuhgtfidrtgiipdhlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdplhhinhhugidqlhgvughssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhmvghgihesgihffhdrtgiipdfovfetjfhoshhtpehmohehfeelpdhmohguvg epshhmthhpohhuth On 28/01/2024 21:45, Aren Moynihan wrote: > If none of the managed leds enable LED_CORE_SUSPENDRESUME, then we > shouldn't need to set it here. This makes it possible to use multicolor > groups with gpio leds that enable retain-state-suspended in the device > tree. > > Signed-off-by: Aren Moynihan > --- > > drivers/leds/rgb/leds-group-multicolor.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/leds/rgb/leds-group-multicolor.c b/drivers/leds/rgb/leds-group-multicolor.c > index 39f58be32af5..194c6a33640b 100644 > --- a/drivers/leds/rgb/leds-group-multicolor.c > +++ b/drivers/leds/rgb/leds-group-multicolor.c > @@ -69,7 +69,7 @@ static int leds_gmc_probe(struct platform_device *pdev) > struct mc_subled *subled; > struct leds_multicolor *priv; > unsigned int max_brightness = 0; > - int i, ret, count = 0; > + int i, ret, count, common_flags = 0; count is not initialized anymore. Isn't it a problem ? > > priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > if (!priv) > @@ -91,6 +91,7 @@ static int leds_gmc_probe(struct platform_device *pdev) > if (!priv->monochromatics) > return -ENOMEM; > > + common_flags |= led_cdev->flags; > priv->monochromatics[count] = led_cdev; > > max_brightness = max(max_brightness, led_cdev->max_brightness); > @@ -114,12 +115,15 @@ static int leds_gmc_probe(struct platform_device *pdev) > > /* Initialise the multicolor's LED class device */ > cdev = &priv->mc_cdev.led_cdev; > - cdev->flags = LED_CORE_SUSPENDRESUME; > cdev->brightness_set_blocking = leds_gmc_set; > cdev->max_brightness = max_brightness; > cdev->color = LED_COLOR_ID_MULTI; > priv->mc_cdev.num_colors = count; > > + /* we only need suspend/resume if a sub-led requests it */ > + if (common_flags & LED_CORE_SUSPENDRESUME) > + cdev->flags = LED_CORE_SUSPENDRESUME; > + > init_data.fwnode = dev_fwnode(dev); > ret = devm_led_classdev_multicolor_register_ext(dev, &priv->mc_cdev, &init_data); > if (ret)