Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp2028541rdb; Wed, 31 Jan 2024 17:41:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJNzxrkte2ED0Vgxj1xw7T/buDOApc3O3EFxhH+dffwEzR1IsmzLW4VZnwfHUH3kystXBb X-Received: by 2002:ae9:f40a:0:b0:784:71a6:f8df with SMTP id y10-20020ae9f40a000000b0078471a6f8dfmr1298656qkl.44.1706751693898; Wed, 31 Jan 2024 17:41:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706751693; cv=pass; d=google.com; s=arc-20160816; b=yKLYPsdQi/i5C2hEvnABRmoqyUEMQERG04DtagQLiw90h82i5wWIET1D76BaxE8bxD 8qX2Av9byc1cLKQKpfujJ4wdLYkaw7W2YLdH06UoTpc8nYtAZNBd5FuD5i428g5kSJVs hjR/H9OgoImXJx5qNpJuObfqwCdn+czwS1bPrnj3UYFpFVCu40U5Q2Yps0NJBik2HCsM SYvMb79RPltxHkDNMcYkvRgsrGeFjqEGMccIgjWOCeusZB72m7BmWMsQwM3uPPVq+fKN GZydy8752L66fpoOt9QyGY58p9f1xoQNmEUdssOr8/qS05jTjLvs6XiJs1gUVgTLz8vB LvKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=dkim-signature:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=JvMjCBUVrGXFZC2qljDPyvrEKH7rhB/lZvFad/K9Txk=; fh=j3MFS68/YzLIAKGa5qZNFITMXyJmBrZS+mR+3QZq25w=; b=SgalUB7nCYh9wrsvXGKR27AOVhsT0kI1GYSmjofXXss0DBbhFdeDCbK80p8zQAXa78 gj+ny8u28RGe62jUXEArCI70BszCH58Ah8UtRL6Wmq0JwDavtvFLVF0ix2ZfHDC9LYxJ Y9OKyaaX3Sk8jcZOtsx2Y7tnYy16ODm0e+G2tga8hkD6c09H0sh3D202zeAOl2g5RP+c 8+RwI/zodQidvNFaWTVvOjrSTEeYSQn1UeCvJ6/fbByq6CJMgae6dKtAaU5hq1luhRx6 khOQt9hxzBDSou5Lt2JYd+3L/Rv3QKTHNz9auUKuVPjFI2hZ4GMngoGAl9PG3LwXdRHh UWew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@peacevolution.org header.s=dkim header.b=Ep9W07WW; arc=pass (i=1 spf=pass spfdomain=peacevolution.org dkim=pass dkdomain=peacevolution.org dmarc=pass fromdomain=peacevolution.org); spf=pass (google.com: domain of linux-kernel+bounces-47504-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47504-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=peacevolution.org X-Forwarded-Encrypted: i=1; AJvYcCWHatlY67gHvTcisVFTld/5BzZtqemknN/bZKaludcIM9+Y224p3eNee2VmoGcq2bnb2oJ2bcioswnFF4A2Yte9qdgQwkolHclNiiQh3A== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dv27-20020a05620a1b9b00b007833f260edesi6407562qkb.487.2024.01.31.17.41.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 17:41:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47504-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@peacevolution.org header.s=dkim header.b=Ep9W07WW; arc=pass (i=1 spf=pass spfdomain=peacevolution.org dkim=pass dkdomain=peacevolution.org dmarc=pass fromdomain=peacevolution.org); spf=pass (google.com: domain of linux-kernel+bounces-47504-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47504-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=peacevolution.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6BFB21C25909 for ; Thu, 1 Feb 2024 01:40:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24E324C6C; Thu, 1 Feb 2024 01:40:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=peacevolution.org header.i=@peacevolution.org header.b="Ep9W07WW" Received: from a.peacevolution.org (a.peacevolution.org [206.189.193.133]) (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 BCDF4468C; Thu, 1 Feb 2024 01:40:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=206.189.193.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706751602; cv=none; b=ZFQPVnNYAcGM1fKFlS423gpcxKeoKe04QvhS23VRcXnyck+FWL5Mw4sxVf81iZDwiA1YPzfQV6iG+O/wl4e6gC+2T9kpSMlUwgpqbLQ2lFZ9u7G73iewFf9Mgqdao+xGWQmkORHp0CbEhbhutrWvpWmYTwPp+KujY7MvLn0YeEs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706751602; c=relaxed/simple; bh=A1tlK4TCfugZCxh7cLUfiJUk8o8OrnE6yG6ljGcq44Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BMzMF+zxNbmVfTvZkjxP2kkcKJRFL+f5/6TcQIOpg/sbg7BZjqYFvlHlW+lY+P2TnDwx9Xx2Qu3VjhcwauxtxK5TQgnPoYdQGnguNWvv0ZV5i7+tRD0cft1vmmWTV8MBzi7fJR0Gttmzv4BHtYqiSudelKfq8MAhLAGX/BDeKtw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peacevolution.org; spf=pass smtp.mailfrom=peacevolution.org; dkim=pass (1024-bit key) header.d=peacevolution.org header.i=@peacevolution.org header.b=Ep9W07WW; arc=none smtp.client-ip=206.189.193.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peacevolution.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peacevolution.org Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by a.peacevolution.org (Postfix) with ESMTPA id 5B8EE4661F; Thu, 1 Feb 2024 01:39:59 +0000 (UTC) Date: Wed, 31 Jan 2024 20:39:56 -0500 From: Aren To: Jean-Jacques Hiblot Cc: linux-kernel@vger.kernel.org, Miles Alan , Ondrej Jirman , Lee Jones , Pavel Machek , linux-leds@vger.kernel.org Subject: Re: [PATCH 1/4] leds: rgb: leds-group-multicolor: allow leds to stay on in suspend Message-ID: References: <20240128204740.2355092-1-aren@peacevolution.org> <05f9c78d-b398-420e-bc0f-fb642e76efdc@traphandler.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <05f9c78d-b398-420e-bc0f-fb642e76efdc@traphandler.com> X-Spamd-Bar: / Authentication-Results: auth=pass smtp.auth=aren@peacevolution.org smtp.mailfrom=aren@peacevolution.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peacevolution.org; s=dkim; t=1706751599; h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references; bh=JvMjCBUVrGXFZC2qljDPyvrEKH7rhB/lZvFad/K9Txk=; b=Ep9W07WWq+0q3pQf2pSI2/+aGXd0oDYAPpOc0EeqMYqf252JhapEb5w9zLMEeUs4KZ3yji stCVVU0MaTX5dwR/RE1fEHviKDdWLsdDPpgiF7HBMbW53oizPQFBHBRb3bkNlWGaymfqhz DLknk7eakjbRtcG90+DzjsXfoBxlV5I= On Wed, Jan 31, 2024 at 08:39:01AM +0100, Jean-Jacques Hiblot wrote: > > > 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 ? Yes, good catch, thanks! I'm not sure how I missed that when I tested this, I must've gotten (un)lucky with the value that was in ram before. - Aren > > 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)